XT

XT is a tool that allows you to setup and administer remote access to multiple mercurial repositories hosted on a dedicated server.

The use case is this: you have a dedicated unix box that holds a number of mercurial repositories, and you want to:

XT helps you with all the above.

Where to get it

The sources can be found at [1]. In particular you'll be interested in two files:

Both are fairly portable and self-contained shell scripts; they should work on most Unix-like systems. An installation of mercurial is the only real dependency.

Quick usage

Server-side

Place xt-host somewhere in PATH on the server machine, create user hg, and then setup the system like this:

xt-host prepare
xt-host add-user your-user-name your-ssh-key-file.pub

(Run that as root).

Optionally you can start web server to be able to view all your repositories in a browser:

xt-host serve :80

The server-side setup is now done (not counting sshd, which you should have up and running).

Client-side

Place xt somewhere in PATH on the client machine. Now you can upload new projects to the server like this:

xt -s server-hostname upload /path/to/repository project-name

... and edit it's description like this:

xt -s server-hostname edit project-name

(This will open an editor that will allow you to set project description and contact visible from the web interface).

That's pretty much all. Pushing via hg push and pulling via hg pull to ssh://hg@server-hostname/project-name will work normally now.

Note that you can simplify xt usage by storing server hostname in the rc file, so you wouldn't have to add -s server-hostname every time:

echo 'XTSERVER=server-hostname' > ~/.xtrc

User guide

NAME

    xt -- the client-side tool

USAGE

    xt [options] command [args]

OPTIONS

    -u user         set remote user name (default: hg)
    -s hostname     set remote server
    -i identity     override ssh identify file

COMMANDS

    clone source [dest]
        clone remote repository 'source' to directory 'dest'
    upload source [dest]
        clone local repository 'source' to remote repo 'dest'
    edit repo
        edit the settings of remote repository 'repo'
    change-key key-file
        use (openssh) public key 'key-file' as your new key
    delete repo [--yes-really]
        delete repository 'repo' from the server

ENVIRONMENT VARIABLES

    XTUSER          remote user name (same as -u option)
    XTSERVER        remote server name (same as -s option)
    EDITOR, VISUAL  your editor (default: vi)
    TMPDIR          directory for temporary files (default: /tmp)

FILES

    ~/.xtrc         initial commands, executed prior to everything

Admin guide

NAME

    xt-host -- the server-side tool

USAGE

    xt-host [options] command [args]

OPTIONS

    -d path         set path to data root (default: /var/db/xt)
    -u user         set owner of the data (default: hg)
    -g group        set data owner group (default: hg)

COMMANDS

    prepare
        create the required directory structure 
    add-user name key-file
        add a new (remote) user with name 'name' and private key 'key-file'
    remove-user name
        remove user 'name' along with it's keys (repos stay intact)
    change-key name key-file
        change the key of user 'name' to that from 'key-file'
    serve [host][:port]
        start hgweb on address host:port (default: 0.0.0.0:4000)

ENVIRONMENT VARIABLES

    XTHOSTDIR       path to data root (same as -d option)
    XTHOSTUSER      local data owner (same as -u option)
    XTHOSTGROUP     data owner group (same as -g option)

FILES

    /var/db/xt      default location of all the data

See also

There is a number of tools with similar goal; see [2] for a list.

References

  1. http://hg.tx97.net/xt
  2. http://mercurial.selenic.com/wiki/SharedSSH