changeset 13356:d96db730fcb2

bookmarks: merge rollback support into localrepo
author Matt Mackall <mpm@selenic.com>
date Thu, 10 Feb 2011 13:46:27 -0600
parents cce2e7b77e36
children b67867940bd1
files hgext/bookmarks.py mercurial/localrepo.py tests/test-bookmarks-strip.t
diffstat 3 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bookmarks.py	Thu Feb 10 13:46:27 2011 -0600
+++ b/hgext/bookmarks.py	Thu Feb 10 13:46:27 2011 -0600
@@ -164,15 +164,6 @@
         return
 
     class bookmark_repo(repo.__class__):
-        def rollback(self, dryrun=False):
-            if os.path.exists(self.join('undo.bookmarks')):
-                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:
                 key = self._bookmarks[key]
--- a/mercurial/localrepo.py	Thu Feb 10 13:46:27 2011 -0600
+++ b/mercurial/localrepo.py	Thu Feb 10 13:46:27 2011 -0600
@@ -716,6 +716,9 @@
                 transaction.rollback(self.sopener, self.sjoin("undo"),
                                      self.ui.warn)
                 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
+                if os.path.exists(self.join('undo.bookmarks')):
+                    util.rename(self.join('undo.bookmarks'),
+                                self.join('bookmarks'))
                 try:
                     branch = self.opener("undo.branch").read()
                     self.dirstate.setbranch(branch)
--- a/tests/test-bookmarks-strip.t	Thu Feb 10 13:46:27 2011 -0600
+++ b/tests/test-bookmarks-strip.t	Thu Feb 10 13:46:27 2011 -0600
@@ -93,6 +93,8 @@
 rollback dry run with rollback information
 
   $ hg rollback -n
+  no rollback information available
+  [1]
   $ hg bookmarks
    * markb                     0:07f494440405