[PATCH 0 of 4] Various updates to make branches work better.

Eric Hopper hopper at omnifarious.org
Tue Jun 12 14:45:53 CDT 2007


These patches contain a number of related but distinct changes.
Hopefully these updated versions address everybody's concerns.  This
update also allows for the use of a version independent set type, which
I think will make it easier to express some algorithms clearly.


Some code is addded to util.py to import a common name for the set
datatype that was introduced as pure Python in Python 2.3.0 and later
converted to a native data type in Python 2.4.0.

The set datatype is slightly slower than dictionaries even in Python2.5,
though I suspect that this will change over time.  But I notice a lot of
code that uses dict.fromkeys, and it isn't always clear whether the
values in those dictionaries are meaningful or not.  If a set datatype
were avilable, those cases could be made clearer, and possibly even with
less code.


Then import is changed to add an option to allow branch information to
be imported.  It is already the case that import --exact will import
branch information.  But sometimes import and export are used for other
kinds of automated repository cleanups or changes.  In these cases it is
useful to be able to have the option of moving along branch information
without necessarily forcing the resulting revisions to have exactly
matching hashes.

An automated tool could parse the branch information out itself and set
the branch, but when Mercurial already has to have code to do this for
--exact to work right, why should an external tool have to duplicate
code?


Then heads is changed to allow some number of branches to be specified
as arugments.  If no branches are specified, the standard behavior of
head giving a list of repo-wide heads is kept.  But if branches are
specified a list of heads for each branch in turn is output instead,
with duplicate branch names being silently ignore.  A '.' is also
allowed, in which case the branch is the branch of the working copy's
parent.  Branch heads may or may not be also global repository heads.  A
branch head is simply defined as a revision in a branch with no child
revisions in that same branch.


Lastly branches is made to display all the branches with un-merged heads
first along with a marker showing that this branch is a current head,.
If given the -a or --active option, it displays only branches that have
un-merged heads.  It also keeps the current behavior o putting the most
recent revisions first, except that heads go first regardless of how
recent they are.

This should be helpful in getting a handle on a repository with large
numbers of branches.  Branches never go away since they are recorded in
the changeset record and are included in the version hash.  This means a
repository with a long history may end up with a large number of
branches that are no longer important.  This should help in reducing the
clutter and identifying important branches that are being used for
current development.


The documentation provided for these commands calls global repository
heads 'active' heads.

The changes are based on the most recent version of crew, and they can
be pulled from either the attached bundle or from
http://hg.omnifarious.org/~hopper/to-crew/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: branch-fix.hg
Type: application/octet-stream
Size: 5506 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20070612/f8c254ed/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20070612/f8c254ed/attachment.pgp 


More information about the Mercurial-devel mailing list