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

Will Maier willmaier at ml1.net
Wed Nov 10 21:03:12 UTC 2010


Hi Matt-

On Wed, Nov 10, 2010 at 02:50:12PM -0600, Matt Mackall wrote:
> 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?

To keep github clones in sync with my Mercurial originals.

> 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.

Oh! That's a much better approach. One-liner incoming...

-- 

Will Maier
http://will.m.aier.us/



More information about the Mercurial mailing list