[PATCH 3 of 6] bookmarks: write() can simply access repo._bookmarks

Nicolas Dumazet nicdumz at gmail.com
Mon Dec 21 00:24:58 CST 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1261376583 -32400
# Node ID 449f9a2356777e12a06b07dcdc2536215c687d02
# Parent  cacf8011e7a496f199a8a7d6c8a44c91693b306b
bookmarks: write() can simply access repo._bookmarks

diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
--- a/hgext/bookmarks.py
+++ b/hgext/bookmarks.py
@@ -49,7 +49,7 @@
         pass
     return bookmarks
 
-def write(repo, refs):
+def write(repo):
     '''Write bookmarks
 
     Write the given bookmark => hash dictionary to the .hg/bookmarks file
@@ -58,6 +58,7 @@
     We also store a backup of the previous state in undo.bookmarks that
     can be copied back on rollback.
     '''
+    refs = repo._bookmarks
     if os.path.exists(repo.join('bookmarks')):
         util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks'))
     if current(repo) not in refs:
@@ -145,7 +146,7 @@
         del marks[rename]
         if current(repo) == rename:
             setcurrent(repo, mark)
-        write(repo, marks)
+        write(repo)
         return
 
     if delete:
@@ -156,7 +157,7 @@
         if mark == current(repo):
             setcurrent(repo, None)
         del marks[mark]
-        write(repo, marks)
+        write(repo)
         return
 
     if mark != None:
@@ -174,7 +175,7 @@
         else:
             marks[mark] = repo.changectx('.').node()
             setcurrent(repo, mark)
-        write(repo, marks)
+        write(repo)
         return
 
     if mark is None:
@@ -224,7 +225,7 @@
     if len(update) > 0:
         for m in update:
             marks[m] = repo.changectx('.').node()
-        write(repo, marks)
+        write(repo)
 
 def reposetup(ui, repo):
     if not repo.local():
@@ -272,7 +273,7 @@
                             marks[mark] = node
                             update = True
                 if update:
-                    write(self, marks)
+                    write(self)
                 return node
             finally:
                 wlock.release()
@@ -299,7 +300,7 @@
                         marks[mark] = node
                         update = True
             if update:
-                write(self, marks)
+                write(self)
             return result
 
         def _findtags(self):


More information about the Mercurial-devel mailing list