changeset 16019:eb85d5f89fef stable

bookmarks: move current bookmark on update -u and bare pull -u (issue3222) Currently, this won't update when a #branch spec is in the URL
author Matt Mackall <mpm@selenic.com>
date Sun, 29 Jan 2012 14:07:45 -0600
parents ed9f40bc346f
children 7460f3a1fd6c
files mercurial/commands.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Jan 29 13:36:10 2012 -0600
+++ b/mercurial/commands.py	Sun Jan 29 14:07:45 2012 -0600
@@ -4260,11 +4260,16 @@
     if modheads == 0:
         return
     if optupdate:
+        movemarkfrom = repo['.'].node()
         try:
-            return hg.update(repo, checkout)
+            ret = hg.update(repo, checkout)
         except util.Abort, inst:
             ui.warn(_("not updating: %s\n" % str(inst)))
             return 0
+        if not ret and not checkout:
+            if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
+                ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent)
+        return ret
     if modheads > 1:
         currentbranchheads = len(repo.branchheads())
         if currentbranchheads == modheads: