[PATCH 08 of 10] localrepo: add destroyed() method for strip/rollback to use (issue548)

Greg Ward greg-hg at gerg.ca
Thu Jul 16 09:42:54 CDT 2009


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1247755181 14400
# Node ID 878a5abb739d62d2a6f419bf89d1be9e144f9968
# Parent  b611553591f5fc9a1a46e6ff4e4fac3b53939e41
localrepo: add destroyed() method for strip/rollback to use (issue548).

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -612,6 +612,7 @@
                                  % encoding.tolocal(self.dirstate.branch()))
                 self.invalidate()
                 self.dirstate.invalidate()
+                self.destroyed()
             else:
                 self.ui.warn(_("no rollback information available\n"))
         finally:
@@ -910,6 +911,16 @@
             del tr
             lock.release()
 
+    def destroyed(self):
+        '''Inform the repository that nodes have been destroyed.
+        Intended for use by strip and rollback, so there's a common
+        place for anything that has to be done after destroying history.'''
+        # Do nothing for now: this is a placeholder that will be used
+        # when we add tag caching.
+        # XXX it might be nice if we could take the list of destroyed
+        # nodes, but I don't see an easy way for rollback() to do that
+        pass
+
     def walk(self, match, node=None):
         '''
         walk recursively through the directory tree or a given
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -142,3 +142,4 @@
         if backup != "strip":
             os.unlink(chgrpfile)
 
+    repo.destroyed()


More information about the Mercurial-devel mailing list