changeset 10106:cb3f6da91646

bookmarks: write() can simply access repo._bookmarks
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 21 Dec 2009 15:23:03 +0900
parents dc5b5cc5ca34
children c03f467423f3
files hgext/bookmarks.py
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bookmarks.py	Mon Dec 21 13:55:56 2009 +0900
+++ b/hgext/bookmarks.py	Mon Dec 21 15:23:03 2009 +0900
@@ -51,7 +51,7 @@
         pass
     return bookmarks
 
-def write(repo, refs):
+def write(repo):
     '''Write bookmarks
 
     Write the given bookmark => hash dictionary to the .hg/bookmarks file
@@ -60,6 +60,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:
@@ -147,7 +148,7 @@
         del marks[rename]
         if current(repo) == rename:
             setcurrent(repo, mark)
-        write(repo, marks)
+        write(repo)
         return
 
     if delete:
@@ -158,7 +159,7 @@
         if mark == current(repo):
             setcurrent(repo, None)
         del marks[mark]
-        write(repo, marks)
+        write(repo)
         return
 
     if mark != None:
@@ -176,7 +177,7 @@
         else:
             marks[mark] = repo.changectx('.').node()
             setcurrent(repo, mark)
-        write(repo, marks)
+        write(repo)
         return
 
     if mark is None:
@@ -226,7 +227,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():
@@ -276,7 +277,7 @@
                             marks[mark] = node
                             update = True
                 if update:
-                    write(self, marks)
+                    write(self)
                 return node
             finally:
                 wlock.release()
@@ -303,7 +304,7 @@
                         marks[mark] = node
                         update = True
             if update:
-                write(self, marks)
+                write(self)
             return result
 
         def _findtags(self):