# HG changeset patch # User Pierre-Yves David # Date 2014-08-05 20:49:38 # Node ID 97f86ce79abefb0b01fde910f7b21223c56ab9ac # Parent 122fa73657c66a7e3d6f9c3940d0606a7b82c385 changegroup: add a `targetphase` argument to `addchangegroup` This argument controls the phase used for the added changesets. This can be useful to unbundle in "secret" phase as required by shelve. This change aims at helping high-level code get rid of manual phase movement. An important milestone for having phases part of the transaction. diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -569,7 +569,8 @@ def addchangegroupfiles(repo, source, re return revisions, files -def addchangegroup(repo, source, srctype, url, emptyok=False): +def addchangegroup(repo, source, srctype, url, emptyok=False, + targetphase=phases.draft): """Add the changegroup returned by source.read() to this repo. srctype is a string like 'push', 'pull', or 'unbundle'. url is the URL of the repo where this changegroup is coming from. @@ -701,13 +702,16 @@ def addchangegroup(repo, source, srctype if publishing: phases.advanceboundary(repo, phases.public, srccontent) else: + # Those changesets have been pushed from the outside, their + # phases are going to be pushed alongside. Therefor + # `targetphase` is ignored. phases.advanceboundary(repo, phases.draft, srccontent) phases.retractboundary(repo, phases.draft, added) elif srctype != 'strip': # publishing only alter behavior during push # # strip should not touch boundary at all - phases.retractboundary(repo, phases.draft, added) + phases.retractboundary(repo, targetphase, added) # make changelog see real files again cl.finalize(trp)