bookmarks: merge rollback support into localrepo
authorMatt Mackall <mpm@selenic.com>
Thu, 10 Feb 2011 13:46:27 -0600
changeset 13356 d96db730fcb2
parent 13355 cce2e7b77e36
child 13357 b67867940bd1
bookmarks: merge rollback support into localrepo
hgext/bookmarks.py
mercurial/localrepo.py
tests/test-bookmarks-strip.t
--- 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