Mercurial > evolve
changeset 202:83b7e2c62ac3
[obsolete] simplify by using the Hg 2.1 api
author | Alain Leufroy <alain.leufroy@logilab.fr> |
---|---|
date | Mon, 16 Apr 2012 10:03:16 +0200 |
parents | 94360b577857 |
children | 9799d0aa53c8 |
files | hgext/obsolete.py |
diffstat | 1 files changed, 15 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/obsolete.py Tue Apr 03 17:47:15 2012 +0200 +++ b/hgext/obsolete.py Mon Apr 16 10:03:16 2012 +0200 @@ -363,7 +363,7 @@ opull = repo.pull opush = repo.push - orollback = repo.rollback + o_rollback = repo._rollback o_writejournal = repo._writejournal ocancopy = repo.cancopy @@ -544,26 +544,20 @@ entries.append(journalpath) return tuple(entries) - def rollback(self, dryrun=False, **kwargs): - """wrapped version of rollback that restore obsolete data""" - wlock = lock = None - try: - wlock = self.wlock() - lock = self.lock() - ret = orollback(dryrun, **kwargs) - 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 - os.unlink(dst) - # invalidate cache - self.__dict__.pop('_obssubrels', None) - self.__dict__.pop('_obsobjrels', None) - return ret - finally: - release(lock, wlock) + def _rollback(self, dryrun=False, **kwargs): + """wrapped version of _rollback that restore obsolete data""" + ret = o_rollback(dryrun, **kwargs) + 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 + os.unlink(dst) + # invalidate cache + self.__dict__.pop('_obssubrels', None) + self.__dict__.pop('_obsobjrels', None) + return ret @storecache('00changelog.i') def changelog(self):