[PATCH 3 of 4] commands.bookmarks: move cur initialization to inside names block

Siddharth Agarwal sid0 at fb.com
Tue Nov 19 14:45:44 CST 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1384893737 28800
#      Tue Nov 19 12:42:17 2013 -0800
# Node ID 5efde1fac081f2271fc2d97189506aa61cd908be
# Parent  d018c7466c66d710dccc2ede1b10e79b02de01c1
commands.bookmarks: move cur initialization to inside names block

Not only is cur not used outside this block, this is also more correct because
we now fetch the current node while the wlock is held.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -808,7 +808,6 @@
     inactive = opts.get('inactive')
 
     hexfn = ui.debugflag and hex or short
-    cur   = repo.changectx('.').node()
 
     def checkformat(mark):
         mark = mark.strip()
@@ -889,6 +888,7 @@
                 marks.write()
 
             elif names:
+                cur = repo.changectx('.').node()
                 newact = None
                 for mark in names:
                     mark = checkformat(mark)


More information about the Mercurial-devel mailing list