Class MultiVersionControl
You can specify the set of clones for the program to manage in a file .mvc-checkouts,
or you can pass --search to make the program search your directory structure to find all
of your clones. For example (assuming you have a mvc alias),
to list all un-committed changed files under your home directory:
mvc status --search=true
This program accepts these arguments:
clone -- Clone (check out) all repositories.
checkout -- Same as clone.
pull -- Pull and update all clones.
update -- Same as pull.
status -- Show files that are changed but not committed, or committed
but not pushed, or have shelved/stashed changes.
list -- List the clones/checkouts that this program is aware of.
(The commit action is not supported, because that is not something that should be done
in an automated way — it needs a user-written commit message.)
Command-line arguments
The command-line options are as follows:
- Configuration file
- --home=string. User home directory. [default Java
user.homeproperty] - --checkouts=string. File with list of clones. Set
it to /dev/null to suppress reading. [default
.mvc-checkoutsin home directory]
- --home=string. User home directory. [default Java
- Miscellaneous options
- --redo-existing=boolean. If false, clone command skips existing directories. [default: false]
- --timeout=int. Terminating the process can leave the repository in a bad state, so set this rather high for safety. Also, the timeout needs to account for the time to run hooks (that might recompile or run tests). [default: 600]
- Searching for clones
- --search=boolean. If true, search for all clones, not just those listed in a file. [default: false]
- --search-prefix=boolean. If true, search for all clones whose directory is a prefix of one in the cofiguration file. [default: false]
- --dir=string
[+]. Directory under which to search for clones, when using--search[default home directory] - --ignore-dir=string
[+]. Directories under which to NOT search for clones. May include leading "~/".
- Paths to programs
- --cvs-executable=string. Path to the cvs program. [default: cvs]
- --git-executable=string. Path to the git program. [default: git]
- --hg-executable=string. Path to the hg program. [default: hg]
- --svn-executable=string. Path to the svn program. [default: svn]
- --insecure=boolean. If true, use --insecure when invoking programs. [default: false]
- --cvs-arg=string
[+]. Extra argument to pass to the cvs program. - --git-arg=string
[+]. Extra argument to pass to the git program. - --hg-arg=string
[+]. Extra argument to pass to the hg program. - --svn-arg=string
[+]. Extra argument to pass to the svn program.
- Diagnostics
- --show=boolean. If true, display each command is it is executed. [default: false]
- --print-directory=boolean. If true, print the directory before executing commands in it. [default: false]
- --dry-run=boolean. Perform a "dry run": print commands but do not execute them. [default: false]
- -q --quiet=boolean. If true, run quietly (e.g., no output about missing directories). [default: true]
- --debug=boolean. Print debugging output. [default: false]
- --debug-replacers=boolean. Debug 'replacers' that filter command output. [default: false]
- --debug-process-output=boolean. Lightweight debugging of 'replacers' that filter command output. [default: false]
[+] means option can be specified multiple times
File format for .mvc-checkouts file
The remainder of this document describes the file format for the .mvc-checkouts file.
(Note: because mvc can search for all checkouts in your directory, you don't need a
.mvc-checkouts file. Using a .mvc-checkouts file makes the program faster because it
does not have to search all of your directories. It also permits you to process only a certain
set of checkouts.)
The .mvc-checkouts file contains a list of sections. Each section names
either a root from which a sub-part (e.g., a module or a subdirectory) will be checked out, or a
repository all of which will be checked out. Examples include:
CVSROOT: :ext:login.csail.mit.edu:/afs/csail.mit.edu/u/m/mernst/.CVS/.CVS-mernst SVNROOT: svn+ssh://tricycle.cs.washington.edu/cse/courses/cse403/09sp SVNREPOS: svn+ssh://login.csail.mit.edu/afs/csail/u/a/user/.SVN/papers/parameterize-paper/trunk HGREPOS: https://jsr308-langtools.googlecode.com/hg
Within each section is a list of directories that contain a checkout from that repository. If the section names a root, then a module or subdirectory is needed. By default, the directory's basename is used. This can be overridden by specifying the module/subdirectory on the same line, after a space. If the section names a repository, then no module information is needed or used.
When performing a checkout, the parent directories are created if needed.
In the file, blank lines, and lines beginning with "#", are ignored.
Here are some example sections:
CVSROOT: :ext:login.csail.mit.edu:/afs/csail.mit.edu/group/pag/projects/classify-tests/.CVS ~/research/testing/symstra-eclat-paper ~/research/testing/symstra-eclat-code ~/research/testing/eclat SVNROOT: svn+ssh://login.csail.mit.edu/afs/csail/group/pag/projects/.SVNREPOS/ ~/research/typequals/igj ~/research/typequals/annotations-papers SVNREPOS: svn+ssh://login.csail.mit.edu/afs/csail/group/pag/projects/abb/REPOS ~/prof/grants/2008-06-abb/abb HGREPOS: https://checker-framework.googlecode.com/hg/ ~/research/types/checker-framework SVNROOT: svn+ssh://login.csail.mit.edu/afs/csail/u/d/dannydig/REPOS/ ~/research/concurrency/concurrentPaper ~/research/concurrency/mit.edu.refactorings concRefactor/project/mit.edu.refactorings
Furthermore, these 2 sections have identical effects:
SVNROOT: https://crashma.googlecode.com/svn/ ~/research/crashma trunk SVNREPOS: https://crashma.googlecode.com/svn/trunk ~/research/crashma
and, all 3 of these sections have identical effects:
SVNROOT: svn+ssh://login.csail.mit.edu/afs/csail/group/pag/projects/ ~/research/typequals/annotations SVNROOT: svn+ssh://login.csail.mit.edu/afs/csail/group/pag/projects/ ~/research/typequals/annotations annotations SVNREPOS: svn+ssh://login.csail.mit.edu/afs/csail/group/pag/projects/annotations ~/research/typequals/annotations
Installation
git clone https://github.com/plume-lib/multi-version-control cd multi-version-control ./gradlew shadowJar alias mvc='java -ea -cp CURRENT_DIR/build/libs/multi-version-control-all.jar org.plumelib.multiversioncontrol.MultiVersionControl'
-
Field Summary
FieldsModifier and TypeFieldDescriptionFile with list of clones.Extra argument to pass to the cvs program.Path to the cvs program.static booleanPrint debugging output.booleanLightweight debugging of 'replacers' that filter command output.booleanDebug 'replacers' that filter command output.Directory under which to search for clones, when using--search[default = home directory].booleanPerform a "dry run": print commands but do not execute them.Extra argument to pass to the git program.Path to the git program.Extra argument to pass to the hg program.Path to the hg program.static StringUser home directory.Directories under which to NOT search for clones.booleanIf true, use --insecure when invoking programs.booleanIf true, print the directory before executing commands in it.booleanIf true, run quietly (e.g., no output about missing directories).booleanIf false, clone command skips existing directories.booleanIf true, search for all clones, not just those listed in a file.booleanIf true, search for all clones whose directory is a prefix of one in the cofiguration file.booleanIf true, display each command is it is executed.Extra argument to pass to the svn program.Path to the svn program.intTerminating the process can leave the repository in a bad state, so set this rather high for safety. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRuns a version control command, such as "status" or "update", on a set of CVS/Git/Hg/SVN clones rather than just one.voidParse the command-line arguments.voidRun the action described by fieldaction, for each of the clones incheckouts.
-
Field Details
-
home
User home directory. [default Javauser.homeproperty] -
checkouts
File with list of clones. Set it to /dev/null to suppress reading. [default.mvc-checkoutsin home directory] -
redoExisting
public boolean redoExistingIf false, clone command skips existing directories. -
timeout
public int timeoutTerminating the process can leave the repository in a bad state, so set this rather high for safety. Also, the timeout needs to account for the time to run hooks (that might recompile or run tests). -
search
public boolean searchIf true, search for all clones, not just those listed in a file. -
searchPrefix
public boolean searchPrefixIf true, search for all clones whose directory is a prefix of one in the cofiguration file. -
dir
Directory under which to search for clones, when using--search[default = home directory]. -
ignoreDir
Directories under which to NOT search for clones. May include leading "~/". -
cvsExecutable
Path to the cvs program. -
gitExecutable
Path to the git program. -
hgExecutable
Path to the hg program. -
svnExecutable
Path to the svn program. -
insecure
public boolean insecureIf true, use --insecure when invoking programs. -
cvsArg
Extra argument to pass to the cvs program. -
gitArg
Extra argument to pass to the git program. -
hgArg
Extra argument to pass to the hg program. -
svnArg
Extra argument to pass to the svn program. -
show
public boolean showIf true, display each command is it is executed. -
printDirectory
public boolean printDirectoryIf true, print the directory before executing commands in it. -
dryRun
public boolean dryRunPerform a "dry run": print commands but do not execute them. -
quiet
public boolean quietIf true, run quietly (e.g., no output about missing directories). -
debug
public static boolean debugPrint debugging output. -
debugReplacers
public boolean debugReplacersDebug 'replacers' that filter command output. -
debugProcessOutput
public boolean debugProcessOutputLightweight debugging of 'replacers' that filter command output.
-
-
Constructor Details
-
MultiVersionControl
Create a MultiVersionControl instance.- Parameters:
args- the command-line arguments to MultiVersionControl
-
-
Method Details
-
main
Runs a version control command, such as "status" or "update", on a set of CVS/Git/Hg/SVN clones rather than just one.- Parameters:
args- the command-line arguments- See Also:
-
parseArgs
@RequiresNonNull({"dir","checkouts"}) @EnsuresNonNull("action") @EnsuresInitializedFields(fields="action") public void parseArgs(@UnknownInitialization MultiVersionControl this, String[] args) Parse the command-line arguments.- Parameters:
args- the command-line arguments- See Also:
-
process
Run the action described by fieldaction, for each of the clones incheckouts.- Parameters:
checkouts- the clones and checkouts to process
-