Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bookmarks.py @ 13663:d16c99f16f00
bundle: update current bookmark to most recent revision on current branch
We check if the current bookmark is set to the first parent of the
dirstate. Is this the case we move the bookmark to most recent revision
on the current branch (where hg update will update you to).
author | David Soria Parra <dsp@php.net> |
---|---|
date | Mon, 14 Mar 2011 23:03:56 +0100 |
parents | c0c599709846 |
children | 97ed99d1f419 |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Mon Mar 14 20:53:55 2011 +0100 +++ b/mercurial/bookmarks.py Mon Mar 14 23:03:56 2011 +0100 @@ -116,6 +116,15 @@ wlock.release() repo._bookmarkcurrent = mark +def updatecurrentbookmark(repo, oldnode, curbranch): + try: + update(repo, oldnode, repo.branchtags()[curbranch]) + except KeyError: + if curbranch == "default": # no default branch! + update(repo, oldnode, repo.lookup("tip")) + else: + raise util.Abort(_("branch %s not found") % curbranch) + def update(repo, parents, node): marks = repo._bookmarks update = False