[Bug 5495] New: No way to ask hg to update to a bookmark?

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Fri Mar 3 09:02:44 EST 2017


https://bz.mercurial-scm.org/show_bug.cgi?id=5495

            Bug ID: 5495
           Summary: No way to ask hg to update to a bookmark?
           Product: Mercurial
           Version: 3.8.2
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: bookmarks
          Assignee: bugzilla at mercurial-scm.org
          Reporter: aalekseyev at janestreet.com
                CC: mercurial-devel at mercurial-scm.org

I want to tell hg to update to a certain bookmark and activate it. I think
there is no way to do it with hg update.

Let's say the bookmark I want to update to is called "x-y" (without quotes).

The most straightforward way:

$ hg update "x-y" 

can succeed even if no such bookmark exist: it will happily update to a
revision that's present in x but not in y instead of failing with "unknown
revision 'x-y'".
It can also update to not-what-you-want in some cases even if the bookmark
exists, for example:

$ crazy_bookmark=$(hg log -r .^ --template '{node}'); hg book
"$crazy_bookmark"; hg up "$crazy_bookmark"

(In fact this comes with a bonus bug: after you do this hg gets confused and it
thinks it's both on bookmark $crazy_bookmark and on revision $crazy_bookmark!)

The less straightforward ways leave the bookmark inactive:

$ hg update 'bookmark("x-y")'
$ hg update '"x-y"'

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list