[PATCH 6 of 8 phases] mq qclone: Let secret phase handle the exclusion of mq changeset

Matt Mackall mpm at selenic.com
Tue Jan 17 16:53:37 CST 2012


On Tue, 2012-01-17 at 18:35 +0100, pierre-yves.david at logilab.fr wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1326770025 -3600
> # Node ID 1b22ef5905a472f8264839b3eb70091666e61205
> # Parent  f94ce6d6181b16c432def3d5a7eba1c604eda9ec
> mq qclone: Let secret phase handle the exclusion of mq changeset

Bad shift key, bad! Just 'qclone' here, please.

> mq changeset are now handled by the core concept of secret phase. We keep the
> strip based logic for remote server not supporting phase.
> 
> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -2121,28 +2121,24 @@ def clone(ui, source, dest=None, **opts)
>      try:
>          hg.repository(ui, patchespath)
>      except error.RepoError:
>          raise util.Abort(_('versioned patch repository not found'
>                             ' (see init --mq)'))
> -    qbase, destrev = None, None
> -    if sr.local():
> -        if sr.mq.applied:
> -            qbase = sr.mq.applied[0].node
> -            if not hg.islocal(dest):
> -                heads = set(sr.heads())
> -                destrev = list(heads.difference(sr.heads(qbase)))
> -                destrev.append(sr.changelog.parents(qbase)[0])
> -    elif sr.capable('lookup'):
> +
> +    # try to compute qbase from remote to be able to strip mq changeset
> +    # afterward. This is not necessary for local repo has mq changeset are now
> +    # in the secret phase.
> +    qbase = None
> +    if 'phases' not in sr.listkeys('namespaces') and sr.capable('lookup'):
>          try:
>              qbase = sr.lookup('qbase')
>          except error.RepoError:
>              pass
>  
>      ui.note(_('cloning main repository\n'))
>      sr, dr = hg.clone(ui, opts, sr.url(), dest,
>                        pull=opts.get('pull'),
> -                      rev=destrev,
>                        update=False,
>                        stream=opts.get('uncompressed'))
>  
>      ui.note(_('cloning patch repository\n'))
>      hg.clone(ui, opts, opts.get('patches') or patchdir(sr), patchdir(dr),
> diff --git a/tests/test-mq-qclone-http.t b/tests/test-mq-qclone-http.t
> --- a/tests/test-mq-qclone-http.t
> +++ b/tests/test-mq-qclone-http.t
> @@ -41,11 +41,11 @@ test with recursive collection
>    $ hg qclone http://localhost:$HGPORT/a b
>    requesting all changes
>    adding changesets
>    adding manifests
>    adding file changes
> -  added 2 changesets with 2 changes to 2 files
> +  added 1 changesets with 1 changes to 1 files
>    requesting all changes
>    adding changesets
>    adding manifests
>    adding file changes
>    added 1 changesets with 3 changes to 3 files
> @@ -80,11 +80,11 @@ test with normal collection
>    $ hg qclone http://localhost:$HGPORT1/a c
>    requesting all changes
>    adding changesets
>    adding manifests
>    adding file changes
> -  added 2 changesets with 2 changes to 2 files
> +  added 1 changesets with 1 changes to 1 files
>    requesting all changes
>    adding changesets
>    adding manifests
>    adding file changes
>    added 1 changesets with 3 changes to 3 files
> @@ -119,11 +119,11 @@ test with old-style collection
>    $ hg qclone http://localhost:$HGPORT2/a d
>    requesting all changes
>    adding changesets
>    adding manifests
>    adding file changes
> -  added 2 changesets with 2 changes to 2 files
> +  added 1 changesets with 1 changes to 1 files
>    requesting all changes
>    adding changesets
>    adding manifests
>    adding file changes
>    added 1 changesets with 3 changes to 3 files
> diff --git a/tests/test-mq.t b/tests/test-mq.t
> --- a/tests/test-mq.t
> +++ b/tests/test-mq.t
> @@ -1211,10 +1211,15 @@ repo with unversioned patch dir
>  
> 
>  repo with patches applied
>  
>    $ hg qclone qclonesource qclonedest
> +  requesting all changes
> +  adding changesets
> +  adding manifests
> +  adding file changes
> +  added 1 changesets with 1 changes to 1 files
>    updating to branch default
>    3 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    $ cd qclonedest
>    $ qlog


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list