changeset 1174:5717d023da63

obsexc: use the common discovery We drop the hand made discovery and rely on the general one introduced some time ago.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 27 Aug 2014 17:09:36 +0200
parents cdfc19f25478
children e8f49b32e95b
files hgext/evolve.py tests/test-exchange-A1.t tests/test-exchange-A2.t tests/test-exchange-A3.t tests/test-exchange-A4.t tests/test-exchange-A5.t tests/test-exchange-A6.t tests/test-exchange-A7.t tests/test-exchange-B1.t tests/test-exchange-B2.t tests/test-exchange-B3.t tests/test-exchange-B4.t tests/test-exchange-B5.t tests/test-exchange-B6.t tests/test-exchange-B7.t tests/test-exchange-C1.t tests/test-exchange-C2.t tests/test-exchange-C3.t tests/test-exchange-C4.t tests/test-exchange-D1.t tests/test-exchange-D2.t tests/test-exchange-D3.t tests/test-exchange-D4.t
diffstat 23 files changed, 72 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2232,6 +2232,7 @@
         and pushop.repo.obsstore
         and 'obsolete' in pushop.remote.listkeys('namespaces')):
         repo = pushop.repo
+        obsexcmsg(repo.ui, "computing relevant nodes\n")
         revs = list(repo.revs('::%ln', pushop.futureheads))
         unfi = repo.unfiltered()
         cl = unfi.changelog
@@ -2239,7 +2240,14 @@
             # do not trust core yet
             # return orig(pushop)
             nodes = [cl.node(r) for r in revs]
-            pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
+            if nodes:
+                obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n"
+                                   % len(nodes))
+                pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
+            else:
+                obsexcmsg(repo.ui, "markers already in sync\n")
+                pushop.outobsmarkers = []
+                pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
             return
 
         common = []
@@ -2250,7 +2258,13 @@
 
         revs = list(unfi.revs('%ld - (::%ln)', revs, common))
         nodes = [cl.node(r) for r in revs]
-        pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
+        if nodes:
+            obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n"
+                               % len(nodes))
+            pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
+        else:
+            obsexcmsg(repo.ui, "markers already in sync\n")
+            pushop.outobsmarkers = []
 
 @eh.wrapfunction(wireproto, 'capabilities')
 def discocapabilities(orig, repo, proto):
@@ -2449,7 +2463,7 @@
     cl = unfi.changelog
     if (obsolete._enabled and repo.obsstore and
         'obsolete' in remote.listkeys('namespaces')):
-        markers = _obsmarkersdiscovery(pushop)
+        markers = pushop.outobsmarkers
         if not markers:
             obsexcmsg(repo.ui, "no marker to push\n")
         elif remote.capable('_evoext_b2x_obsmarkers_0'):
--- a/tests/test-exchange-A1.t
+++ b/tests/test-exchange-A1.t
@@ -68,12 +68,12 @@
   ## pushing "A" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
@@ -118,12 +118,12 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
@@ -227,12 +227,12 @@
   ## pushing "B" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 3 nodes
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 3 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
@@ -274,12 +274,12 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 3 nodes
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 3 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-A2.t
+++ b/tests/test-exchange-A2.t
@@ -76,12 +76,12 @@
   ## pushing "A" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-A3.t
+++ b/tests/test-exchange-A3.t
@@ -88,12 +88,12 @@
   ## pushing "A1" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
@@ -173,6 +173,8 @@
   $ hg push -R main -r e5ea8f9c7314 pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   abort: push creates new remote head e5ea8f9c7314!
   (merge or see "hg help push" for details about pushing new heads)
   [255]
@@ -192,12 +194,12 @@
   ## pushing "A1" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-A4.t
+++ b/tests/test-exchange-A4.t
@@ -81,12 +81,12 @@
   ## pushing "B" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 3 nodes
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 3 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-A5.t
+++ b/tests/test-exchange-A5.t
@@ -88,12 +88,12 @@
   ## pushing "B1" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-A6.t
+++ b/tests/test-exchange-A6.t
@@ -79,9 +79,9 @@
   ## pushing "A1" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
+  no changes found
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
@@ -118,9 +118,9 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   no changes found
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 3 nodes
   OBSEXC: pushing 1 obsolescence markers (65 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-A7.t
+++ b/tests/test-exchange-A7.t
@@ -59,9 +59,9 @@
   ## pushing "O" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: no marker to push
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-B1.t
+++ b/tests/test-exchange-B1.t
@@ -67,12 +67,12 @@
   ## pushing "A" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 1 obsolescence markers (89 bytes)
   OBSEXC: DONE
   ## post push state
@@ -114,12 +114,12 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 1 obsolescence markers (89 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-B2.t
+++ b/tests/test-exchange-B2.t
@@ -62,9 +62,9 @@
   ## pushing "O" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 1 obsolescence markers (89 bytes)
   OBSEXC: DONE
   ## post push state
@@ -101,9 +101,9 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 1 obsolescence markers (89 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-B3.t
+++ b/tests/test-exchange-B3.t
@@ -75,12 +75,12 @@
   ## pushing "A" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: no marker to push
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-B4.t
+++ b/tests/test-exchange-B4.t
@@ -88,9 +88,9 @@
   ## pushing "O" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 1 obsolescence markers (89 bytes)
   OBSEXC: DONE
   ## post push state
@@ -127,9 +127,9 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 3 nodes
+  no changes found
   OBSEXC: pushing 1 obsolescence markers (89 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-B5.t
+++ b/tests/test-exchange-B5.t
@@ -87,12 +87,12 @@
   ## pushing "B" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 3 nodes
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 3 nodes
   OBSEXC: pushing 2 obsolescence markers (153 bytes)
   OBSEXC: DONE
   ## post push state
@@ -142,12 +142,12 @@
   ## pushing "B" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 3 nodes
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 3 nodes
   OBSEXC: pushing 2 obsolescence markers (153 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-B6.t
+++ b/tests/test-exchange-B6.t
@@ -74,9 +74,9 @@
   ## pushing "O" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 2 obsolescence markers (153 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-B7.t
+++ b/tests/test-exchange-B7.t
@@ -66,9 +66,9 @@
   ## pushing "O" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: no marker to push
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-C1.t
+++ b/tests/test-exchange-C1.t
@@ -69,9 +69,9 @@
   ## pushing "O" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 2 obsolescence markers (177 bytes)
   OBSEXC: DONE
   ## post push state
@@ -114,9 +114,9 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 2 obsolescence markers (177 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-C2.t
+++ b/tests/test-exchange-C2.t
@@ -76,12 +76,12 @@
   ## pushing "A1" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 2 obsolescence markers (153 bytes)
   OBSEXC: DONE
   ## post push state
@@ -129,12 +129,12 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 2 obsolescence markers (153 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-C3.t
+++ b/tests/test-exchange-C3.t
@@ -82,9 +82,9 @@
   ## pushing "O" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 3 obsolescence markers (241 bytes)
   OBSEXC: DONE
   ## post push state
@@ -133,9 +133,9 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 3 obsolescence markers (241 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-C4.t
+++ b/tests/test-exchange-C4.t
@@ -89,9 +89,9 @@
   ## pushing "O" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 2 obsolescence markers (153 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-D1.t
+++ b/tests/test-exchange-D1.t
@@ -70,12 +70,12 @@
   ## pushing "A1" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 2 obsolescence markers (153 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-D2.t
+++ b/tests/test-exchange-D2.t
@@ -66,9 +66,9 @@
   ## pushing from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: pushing 2 obsolescence markers (153 bytes)
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-D3.t
+++ b/tests/test-exchange-D3.t
@@ -71,9 +71,9 @@
   ## pushing "O" from main to pushdest
   pushing to pushdest
   searching for changes
-  no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
+  no changes found
   OBSEXC: no marker to push
   OBSEXC: DONE
   ## post push state
--- a/tests/test-exchange-D4.t
+++ b/tests/test-exchange-D4.t
@@ -85,12 +85,12 @@
   ## pushing "A1" from main to pushdest
   pushing to pushdest
   searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  OBSEXC: computing relevant nodes
-  OBSEXC: computing markers relevant to 2 nodes
   OBSEXC: pushing 2 obsolescence markers (129 bytes)
   OBSEXC: DONE
   ## post push state