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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jan 17 17:37:47 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1326770025 -3600
# Node ID 6307522246542311b755afc7a354fd68ed153ede
# Parent  b36e5906864cb053a60a8a82e6c6e18efc1cf483
mq 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
@@ -2098,15 +2098,12 @@
     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:
@@ -2115,7 +2112,6 @@
     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'))
 
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
@@ -43,7 +43,7 @@
   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
@@ -82,7 +82,7 @@
   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
@@ -121,7 +121,7 @@
   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
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -1213,6 +1213,11 @@
 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


More information about the Mercurial-devel mailing list