# HG changeset patch # User Pierre-Yves David # Date 1315868298 -7200 # Node ID 7c8f992d567ed8b2f69da670d7dca4a47b929f77 # Parent 6a7dc5ca05b8717d08c0d85ac093a8084dc84b20 [states] fix a bug with rebase --detach There is unexpected (for me) content in state. diff -r 6a7dc5ca05b8 -r 7c8f992d567e hgext/states.py --- a/hgext/states.py Tue Sep 13 00:45:42 2011 +0200 +++ b/hgext/states.py Tue Sep 13 00:58:18 2011 +0200 @@ -648,8 +648,10 @@ def wraprebasebuildstate(orig, repo, *args, **kwargs): result = orig(repo, *args, **kwargs) if result is not None: - revs = result[2] - base = repo.changelog.node(min(result[2])) + # rebase.nullmerge is issued in the detach case + rebase = extensions.find('rebase') + rebased = [rev for rev, rbst in result[2].items() if rbst != rebase.nullmerge] + base = repo.changelog.node(min(rebased)) state = repo.nodestate(base) if not state.properties & _MUTABLE: raise util.Abort(_('can not rebase published changeset %s') diff -r 6a7dc5ca05b8 -r 7c8f992d567e tests/test-published.t --- a/tests/test-published.t Tue Sep 13 00:45:42 2011 +0200 +++ b/tests/test-published.t Tue Sep 13 00:58:18 2011 +0200 @@ -19,9 +19,6 @@ $ hg ci -m "add babar" $ echo "la veille dame" > babar $ hg ci -m "add dame" - $ hg log --template='{rev}:{node|short}: {state}\n' - 1:710fe444b3b0: published - 0:5caa672bac26: published $ hg up 0 -q $ echo "Rataxes" > rhino $ hg add rhino @@ -30,8 +27,14 @@ $ hg published 1 2 $ hg up 1 -q $ hg states draft - $ echo "flore" > babar - $ hg ci -m "add daughter" + $ echo "avion" > vehicule + $ hg add vehicule + $ hg ci -m "add some plane" + $ hg log --template='{rev}:{node|short}: {state}\n' + 3:4ee052f12c59: draft + 2:5468aa9f5c63: published + 1:710fe444b3b0: published + 0:5caa672bac26: published test you can't qimport published changeset @@ -54,6 +57,8 @@ test you still can rebase other one - $ hg rebase --dest 2 -s 3 - saved backup bundle to $TESTTMP/local/.hg/strip-backup/b7f6698b7ad7-backup.hg + $ hg rebase --dest 2 -s 3 --detach + saved backup bundle to $TESTTMP/local/.hg/strip-backup/4ee052f12c59-backup.hg + $ hg rebase --dest 1 -s 3 + saved backup bundle to $TESTTMP/local/.hg/strip-backup/f708bc50a098-backup.hg