# HG changeset patch # User Eric Sumner # Date 1418934797 28800 # Node ID 96c3cbec006f775541cf0aa5ee6c72ada92855ae # Parent e7fcf58acd7145e97783bcef5af0c7b0abc35d07 incoming: handle phases the same as pull Now that bundlerepo can move phases safely, 'hg incoming' can share its phase handling code with pull to better reflect what would actually show up. diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -350,6 +350,16 @@ repopath, bundlename = parentpath, path return bundlerepository(ui, repopath, bundlename) +class bundletransactionmanager(object): + def transaction(self): + return None + + def close(self): + raise NotImplementedError + + def release(self): + raise NotImplementedError + def getremotechanges(ui, repo, other, onlyheads=None, bundlename=None, force=False): '''obtains a bundle of changes incoming from other @@ -418,6 +428,14 @@ csets = localrepo.changelog.findmissing(common, rheads) + if bundlerepo: + reponodes = [ctx.node() for ctx in bundlerepo[bundlerepo.firstnewrev:]] + remotephases = other.listkeys('phases') + + pullop = exchange.pulloperation(bundlerepo, other, heads=reponodes) + pullop.trmanager = bundletransactionmanager() + exchange._pullapplyphases(pullop, remotephases) + def cleanup(): if bundlerepo: bundlerepo.close() diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t --- a/tests/test-setdiscovery.t +++ b/tests/test-setdiscovery.t @@ -354,6 +354,7 @@ "GET /?cmd=capabilities HTTP/1.1" 200 - "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477 + "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases $ cat errors.log $ cd .. diff --git a/tests/test-treediscovery.t b/tests/test-treediscovery.t --- a/tests/test-treediscovery.t +++ b/tests/test-treediscovery.t @@ -509,6 +509,7 @@ "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961 + "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases "GET /?cmd=capabilities HTTP/1.1" 200 - "GET /?cmd=heads HTTP/1.1" 200 - "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961