[PATCH 6 of 9 phases] qclone: let secret phase handle the exclusion of mq changeset

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Wed Jan 18 10:33:12 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1326903116 -3600
# Node ID 1837dacab5cc0c681a646519b95d61110a7ac515
# Parent  24aa39e56e3a87af22c3dc12ae87a916849d96d0
qclone: let secret phase handle the exclusion of mq changeset

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
@@ -2096,28 +2096,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


More information about the Mercurial-devel mailing list