[PATCH 0 of 2] Use branch rev when setting bookmark with same name

Matt Mackall mpm at selenic.com
Wed Nov 10 14:50:12 CST 2010


On Tue, 2010-11-09 at 17:29 -0600, Will Maier wrote:
> Hi Matt-
> 
> On Tue, Nov 09, 2010 at 11:04:08AM -0600, Matt Mackall wrote:
> > > With this series, the bookmarks extension prefers local branches to
> > > bookmarks when they share the same name. This behavior makes it easier to
> > > keep a bookmark in sync with a local branch, which is a common task when
> > > working with hg-git.
> >
> > What is a local branch?
> 
> I think I just meant 'branch' there. ;)
> 
> > You're proposing changing lookup so branch names take precedence over
> > bookmarks.. always?
> 
> No; normal lookup should stay the same. When moving a bookmark that has
> the same name as a branch, though, it makes more sense to use the branch's rev
> instead of the bookmark's rev. Doing the former makes it possible to sync
> bookmarks and branches; doing the latter is a noop.
> 
> For example, I have several Mercurial repos that are cloned to github via
> hg-git. Some of those repos have stable branches, so I need to keep a 'stable'
> bookmark in sync with the stable branch head. Without this series, the following
> is always a noop:
>     
>     $ hg bookmarks -fr stable stable

Weird. Why do you need two ways to keep track of that?

hg 1.7 has a way to unambiguously refer to branch names (and tags,
bookmarks, revs, etc), namely -r 'branch(foo)'. I've added support for
this to most of the core commands, but haven't yet done extensions. It
should be a one-liner.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial mailing list