[PATCH 4 of 4] outgoing: handle phases the same as pull

Augie Fackler raf at durin42.com
Mon Dec 22 15:38:31 CST 2014


On Fri, Dec 19, 2014 at 01:40:12PM -0800, Eric Sumner wrote:
> # HG changeset patch
> # User Eric Sumner <ericsumner at fb.com>
> # Date 1418934797 28800
> #      Thu Dec 18 12:33:17 2014 -0800
> # Node ID 3c85e87a2cd8c120dccc03d69d2b35204e5689e4
> # Parent  449efb8e20984980511cc2c5d277e519a44ce4d9
> outgoing: handle phases the same as pull

This looks like an improvement. Will fix log message in flight. Queued.

>
> Now that bundlerepo can move phases safely, 'hg outgoing' 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list