Hg update should prefer heads without bookmarks

Matt Mackall mpm at selenic.com
Fri May 29 19:08:54 UTC 2015


On Fri, 2015-05-29 at 11:31 -0700, cowwoc wrote:
> On 29/05/2015 1:29 PM, Matt Mackall [via Mercurial] wrote:
> > On Wed, 2015-05-27 at 11:14 -0700, cowwoc wrote:
> > > Hi,
> > >
> > > Following up on this old discussion:
> > > http://www.kevinberridge.com/2012/05/hg-bookmarks-made-me-sad.html
> > >
> > > Is there a way to configure a Mercurial repository so that 
> > client-side "hg
> > > clone <repo>" and "hg pull -u" resolve to the latest changeset on the
> > > "default" branch not containing a bookmark?
> >
> > You could create a post-clone hook. But you should probably investigate
> > using the @ bookmark if you're using any bookmarks. It plays the same
> > role for bookmarks as default does for branches.
> 
> This works great. Me so happy! :)
> 
> I guess all that's left is to improve the documentation.

FYI, here is the primary source:

$ hg help clone
hg clone [OPTION]... SOURCE [DEST]
...
    If the source repository has a bookmark called '@' set, that revision will
    be checked out in the new repository by default.

Much like the default branch, clone is the only place where the @
default actually means anything.

> Based on the first result page returned by Google, I suggest:
> 
>   * Adding a discussion of bookmarks to http://hgbook.red-bean.com/
>     (they don't seem to be mentioned at all)

That's because they didn't exist in Mercurial 1.2.

>   * Featuring this information more prominently on
>     https://mercurial.selenic.com/wiki/Bookmarks

Surprised it was missing there.

>   * Mentioning this on https://mercurial.selenic.com/wiki/Branch section
>     2 alongside the "default branch" definition.

Uh.. why? But it's a wiki, have at.

>   * Updating
>     http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/
>     section bookmarks
>   * Updating
>     http://www.kevinberridge.com/2012/05/hg-bookmarks-made-me-sad.html
>     section "Hg up should prefer heads without bookmarks" because it is
>     no longer true
>   * Updating
>     http://draketo.de/light/english/mercurial/complete-branching-strategy#fn:bookmarks
>     because it is no longer true

If I could delete all the wrong stuff on the internet, the disk space
savings alone would collapse the world economy.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial mailing list