Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 15935:6c97eb445341
bookmarks: automatically advance bookmark on naked update (BC) (issue2894)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 19 Jan 2012 14:07:48 -0600 |
parents | 2bd54ffaa27e |
children | f57f891eb88e |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Jan 19 11:35:06 2012 -0600 +++ b/mercurial/commands.py Thu Jan 19 14:07:48 2012 -0600 @@ -5633,7 +5633,7 @@ Update the repository's working directory to the specified changeset. If no changeset is specified, update to the tip of the - current named branch. + current named branch and move the current bookmark. If the changeset is not a descendant of the working directory's parent, the update is aborted. With the -c/--check option, the @@ -5678,6 +5678,11 @@ if rev is None or rev == '': rev = node + # with no argument, we also move the current bookmark, if any + movemarkfrom = None + if node is None or node == '': + movemarkfrom = repo['.'].node() + # if we defined a bookmark, we have to remember the original bookmark name brev = rev rev = scmutil.revsingle(repo, rev, rev).rev() @@ -5701,7 +5706,9 @@ else: ret = hg.update(repo, rev) - if brev in repo._bookmarks: + if not ret and movemarkfrom: + bookmarks.update(repo, [movemarkfrom], repo['.'].node()) + elif brev in repo._bookmarks: bookmarks.setcurrent(repo, brev) return ret