Mercurial > evolve
diff hgext/evolve.py @ 554:39eb12bb47c0 stable
commit --amend: adap to core 63e45aee46d4
commit is now able to create obsolete marker itself. We don't alter core if we
detect it's the case.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Tue, 11 Sep 2012 13:51:24 +0200 |
parents | e29561d918a6 |
children | 897f6da2314e |
line wrap: on
line diff
--- a/hgext/evolve.py Tue Sep 11 12:38:49 2012 +0200 +++ b/hgext/evolve.py Tue Sep 11 13:51:24 2012 +0200 @@ -988,27 +988,30 @@ # # The precursor is still strip from the repository. -@eh.wrapfunction(cmdutil, 'amend') -def wrapcmdutilamend(orig, ui, repo, commitfunc, old, *args, **kwargs): - oldnode = old.node() - new = orig(ui, repo, commitfunc, old, *args, **kwargs) - if new != oldnode: - lock = repo.lock() - try: - tr = repo.transaction('post-amend-obst') +# IN CORE 63e45aee46d4 + +if getattr(cmdutil, 'obsolete', None) is None: + @eh.wrapfunction(cmdutil, 'amend') + def wrapcmdutilamend(orig, ui, repo, commitfunc, old, *args, **kwargs): + oldnode = old.node() + new = orig(ui, repo, commitfunc, old, *args, **kwargs) + if new != oldnode: + lock = repo.lock() try: - meta = { - 'date': '%i %i' % util.makedate(), - 'user': ui.username(), - } - repo.obsstore.create(tr, oldnode, [new], 0, meta) - tr.close() - clearobscaches(repo) + tr = repo.transaction('post-amend-obst') + try: + meta = { + 'date': '%i %i' % util.makedate(), + 'user': ui.username(), + } + repo.obsstore.create(tr, oldnode, [new], 0, meta) + tr.close() + clearobscaches(repo) + finally: + tr.release() finally: - tr.release() - finally: - lock.release() - return new + lock.release() + return new ### rebase #