/!\ This extension is unmaintained! Consider using the built-in remotenames extension instead. Here is an example of how to migrate.

Remote Branches Extension

This extension is not distributed with Mercurial.

Author: Augie Fackler

Repository: https://bitbucket.org/durin42/hg-remotebranches/


Quick tracking of remote branch heads for easy offline checking and reference. Similar to git's remote refs if you're familiar with git.


Configure your .hgrc to enable the extension by adding following lines:

remotebranches = ~/path/to/remotebranches/hg_remotebranches.py


For any path in a repo's [paths] configuration section, record the branch heads and provide local tags for those branch heads. For example, if I track crew as crew = http://hg.intevation.org/mercurial/crew and mpm as mpm = http://selenic.com/hg, hg log -r 'reverse(::13855)' --limit 3 --graph produces the following output:

augie% hg log -r 'reverse(::13855)' --limit 3 --graph
o  13855   ebcb000b853f   2011-03-01 23:35 -0600   durin42
|    demandimport: blacklist rfc822 and mimetools to prevent spurious warnings
@  13854[crew/default,mpm/default]   5ed036e42fd9   2011-04-01 20:40 +0200   pmezard
|    bugzilla: fix documentation typo
o    13853:13850,13852   3cbf5c6dcdb8   2011-04-01 13:25 -0500   mpm
|\     merge with stable
| |

that is, the head of default in crew is marked with a tag named crew/default and stable in mpm is mpm/stable. In the above output, revision ebcb000b853f hasn't been added to any remote repository yet, but default in both mpm and crew is at 5ed036e42fd9.

If you're on a version of Mercurial with revsets, the pushed() and upstream() convenience revsets are available. pushed() revisions are those that are pushed in any repository known by remotebranches, while upstream() shows revisions that are in paths you've described as being upstream from you. For example, one might configure .hg/hgrc for a clone of Mercurial like this (this is the config used for the above example):



Note that the default path is the same crew, but the tags are created with the prefix crew/ and never default/. This is intentional: the default/ prefix is skipped if it is the same URL as any other path. These revsets are useful if you want to see 'hg outgoing' against multiple repositories or while disconnected.


RemoteBranchesExtension (last edited 2019-08-19 20:47:35 by JordiGH)