Bound Mode Extension

This extension is not distributed with Mercurial.

Author: Bill Barry (BillBarry)

Repository: https://bitbucket.org/Bill_Barry/boundmode

Overview

This extension creates a bound mode for use with mercurial. When in bound mode, every time you commit, the system attempts to push.

There is two ways to use this extension:

  1. locally
  2. shared

When using this extension locally you may use the provided bind and unbind commands. These commands alter a file in your .hg directory. In the shared form, you put a file called .hgboundrc in the root of your repository. This file would look something like this:

[paths]
auto-push = default
[ui]
bound = True

When available in a working copy, this file will cause all clones to attempt to push to their default location after each commit. The provided commands will override this file (local usage overrides shared usage).

Configuration

Enable the extension by adding following lines to your configuration file (hgrc):

[extensions]
boundmode=/path/to/boundmode.py

Usage

The extension adds two commands:

hg bind

hg bind will locally put you into bound mode:

hg bind [-f] [-a] [path]

The options provided with this command are:

-f or --force

change the bound path even if already bound

-a or --auto

change the auto path even if it already exists

The way bound mode works, you have 3 available paths which will be used in order:

  1. local.bound-push
  2. local.auto-push
  3. shared.auto-push

When you bind, if you do not provide a path, none of these paths are modified (if none are available then the command will fail). If you do provide a path, local.auto-push will be filled in and if it already exists then local.bound-push will be modified (unless -a is used).

hg unbind

hg unbind takes you out of bound mode

hg unbind

Caveats

This extension was written as something of a proof of concept to experiment with how doing this might work. The original intent was to imitate the way that Bazaar works in its Centralized workflow, but to do it while still feeling like you are using Mercurial (ie. not imitate to acknowledge that the Bazaar pattern is better, but rather to take the best parts of that workflow and bring it over to hg). As such, this extension is subject to changing at the whims of anybody willing to provide a patch (so long as the patch makes some sense) and is unlikely to ever be included in the base Mercurial distribution.


CategoryExtensionsByOthers

BoundModeExtension (last edited 2013-08-26 20:10:31 by StephenRasku)