basti1302 / repoman

Multi-repository source code management command-line tool.
http://blog.cliffano.com/tag/repoman/
MIT License
40 stars 15 forks source link
Avatar

Build Status Dependencies Status Published Version
npm Badge

Repoman

Multi-repository management command-line tool with support for Git and Subversion.

Repoman is a handy tool when you're working on multiple related version control repositories. Rather than updating each repository one by one, repoman allows you to just run repoman get and update all of them in one go. Rather than checking for uncommitted local changes one by one, you can run repoman changes or repoman report and check all in one go.

If you often switch between multiple computers, you can use the same .repoman.json file on those computers and easily manage the same set of repositories or share a .repoman.json file with you team so everyone can clone the required set of repositories in one step.

If you are have a GitHub account, you can use Repoman to clone all of your repositories from GitHub with a one liner: repoman config --github-user <user> && repoman init .

Installation

npm install -g repoman

Usage

Initial Configuration

Initial Clone/Checkout

Everyday Workflow Commands

Custom commands

You can use mustache.js templates in the custom command. The variables workspace and name will be substituted by the workspace directory (where your .repoman.json lives) and the directory name of the repository respectively. Additionally, the variable pathseparator will be replaced by path.sep, that is by \\ on Windows and / on all Unix-based operating systems. Note: It is recommended to use {{{ and }}} instead of {{ and }} to avoid the HTML-escaping mustache.js does for the latter.

Here are some examples for custom commands:

Advanced Examples

Configuration

Repositories can be configured in .repoman.json file:

{
  "couchdb": {
    "type": "git",
    "url": "http://git-wip-us.apache.org/repos/asf/couchdb.git",
    "tags": ["apache", "database"]
  },
  "httpd": {
    "type": "svn",
    "url": "http://svn.apache.org/repos/asf/httpd/httpd/trunk/",
    "tags": ["apache", "webserver"]
  },
  "node": {
    "type": "git",
    "url": "http://github.com/joyent/node",
    "tags": ["github", "javascript"]
  }
}

Type property is optional. If not provided, Repoman will try to determine the type from the URL by checking the existence of keywords: git, svn, subversion. If type can't be determined from the URL, it defaults to git.

Repoman will choose which configuration file to use in this order:

  1. Any file specified in -c/--config-file flag
  2. .repoman.json file in the current directory
  3. .repoman.json file in home directory (process.env.USERPROFILE on Windows, process.env.HOME on *nix)

SCM Command Mappings

Repoman uses the following SCM command mapping.

Repoman Git Subversion
repoman init git clone {url} svn checkout {url}
repoman get git pull --rebase svn up
repoman changes git status -s && git log --branches --not --remotes --oneline svn stat
repoman save git push origin main svn commit -m "Commited by Repoman"
repoman undo git reset --hard svn revert -R .

Contributing

Run npm run build to kick off the full build including tests, integration tests, coverage etc. Note: Currently, the integration tests will fail on systems where git uses a different localization than English.