Mercurial > evolve
changeset 113:3bdabdbb4140
adapt evolution to phase in core.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Mon, 19 Dec 2011 14:37:24 +0100 |
parents | eae9be0ee00e |
children | 1a64195e2b09 |
files | hgext/evolution.py tests/test-evolution.t |
diffstat | 2 files changed, 32 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolution.py Mon Dec 19 14:05:25 2011 +0100 +++ b/hgext/evolution.py Mon Dec 19 14:37:24 2011 +0100 @@ -16,6 +16,7 @@ from mercurial import extensions from mercurial import commands from mercurial import bookmarks +from mercurial import phases from mercurial import context from mercurial import util from mercurial.i18n import _ @@ -124,13 +125,13 @@ rebase = extensions.find('rebase') # dummy state to trick rebase node assert repo[rev].p2().rev() == node.nullrev, 'no support yet' - rebase.updatedirstate(repo, rev, repo[dest].node(), + cmdutil.duplicatecopies(repo, rev, repo[dest].node(), repo[rev].p2().node()) rebase.rebasenode(repo, rev, dest, {node.nullrev: node.nullrev}) nodenew = rebase.concludenode(repo, rev, dest, node.nullid) nodesrc = repo.changelog.node(rev) repo.addobsolete(nodenew, nodesrc) - repo.setstate(repo.nodestate(nodesrc), [nodenew]) + phases.retractboundary(repo, repo[nodesrc].phase(), [nodenew]) oldbookmarks = repo.nodebookmarks(nodesrc) for book in oldbookmarks: repo._bookmarks[book] = nodenew @@ -262,7 +263,7 @@ wlock = repo.wlock() try: - if not old.state().mutable: + if not old.phase(): raise util.Abort(_("can not rewrite immutable changeset %s") % old) # commit current changes as update @@ -294,7 +295,7 @@ [old.p1().node(), old.p2().node()], opts) # reroute the working copy parent to the new changeset - repo.setstate(repo.nodestate(old.node()), [newid]) + phases.retractboundary(repo, old.phase(), [newid]) repo.dirstate.setparents(newid, node.nullid) finally:
--- a/tests/test-evolution.t Mon Dec 19 14:05:25 2011 +0100 +++ b/tests/test-evolution.t Mon Dec 19 14:37:24 2011 +0100 @@ -1,16 +1,20 @@ $ cat >> $HGRCPATH <<EOF + > [defaults] + > amend=-d "0 0" > [web] > push_ssl = false > allow_push = * + > [phases] + > publish = False > [alias] - > qlog = log --template='{rev} - {node|short} {desc} ({state})\n' + > qlog = log --template='{rev} - {node|short} {desc} ({phase})\n' > [diff] > git = 1 > unified = 0 > [extensions] > hgext.rebase= + > hgext.graphlog= > EOF - $ echo "states=$(echo $(dirname $TESTDIR))/hgext/states.py" >> $HGRCPATH $ echo "obsolete=$(echo $(dirname $TESTDIR))/hgext/obsolete.py" >> $HGRCPATH $ echo "evolution=$(echo $(dirname $TESTDIR))/hgext/evolution.py" >> $HGRCPATH $ mkcommit() { @@ -23,9 +27,14 @@ $ hg init local $ cd local - $ hg states ready # XXX should be put in default config when state support it $ mkcommit a $ mkcommit b + $ cat >> .hg/hgrc << EOF + > [phases] + > publish = True + > EOF + $ hg pull -q . # make 1 public + $ rm .hg/hgrc $ mkcommit c $ mkcommit d $ hg up 1 @@ -33,14 +42,13 @@ $ mkcommit e -q created new head $ mkcommit f - $ hg published 1 $ hg qlog - 5 - e44648563c73 add f (ready) - 4 - fbb94e3a0ecf add e (ready) - 3 - 47d2a3944de8 add d (ready) - 2 - 4538525df7e2 add c (ready) - 1 - 7c3bad9141dc add b (published) - 0 - 1f0dee641bb7 add a (published) + 5 - e44648563c73 add f (1) + 4 - fbb94e3a0ecf add e (1) + 3 - 47d2a3944de8 add d (1) + 2 - 4538525df7e2 add c (1) + 1 - 7c3bad9141dc add b (0) + 0 - 1f0dee641bb7 add a (0) test simple kill @@ -48,11 +56,11 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved working directory now at fbb94e3a0ecf $ hg qlog - 4 - fbb94e3a0ecf add e (ready) - 3 - 47d2a3944de8 add d (ready) - 2 - 4538525df7e2 add c (ready) - 1 - 7c3bad9141dc add b (published) - 0 - 1f0dee641bb7 add a (published) + 4 - fbb94e3a0ecf add e (1) + 3 - 47d2a3944de8 add d (1) + 2 - 4538525df7e2 add c (1) + 1 - 7c3bad9141dc add b (0) + 0 - 1f0dee641bb7 add a (0) test multiple kill @@ -60,9 +68,9 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved working directory now at 7c3bad9141dc $ hg qlog - 2 - 4538525df7e2 add c (ready) - 1 - 7c3bad9141dc add b (published) - 0 - 1f0dee641bb7 add a (published) + 2 - 4538525df7e2 add c (1) + 1 - 7c3bad9141dc add b (0) + 0 - 1f0dee641bb7 add a (0) $ cd .. ########################## @@ -83,7 +91,6 @@ We start with a plain base repo:: $ hg init main; cd main - $ hg states ready $ cat >main-file-1 <<-EOF > One > @@ -104,7 +111,6 @@ updating to branch default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd work - $ hg states ready Create First Patch @@ -202,7 +208,7 @@ 1 : a nifty feature - test 0 : base - test $ hg evolve - hg relocate --rev 8c7704f377af 1075109f9999 + hg relocate --rev f8111a076f09 23409eba69a0 $ hg up feature-B -q #prevent feature-A bookmark to move grml $ hg relocate -r 4 6 --traceback merging main-file-1