Mercurial > hg > evolve
changeset 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 | 3704751fa27f |
files | hgext/evolve.py tests/test-obsolete.t |
diffstat | 2 files changed, 30 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -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 #
--- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -574,10 +574,9 @@ $ mkcommit f created new head $ echo 42 >> f - $ hg commit --amend --traceback - saved backup bundle to $TESTTMP/local/.hg/strip-backup/0b1b6dd009c0-amend-backup.hg + $ hg commit --amend --traceback --quiet $ hg glog - @ changeset: 13:3734a65252e6 + @ changeset: 1[35]:3734a65252e6 (re) | tag: tip | parent: 10:2033b4e49474 | user: test @@ -617,7 +616,7 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: add a - $ hg debugobsolete + $ hg debugobsolete | grep -v 33d458d86621f3186c40bfccd77652f4a122743e 4538525df7e2b9f09423636c61ef63a4cb872a2d 0d3f46688ccc6e756c7e96cf64c391c411309597 0 {'date': '', 'user': 'test'} (glob) 0d3f46688ccc6e756c7e96cf64c391c411309597 725c380fe99b5e76613493f0903e8d11ddc70d54 0 {'date': '', 'user': 'test'} (glob) a7a6f2b5d8a54b81bc7aa2fba2934ad6d700a79e 95de7fc6918dea4c9c8d5382f50649794b474c4a 0 {'date': '', 'user': 'test'} (glob) @@ -629,6 +628,8 @@ 159dfc9fa5d334d7e03a0aecfc7f7ab4c3431fea 9468a5f5d8b2c5d91e17474e95ae4791e9718fdf 0 {'date': '* *', 'user': 'test'} (glob) 9468a5f5d8b2c5d91e17474e95ae4791e9718fdf 6db5e282cb91df5c43ff1f1287c119ff83230d42 0 {'date': '', 'user': 'test'} (glob) 0b1b6dd009c037985363e2290a0b579819f659db 3734a65252e69ddcced85901647a4f335d40de1e 0 {'date': '* *', 'user': 'test'} (glob) +#no produced by 2.3 +33d458d86621f3186c40bfccd77652f4a122743e 3734a65252e69ddcced85901647a4f335d40de1e 0 {'date': '* *', 'user': 'test'} (glob) Check conflict detection @@ -636,15 +637,15 @@ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved $ mkcommit "obsolet_conflicting_d" $ hg summary - parent: 14:50f11e5e3a63 tip + parent: 1[46]:50f11e5e3a63 tip (re) add obsolet_conflicting_d branch: default commit: (clean) - update: 9 new changesets, 9 branch heads (merge) + update: (9|11) new changesets, (9|10) branch heads \(merge\) (re) latecomer: 1 changesets $ hg debugobsolete `getid a7a6f2b5d8a5` `getid 50f11e5e3a63` $ hg log -r 'conflicting()' - changeset: 14:50f11e5e3a63 + changeset: 1[46]:50f11e5e3a63 (re) tag: tip parent: 11:9468a5f5d8b2 user: test