obsolete: rely on core for rollback support
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 25 Jul 2012 19:28:46 +0200
changeset 387 0e87a890d84b
parent 386 a3797de26544
child 388 97b75bbfacc5
obsolete: rely on core for rollback support
hgext/obsolete.py
--- a/hgext/obsolete.py	Wed Jul 25 19:26:01 2012 +0200
+++ b/hgext/obsolete.py	Wed Jul 25 19:28:46 2012 +0200
@@ -674,7 +674,6 @@
     if not util.safehasattr(repo.opener, 'tryread'):
         raise util.Abort('Obsolete extension require Mercurial 2.2 (or later)')
     opush = repo.push
-    o_rollback = repo._rollback
     o_updatebranchcache = repo.updatebranchcache
 
     # /!\ api change in  Hg 2.2 (97efd26eb9576f39590812ea9) /!\
@@ -825,38 +824,6 @@
             return result
 
 
-        ### rollback support
-
-        # /!\ api change in  Hg 2.2 (97efd26eb9576f39590812ea9) /!\
-        def _journalfiles(self):
-            return o_journalfiles() + (self.sjoin('journal.obsstore'),) 
-
-        def _writejournal(self, desc):
-            """wrapped version of _writejournal that save obsolete data"""
-            o_writejournal(desc)
-            filename = 'obsstore'
-            filepath = self.sjoin(filename)
-            if os.path.exists(filepath):
-                journalname = 'journal.' + filename
-                journalpath = self.sjoin(journalname)
-                util.copyfile(filepath, journalpath)
-
-
-        def _rollback(self, dryrun, force):
-            """wrapped version of _rollback that restore obsolete data"""
-            ret = o_rollback(dryrun, force)
-            if not (ret or dryrun): #rollback did not failed
-                src = self.sjoin('undo.obsstore')
-                dst = self.sjoin('obsstore')
-                if os.path.exists(src):
-                    util.rename(src, dst)
-                elif os.path.exists(dst):
-                    # If no state was saved because the file did not existed before.
-                    os.unlink(dst)
-                # invalidate cache
-                self.__dict__.pop('obsstore', None)
-            return ret
-
     repo.__class__ = obsoletingrepo
     for arg in sys.argv:
         if 'debugc' in arg: