bookmarks: move current bookmark on update -u and bare pull -u (issue3222) stable
authorMatt Mackall <mpm@selenic.com>
Sun, 29 Jan 2012 14:07:45 -0600
branchstable
changeset 16019 eb85d5f89fef
parent 16018 ed9f40bc346f
child 16020 7460f3a1fd6c
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
mercurial/commands.py
--- 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: