MAN page from OpenSuSE mr-1.20170129-1.1.noarch.rpm


Section: mr (1)
Updated: 2017-01-29


mr - a tool to manage all your version control repos 


mr [options] checkout

mr [options] update

mr [options] status

mr [options] clean [-f]

mr [options] commit [-m ``message'']

mr [options] record [-m ``message'']

mr [options] fetch

mr [options] push

mr [options] diff

mr [options] log

mr [options] grep pattern

mr [options] run command [param ...]

mr [options] bootstrap src [directory]

mr [options] register [repository]

mr [options] config section [``setting=[value]'' ...]

mr [options] action [params ...]

mr [options] [online|offline]

mr [options] remember action [params ...] 


mr is a tool to manage all your version control repos. It can checkout,update, or perform other actions on a set of repositories as if they wereone combined repository. It supports any combination of subversion, git,cvs, mercurial, bzr, darcs, fossil and veracity repositories, and supportfor other version control systems can easily be added.

mr cds into and operates on all registered repositories at or below yourworking directory. Or, if you are in a subdirectory of a repository thatcontains no other registered repositories, it will stay in that directory,and work on only that repository,

mr is configured by .mrconfig files, which list the repositories. Itstarts by reading the .mrconfig file in your home directory, and this canin turn chain load .mrconfig files from repositories. It also automaticallylooks for a .mrconfig file in the current directory, or in one of itsparent directories.

These predefined commands should be fairly familiar to users of any versioncontrol system:

checkout (or co)
Checks out any repositories that are not already checked out.
Updates each repository from its configured remote repository.

If a repository isn't checked out yet, it will first check it out.

Displays a status report for each repository, showing whatuncommitted changes are present in the repository. For distributed versioncontrol systems, also shows unpushed local branches.
Print ignored files, untracked files and other cruft in the working directory.

The optional -f parameter allows removing the files as well as printing them.

commit (or ci)
Commits changes to each repository. (By default, changes are pushed to theremote repository too, when using distributed systems like git. If youdon't like this default, you can change it in your .mrconfig, or use recordinstead.)

The optional -m parameter allows specifying a commit message.

Records changes to the local repository, but does not push them to theremote repository. Only supported for distributed version control systems.

The optional -m parameter allows specifying a commit message.

Fetches from each repository's remote repository, but does notupdate the working copy. Only supported for some distributed versioncontrol systems.
Pushes committed local changes to the remote repository. A no-op forcentralized version control systems.
Show a diff of uncommitted changes.
Show the commit log.
grep pattern
Searches for a pattern in each repository using the grep subcommand. Usesack-grep on VCS that do not have their own.
run command [param ...]
Runs the specified command in each repository.

These commands are also available:

bootstrap src [directory]
Causes mr to retrieve the source "src" and use it as a .mrconfig file tocheckout the repositories listed in it, into the specified directory.

mr understands several types of sources:

URL for curl
"src" may be an URL understood by curl.
copy via ssh
To use scp to download, the "src" may have the form"ssh://[user@]host:file".
local file
You can retrieve the config file by other means and pass its path as "src".
standard input
If source "src" consists in a single dash "-", config file is read fromstandard input.

The directory will be created if it does not exist. If no directory isspecified, the current directory will be used.

As a special case, if source "src" includes a repository named ``.'', thatis checked out into the top of the specified directory.

list (or ls)
List the repositories that mr will act on.
Register an existing repository in a mrconfig file. By default, therepository in the current directory is registered, or you can specify adirectory to register.

The mrconfig file that is modified is chosen by either the -c option, or bylooking for the closest known one at or in a parent of the current directory.

Adds, modifies, removes, or prints a value from a mrconfig file. The nextparameter is the name of the section the value is in. To add or modifyvalues, use one or more instances of ``setting=value''. Use ``setting='' toremove a setting. Use just ``setting'' to get the value of a that setting.

For example, to add (or edit) a repository in src/foo:

  mr config src/foo checkout="svn co svn:// foo"

To show the command that mr uses to update the repository in src/foo:

  mr config src/foo update

To see the built-in library of shell functions contained in mr:

  mr config DEFAULT lib

The mrconfig file that is used is chosen by either the -c option, or bylooking for the closest known one at or in a parent of the current directory.

Advises mr that it is in offline mode. Any commands that fail inoffline mode will be remembered, and retried when mr is told it's online.
Advices mr that it is in online mode again. Commands that failed while inoffline mode will be re-run.
Remember a command, to be run later when mr re-enters online mode. Thisimplicitly puts mr into offline mode. The command can be any regular mrcommand. This is useful when you know that a command will fail due to beingoffline, and so don't want to run it right now at all, but just rememberto run it when you go back online.
Displays this help.

Actions can be abbreviated to any unambiguous substring, so``mr st'' is equivalent to ``mr status'', and ``mr up'' is equivalent to ``mrupdate''

Additional parameters can be passed to most commands, and are passed onunchanged to the underlying version control system. This is mostly usefulif the repositories mr will act on all use the same version controlsystem. 


-d directory
--directory directory
Specifies the topmost directory that mr should work in. The default isthe current working directory.
-c mrconfig
--config mrconfig
Use the specified mrconfig file. The default is to use both ~/.mrconfigas well as look for a .mrconfig file in the current directory, or in oneof its parent directories.
Force mr to act on repositories that would normally be skipped due to theirconfiguration.
Force mr to execute even though potentially dangerous environment variablesare set.
Be verbose.
Minimise output. If a command fails or there is any output then the usualoutput will be shown.
Be quiet. This suppresses mr's usual output, as well as any output fromcommands that are run (including stderr output). If a command fails,the output will be shown.
Accept untrusted SSL certificates when bootstrapping.
Expand the statistics line displayed at the end to include informationabout exactly which repositories failed and were skipped, if any.
Interactive mode. If a repository fails to be processed, a subshell will bestarted which you can use to resolve or investigate the problem. Exit thesubshell to continue the mr run.
-n [number]
--no-recurse [number]
If no number if specified, just operate on the repository for the currentdirectory, do not recurse into deeper repositories.

If a number is specified, will recurse into repositories at most that manysubdirectories deep. For example, with -n 2 it would recurse into ./src/foo,but not ./src/packages/bar.

-j [number]
--jobs [number]
Run the specified number of jobs in parallel, or an unlimited number of jobswith no number specified. This can greatly speed up operations such as updates.It is not recommended for interactive operations.

Note that running more than 10 jobs at a time is likely to run afoul ofssh connection limits. Running between 3 and 5 jobs at a time will yielda good speedup in updates without loading the machine too much.

Trust all mrconfig files even if they are not listed in ~/.mrtrust.Use with caution.
This obsolete flag is ignored.


Here is an example .mrconfig file:

  [src]  checkout = svn checkout svn:// src  chain = true  [src/linux-2.6]  checkout = git clone git:// &&        cd linux-2.6 &&        git checkout -b mybranch origin/master

The .mrconfig file uses a variant of the INI file format. Linesstarting with ``#'' are comments. Values can be continued to thefollowing line by indenting the line with whitespace.

The "DEFAULT" section allows setting default values for the sections thatcome after it.

The "ALIAS" section allows adding aliases for actions. Each settingis an alias, and its value is the action to use.

All other sections add repositories. The section header specifies thedirectory where the repository is located. This is relative to the directorythat contains the mrconfig file, but you can also choose to use absolutepaths. (Note that you can use environment variables in section names; theywill be passed through the shell for expansion. For example, "[$HOSTNAME]", or "[${HOSTNAME}foo]").

Within a section, each setting defines a shell command to run to handle agiven action. mr contains default handlers for ``update'', ``status'',``commit'', and other standard actions.

Normally you only need to specify what to do for ``checkout''. Here youspecify the command to run in order to create a checkout of the repository.The command will be run in the parent directory, and must create therepository's directory. So use "git clone", "svn checkout", "bzr branch"or "bzr checkout" (for a bound branch), etc.

Note that these shell commands are run in a "set -e" shellenvironment, where any additional parameters you pass are available in$@. All commands other than ``checkout'' are run inside the repository,though not necessarily at the top of it.

The "MR_REPO" environment variable is set to the path to the top of therepository. (For the ``register'' action, ``MR_REPO'' is instead set to the basename of the directory that should be created when checking therepository out.)

The "MR_CONFIG" environment variable is set to the .mrconfig filethat defines the repo being acted on, or, if the repo is not yet in a configfile, the .mrconfig file that should be modified to register the repo.

The "MR_ACTION" environment variable is set to the command being run(update, checkout, etc).

A few settings have special meanings:

If ``skip'' is set and its command returns true, then mrwill skip acting on that repository. The command is passed the actionname in $1.

Here are two examples. The first skips the repo unlessmr is run by joey. The second uses the hours_since function(included in mr's built-in library) to skip updating the repo unless it'sbeen at least 12 hours since the last update.

  [mystuff]  checkout = ...  skip = test `whoami` != joey  [linux]  checkout = ...  skip = [ "$1" = update ] && ! hours_since "$1" 12

Another way to use skip is for a lazy checkout. This makes mr skipoperating on a repo unless it already exists. To enable the repo, you have to explicitly check it out (using ``mr --force -d foo checkout'').

  [foo]  checkout = ...  skip = lazy
The ``order'' setting can be used to override the default ordering ofrepositories. The default order value is 10. Use smaller values to makerepositories be processed earlier, and larger values to make repositoriesbe processed later.

Note that if a repository is located in a subdirectory of anotherrepository, ordering it to be processed earlier is not recommended.

If ``chain'' is set and its command returns true, then mrwill try to load a .mrconfig file from the root of the repository.
If ``include'' is set, its command is ran, and should outputadditional mrconfig file content. The content is included as if it werepart of the including file.

Unlike everything else, ``include'' does not need to be placed within a section.

mr ships several libraries that can be included to add support foradditional version control type things (unison, git-svn, git-fake-bare,git-subtree). To include them all, you could use:

  include = cat /usr/share/mr/*

See the individual files for details.

If ``deleted'' is set and its command returns true, thenmr will treat the repository as deleted. It won't ever actually deletethe repository, but it will warn if it sees the repository's directory.This is useful when one mrconfig file is shared among multiple machines,to keep track of and remember to delete old repositories.
The ``lib'' setting can contain some shell code that will be runbefore each command, this can be a useful way to define shellfunctions for other commands to use.

Unlike most other settings, this can be specified multiple times, inwhich case the chunks of shell code are accumulatively concatenatedtogether.

If ``fixups'' is set, its command is run whenever a repositoryis checked out, or updated. This provides an easy way to do thingslike permissions fixups, or other tweaks to the repository content,whenever the repository is changed.
If ``jobs'' is set, run the specified number of jobs in parallel.This can greatly speed up operations such as updates.

Note that running more than 10 jobs at a time is likely to run afoul ofssh connection limits. Running between 3 and 5 jobs at a time will yielda good speedup in updates without loading the machine too much.

When looking for a command to run for a given action, mr first looks fora setting with the same name as the action. If that is not found, itlooks for a setting named ``VCS_action'' (substituting in the name of theversion control system and the action).

Internally, mr has settings for ``git_update'', ``svn_update'', etc. To changethe action that is performed for a given version control system, you canoverride these VCS specific actions. To add a new version control system,you can just add VCS specific actions for it.

pre_ and post_
If ``pre_action'' is set, its command is run before mr performs thespecified action. Similarly, ``post_action'' commands are run after mrsuccessfully performs the specified action. For example, ``pre_commit'' isrun before committing; ``post_update'' is run after updating.
Any setting can be suffixed with "_append", to add an additional valueto the existing value of the setting. In this way, actions can be constructed accumulatively.
The name of the version control system is itself determined byrunning each defined ``VCS_test'' action, until one succeeds.


Since mrconfig files can contain arbitrary shell commands, they can doanything. This flexibility is good, but it also allows a malicious mrconfigfile to delete your whole home directory. Such a file might be containedinside a repository that your main ~/.mrconfig checks out. Toavoid worries about evil commands in a mrconfig file, mr defaults toreading all mrconfig files other than the main ~/.mrconfig in untrustedmode. In untrusted mode, mrconfig files are limited to running only knownsafe commands (like ``git clone'') in a carefully checked manner.

To configure mr to trust other mrconfig files, list them in ~/.mrtrust.One mrconfig file should be listed per line. Either the full pathnameshould be listed, or the pathname can start with ~/ to specify a filerelative to your home directory. 


The ~/.mrlog file contains commands that mr has remembered to run later,due to being offline. You can delete or edit this file to remove commands,or even to add other commands for 'mr online' to run. If the file ispresent, mr assumes it is in offline mode. 


mr can be extended to support things such as unison and git-svn. Somefiles providing such extensions are available in /usr/share/mr/. Seethe documentation in the files for details about using them. 


mr returns nonzero if a command failed in any of the repositories. 


Copyright 2007-2011 Joey Hess <>

Licensed under the GNU GPL version 2 or higher.




This document was created byman2html,using the manual pages.