Branchident extension for Mercurial 1.4

Adrian Buehlmann adrian at cadifra.com
Thu Nov 19 17:28:23 CST 2009


I've created a new extension that provides a method for renaming
and removing of names of named branches.

Hompage with details is at:
http://bitbucket.org/abuehl/hgext-branchident/wiki/Home

First part from that page:

The branchident extension adds an extra field 'branchid' in changesets
if a branch name other than 'default' is committed (use 'hg log --debug'
to print the extra fields).

The branch id is calculated as the sha-1 hash of the concatenation of
date, username, branch name and the node id's of the parents. It is set
on first commit of a new branch name.

Changesets having the same branch id are considered to be of the same
branch.

The name of the branch is defined by the extra field 'branch' of the
changeset with the highest revision number in the repo having that
branch id. So the branch name of later changesets with the same branch
id override earlier names of a branch.

A branch is continued on commit if the first parent already has a branch id.
The new changeset gets the branch id of its first parent.

The branchident extension adds an additional option to the commit command:

    --rename-branch  rename the current branch

This option is to be used on commit after changing the branch name with
'hg branch <newname>' to rename the current branch. If --rename-branch is
not specified on commit of a changed branch name, then a new branch with
a new branch id is created.

To remove a branch name, just rename it to 'default' by doing:

    hg branch --force default
    hg ci --rename-branch

The branchident extension adds an additional option to the identify
command:

    --branchid  show branch id

To show the branch id of a specific changeset use:

     hg identify --branchid --rev REV

This extension requires Mercurial version 1.4 or later.


More info, with usage examples on
http://bitbucket.org/abuehl/hgext-branchident/wiki/Home

Source with scripted tests for unix/linux:
http://bitbucket.org/abuehl/hgext-branchident/src/



More information about the Mercurial-devel mailing list