diff hgext/bookmarks.py @ 13307:7f2b8aac7bdc stable

bookmarks: respect rollbacks dryrun parameter
author David Soria Parra <dsp@php.net>
date Thu, 27 Jan 2011 02:58:48 +0100
parents 146bad852ede
children 0c493e5ce8e9
line wrap: on
line diff
--- a/hgext/bookmarks.py	Thu Jan 27 02:55:11 2011 +0100
+++ b/hgext/bookmarks.py	Thu Jan 27 02:58:48 2011 +0100
@@ -261,10 +261,14 @@
                 file.close()
             return mark
 
-        def rollback(self, *args):
+        def rollback(self, dryrun=False):
             if os.path.exists(self.join('undo.bookmarks')):
-                util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
-            return super(bookmark_repo, self).rollback(*args)
+                if not dryrun:
+                    util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
+                elif not os.path.exists(self.sjoin("undo")):
+                    # avoid "no rollback information available" message
+                    return 0
+            return super(bookmark_repo, self).rollback(dryrun)
 
         def lookup(self, key):
             if key in self._bookmarks: