--- a/hgext/obsolete.py Fri Apr 20 17:12:38 2012 +0200
+++ b/hgext/obsolete.py Mon Apr 23 14:54:06 2012 +0200
@@ -369,8 +369,7 @@
# /!\ api change in Hg 2.2 (97efd26eb9576f39590812ea9) /!\
if util.safehasattr(repo, '_journalfiles'): # Hg 2.2
o_journalfiles = repo._journalfiles
- else: # XXX remove this bloc while breaking support to Hg 2.1
- o_writejournal = repo._writejournal
+ o_writejournal = repo._writejournal
class obsoletingrepo(repo.__class__):
@@ -543,9 +542,20 @@
# /!\ api change in Hg 2.2 (97efd26eb9576f39590812ea9) /!\
if util.safehasattr(repo, '_journalfiles'): # Hg 2.2
def _journalfiles(self):
- return o_journalfiles() + ('journal.obsolete-relations',)
+ return o_journalfiles() + (self.join('journal.obsolete-relations'),)
+
+ def _writejournal(self, desc):
+ """wrapped version of _writejournal that save obsolete data"""
+ o_writejournal(desc)
+ filename = 'obsolete-relations'
+ filepath = self.join(filename)
+ if os.path.exists(filepath):
+ journalname = 'journal.' + filename
+ journalpath = self.join(journalname)
+ util.copyfile(filepath, journalpath)
+
else: # XXX remove this bloc while breaking support to Hg 2.1
- def _writejournal(self, desc):
+ def _writejournal(self, desc):
"""wrapped version of _writejournal that save obsolete data"""
entries = list(o_writejournal(desc))
filename = 'obsolete-relations'
@@ -557,15 +567,16 @@
entries.append(journalpath)
return tuple(entries)
- def _rollback(self, dryrun=False, **kwargs):
+ def _rollback(self, dryrun, force):
"""wrapped version of _rollback that restore obsolete data"""
- ret = o_rollback(dryrun, **kwargs)
+ ret = o_rollback(dryrun, force)
if not (ret or dryrun): #rollback did not failed
src = self.join('undo.obsolete-relations')
dst = self.join('obsolete-relations')
if os.path.exists(src):
util.rename(src, dst)
- elif os.path.exists(dst): #unlink in any case
+ 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('_obssubrels', None)