obsexc: use the common discovery
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 27 Aug 2014 17:09:36 +0200
changeset 1078 5717d023da63
parent 1077 cdfc19f25478
child 1079 e8f49b32e95b
obsexc: use the common discovery We drop the hand made discovery and rely on the general one introduced some time ago.
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
--- a/hgext/evolve.py	Wed Aug 27 12:29:40 2014 +0200
+++ b/hgext/evolve.py	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-A1.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-A2.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-A3.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-A4.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-A5.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-A6.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-A7.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-B1.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-B2.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-B3.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-B4.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-B5.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-B6.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-B7.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-C1.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-C2.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-C3.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-C4.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-D1.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-D2.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-D3.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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	Wed Aug 27 12:29:40 2014 +0200
+++ b/tests/test-exchange-D4.t	Wed Aug 27 17:09:36 2014 +0200
@@ -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