compatibility: backport mercurial 176d1a0ce385
authorBoris Feld <boris.feld@octobus.net>
Tue, 30 May 2017 13:16:43 +0200
changeset 2525 5adb8bdb935e
parent 2524 d912380ec685
child 2526 f4acfbb36191
compatibility: backport mercurial 176d1a0ce385 Backport obsstore.relevantmarkers change for including previously forgotten pruned obs markers. Target mercurial version lesser than 4.3. This impact multiple tests. All test changes has been manually checked. Since the computation of relevant obsmarkers have changed, we are bumping the cache schema version. So that caches get recomputed.
README
hgext3rd/evolve/__init__.py
hgext3rd/evolve/compat.py
hgext3rd/evolve/obsdiscovery.py
tests/test-discovery-obshashrange.t
tests/test-exchange-obsmarkers-case-B1.t
tests/test-exchange-obsmarkers-case-B2.t
tests/test-exchange-obsmarkers-case-B3.t
tests/test-exchange-obsmarkers-case-B4.t
tests/test-exchange-obsmarkers-case-B5.t
tests/test-exchange-obsmarkers-case-B6.t
tests/test-exchange-obsmarkers-case-B7.t
tests/test-exchange-obsmarkers-case-C1.t
tests/test-exchange-obsmarkers-case-C2.t
tests/test-exchange-obsmarkers-case-C3.t
tests/test-exchange-obsmarkers-case-C4.t
tests/test-obsolete-push.t
--- a/README	Tue May 30 17:39:00 2017 +0200
+++ b/README	Tue May 30 13:16:43 2017 +0200
@@ -119,6 +119,11 @@
  - olog: add an '--all' option to show the whole obsolescence history tree.
  - evolution: add an experiment to track the effect of rewrites.
    (See hg help - evolve for details)
+ - exchange: fix the "relevant-markers" algorithm to include inline prune.
+   This will impact discovery of obsmarkers between server and client if one
+   still uses the old algorithm. Please upgrade both clients and servers as
+   soon as possible.
+   (See changeset 176d1a0ce385 in core Mercurial for details)
  - obsdiscovery: add a config flag to disable all obsmarkers discovery
    (See hg help - evolve for details)
  - template: add a 'precursors' template that display the closests precursors of changesets
--- a/hgext3rd/evolve/__init__.py	Tue May 30 17:39:00 2017 +0200
+++ b/hgext3rd/evolve/__init__.py	Tue May 30 13:16:43 2017 +0200
@@ -203,6 +203,7 @@
 
 from . import (
     checkheads,
+    compat,
     debugcmd,
     exthelper,
     metadata,
@@ -255,6 +256,7 @@
 eh.merge(obscache.eh)
 eh.merge(obshistory.eh)
 eh.merge(templatekw.eh)
+eh.merge(compat.eh)
 uisetup = eh.final_uisetup
 extsetup = eh.final_extsetup
 reposetup = eh.final_reposetup
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext3rd/evolve/compat.py	Tue May 30 13:16:43 2017 +0200
@@ -0,0 +1,57 @@
+# Copyright 2017 Octobus <contact@octobus.net>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+"""
+Compatibility module
+"""
+
+from mercurial import (
+    hg,
+    obsolete
+)
+
+from . import (
+    exthelper,
+)
+
+eh = exthelper.exthelper()
+
+if not hasattr(hg, '_copycache'):
+    # exact copy of relevantmarkers as in Mercurial-176d1a0ce385
+    # this fixes relevant markers computation for version < hg-4.3
+    @eh.wrapfunction(obsolete.obsstore, 'relevantmarkers')
+    def relevantmarkers(orig, self, nodes):
+        """return a set of all obsolescence markers relevant to a set of nodes.
+
+        "relevant" to a set of nodes mean:
+
+        - marker that use this changeset as successor
+        - prune marker of direct children on this changeset
+        - recursive application of the two rules on precursors of these markers
+
+        It is a set so you cannot rely on order.
+
+        Backport of mercurial changeset 176d1a0ce385 for version < 4.3
+        """
+
+        pendingnodes = set(nodes)
+        seenmarkers = set()
+        seennodes = set(pendingnodes)
+        precursorsmarkers = self.precursors
+        succsmarkers = self.successors
+        children = self.children
+        while pendingnodes:
+            direct = set()
+            for current in pendingnodes:
+                direct.update(precursorsmarkers.get(current, ()))
+                pruned = [m for m in children.get(current, ()) if not m[1]]
+                direct.update(pruned)
+                pruned = [m for m in succsmarkers.get(current, ()) if not m[1]]
+                direct.update(pruned)
+            direct -= seenmarkers
+            pendingnodes = set([m[0] for m in direct])
+            seenmarkers |= direct
+            pendingnodes -= seennodes
+            seennodes |= pendingnodes
+        return seenmarkers
--- a/hgext3rd/evolve/obsdiscovery.py	Tue May 30 17:39:00 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Tue May 30 13:16:43 2017 +0200
@@ -348,7 +348,7 @@
 
 class _obshashcache(obscache.dualsourcecache):
 
-    _schemaversion = 1
+    _schemaversion = 2
 
     _cachename = 'evo-ext-obshashrange' # used for error message
 
--- a/tests/test-discovery-obshashrange.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-discovery-obshashrange.t	Tue May 30 13:16:43 2017 +0200
@@ -518,17 +518,17 @@
   $ hg debugobshashrange --subranges --rev 'heads(all())'
            rev         node        index         size        depth      obshash
              7 f69452c5b1af            0            7            7 000000000000
-             5 45f8b879de92            0            6            6 b8a4206b0fc6
+             5 45f8b879de92            0            6            6 7c49a958a9ac
              3 2dc09a01254d            0            4            4 8932bf980bb4
              7 f69452c5b1af            4            3            7 000000000000
              3 2dc09a01254d            2            2            4 ce1937ca1278
-             5 45f8b879de92            4            2            6 31fc49d36a59
+             5 45f8b879de92            4            2            6 c6795525c540
              1 66f7d451a68b            0            2            2 327c7dd73d29
              6 c8d03c1b5e94            4            2            6 89755fd39e6d
              2 01241442b3c2            2            1            3 1ed3c61fb39a
              0 1ea73414a91b            0            1            1 000000000000
              3 2dc09a01254d            3            1            4 26f996446ecb
-             5 45f8b879de92            5            1            6 1a0c08180b65
+             5 45f8b879de92            5            1            6 796507769034
              1 66f7d451a68b            1            1            2 327c7dd73d29
              4 bebd167eb94d            4            1            5 b21465ecb790
              6 c8d03c1b5e94            5            1            6 446c2dc3bce5
@@ -569,17 +569,17 @@
   $ hg debugobshashrange --subranges --rev 'heads(all())'
            rev         node        index         size        depth      obshash
              7 f69452c5b1af            0            7            7 000000000000
-             5 45f8b879de92            0            6            6 b8a4206b0fc6
+             5 45f8b879de92            0            6            6 7c49a958a9ac
              3 2dc09a01254d            0            4            4 8932bf980bb4
              7 f69452c5b1af            4            3            7 000000000000
              3 2dc09a01254d            2            2            4 ce1937ca1278
-             5 45f8b879de92            4            2            6 31fc49d36a59
+             5 45f8b879de92            4            2            6 c6795525c540
              1 66f7d451a68b            0            2            2 327c7dd73d29
              6 c8d03c1b5e94            4            2            6 89755fd39e6d
              2 01241442b3c2            2            1            3 1ed3c61fb39a
              0 1ea73414a91b            0            1            1 000000000000
              3 2dc09a01254d            3            1            4 26f996446ecb
-             5 45f8b879de92            5            1            6 1a0c08180b65
+             5 45f8b879de92            5            1            6 796507769034
              1 66f7d451a68b            1            1            2 327c7dd73d29
              4 bebd167eb94d            4            1            5 b21465ecb790
              6 c8d03c1b5e94            5            1            6 446c2dc3bce5
@@ -611,18 +611,18 @@
   $ hg debugobshashrange --subranges --rev 'heads(all())'
            rev         node        index         size        depth      obshash
              8 4de32a90b66c            0            8            8 c7f1f7e9925b
-             5 45f8b879de92            0            6            6 b8a4206b0fc6
+             5 45f8b879de92            0            6            6 7c49a958a9ac
              3 2dc09a01254d            0            4            4 8932bf980bb4
              8 4de32a90b66c            4            4            8 c681c3e58c27
              3 2dc09a01254d            2            2            4 ce1937ca1278
-             5 45f8b879de92            4            2            6 31fc49d36a59
+             5 45f8b879de92            4            2            6 c6795525c540
              8 4de32a90b66c            6            2            8 033544c939f0
              1 66f7d451a68b            0            2            2 327c7dd73d29
              6 c8d03c1b5e94            4            2            6 89755fd39e6d
              2 01241442b3c2            2            1            3 1ed3c61fb39a
              0 1ea73414a91b            0            1            1 000000000000
              3 2dc09a01254d            3            1            4 26f996446ecb
-             5 45f8b879de92            5            1            6 1a0c08180b65
+             5 45f8b879de92            5            1            6 796507769034
              8 4de32a90b66c            7            1            8 033544c939f0
              1 66f7d451a68b            1            1            2 327c7dd73d29
              4 bebd167eb94d            4            1            5 b21465ecb790
@@ -740,18 +740,18 @@
   $ hg debugobshashrange --subranges --rev 'heads(all())'
            rev         node        index         size        depth      obshash
              7 4de32a90b66c            0            8            8 c7f1f7e9925b
-             8 45f8b879de92            0            6            6 b8a4206b0fc6
+             8 45f8b879de92            0            6            6 7c49a958a9ac
              3 2dc09a01254d            0            4            4 8932bf980bb4
              7 4de32a90b66c            4            4            8 c681c3e58c27
              3 2dc09a01254d            2            2            4 ce1937ca1278
-             8 45f8b879de92            4            2            6 31fc49d36a59
+             8 45f8b879de92            4            2            6 c6795525c540
              7 4de32a90b66c            6            2            8 033544c939f0
              1 66f7d451a68b            0            2            2 327c7dd73d29
              5 c8d03c1b5e94            4            2            6 89755fd39e6d
              2 01241442b3c2            2            1            3 1ed3c61fb39a
              0 1ea73414a91b            0            1            1 000000000000
              3 2dc09a01254d            3            1            4 26f996446ecb
-             8 45f8b879de92            5            1            6 1a0c08180b65
+             8 45f8b879de92            5            1            6 796507769034
              7 4de32a90b66c            7            1            8 033544c939f0
              1 66f7d451a68b            1            1            2 327c7dd73d29
              4 bebd167eb94d            4            1            5 b21465ecb790
--- a/tests/test-exchange-obsmarkers-case-B1.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-B1.t	Tue May 30 13:16:43 2017 +0200
@@ -75,7 +75,7 @@
   ===========
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 0000000000000000000000000000000000000000
   f5bc6836db60e308a17ba08bf050154ba9c4fad7 926d9d84b97b3483891ae983990ad87c1f7827e9
-  f6fbb35d8ac958bbe70035e4c789c18471cdc0af e041f7ff1c7bd5501c7ab602baa35f0873128021
+  f6fbb35d8ac958bbe70035e4c789c18471cdc0af c2398c6305068b6b377f36402c507b713a7c586f
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-exchange-obsmarkers-case-B2.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-B2.t	Tue May 30 13:16:43 2017 +0200
@@ -65,7 +65,7 @@
   obshashtree
   ===========
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 52a5380bc04783a9ad43bb2ab2f47a02ef02adcc
-  f5bc6836db60e308a17ba08bf050154ba9c4fad7 c5a567339e205e8cc4c494e4fb82944daaec449c
+  f5bc6836db60e308a17ba08bf050154ba9c4fad7 6892277170c13fec6712303d639965a454b5cabf
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-exchange-obsmarkers-case-B3.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-B3.t	Tue May 30 13:16:43 2017 +0200
@@ -78,7 +78,7 @@
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 0000000000000000000000000000000000000000
   f5bc6836db60e308a17ba08bf050154ba9c4fad7 0000000000000000000000000000000000000000
   35b1839966785d5703a01607229eea932db42f87 631ab4cd02ffa1d144dc8f32a18be574076031e3
-  e56289ab6378dc752fd7965f8bf66b58bda740bd 47c9d2d8db5d4b1eddd0266329ad260ccc84772c
+  e56289ab6378dc752fd7965f8bf66b58bda740bd a37fa02ad96f2e8ecce7080e73cfe22af8e1b14f
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-exchange-obsmarkers-case-B4.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-B4.t	Tue May 30 13:16:43 2017 +0200
@@ -93,7 +93,7 @@
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 1900882e85db10a1dc5bc7748f436a8a834356c6
   f5bc6836db60e308a17ba08bf050154ba9c4fad7 c27e764c783f451ef3aa40daf2a3795e6674cd06
   f6fbb35d8ac958bbe70035e4c789c18471cdc0af 907beff79fdff2b82b5d3bed7989107a6d744508
-  7f7f229b13a629a5b20581c6cb723f4e2ca54bed c27e764c783f451ef3aa40daf2a3795e6674cd06
+  7f7f229b13a629a5b20581c6cb723f4e2ca54bed 86e6b5a5ad828d83b3205ea4ca11154972da19a1
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-exchange-obsmarkers-case-B5.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-B5.t	Tue May 30 13:16:43 2017 +0200
@@ -100,7 +100,7 @@
   6e72f0a95b5e01a7504743aa941f69cb1fbef8b0 13bd00d88332fcd3fe634ed42f9d35c9cfc06398
   1d0f3cd253006f014c7687a78abbc9287db4101d 01d985a82467333a4de7a5b4e8a0de3286f8bda8
   e5ea8f9c73143125d36658e90ef70c6d2027a5b7 d2b1159bcf3694aabc3674785b1859544c35357d
-  069b05c3876d56f62895e853a501ea58ea85f68d d00e3201fcf83a1bf42e70757f07b45bdd77a220
+  069b05c3876d56f62895e853a501ea58ea85f68d a07163ee7e7cda4065f7593715b7b12f833f7065
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-exchange-obsmarkers-case-B6.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-B6.t	Tue May 30 13:16:43 2017 +0200
@@ -77,7 +77,7 @@
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 86e41541149f4b6cccc5fd131d744d8e83a681e5
   f5bc6836db60e308a17ba08bf050154ba9c4fad7 f2e05412d3f1d5bc1ae647cf9efc43e0399c26ca
   962ecf6b1afc94e15c7e48fdfb76ef8abd11372b 974507d1c466d0aa86d288836194339ed3b98736
-  f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 04e03a8959d8a39984e6a8f4a16fba975b364747
+  f6298a8ac3a4b78bbeae5f1d3dc5bc3c3812f0f3 1e0b6dce792c229c865a543c6f8964b4bba5fb5a
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-exchange-obsmarkers-case-B7.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-B7.t	Tue May 30 13:16:43 2017 +0200
@@ -71,7 +71,7 @@
   ===========
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 0000000000000000000000000000000000000000
   f5bc6836db60e308a17ba08bf050154ba9c4fad7 926d9d84b97b3483891ae983990ad87c1f7827e9
-  f6fbb35d8ac958bbe70035e4c789c18471cdc0af e041f7ff1c7bd5501c7ab602baa35f0873128021
+  f6fbb35d8ac958bbe70035e4c789c18471cdc0af c2398c6305068b6b377f36402c507b713a7c586f
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-exchange-obsmarkers-case-C1.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-C1.t	Tue May 30 13:16:43 2017 +0200
@@ -75,8 +75,8 @@
   obshashtree
   ===========
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 1ce18e5a71f78d443a80c819f2f7197c4706af70
-  f5bc6836db60e308a17ba08bf050154ba9c4fad7 92af733686ce7e0469d8b2b87b4612a4c2d33468
-  f6fbb35d8ac958bbe70035e4c789c18471cdc0af 3800aeba3728457abb9c508c94f6abc59e698c55
+  f5bc6836db60e308a17ba08bf050154ba9c4fad7 5c3c935df6f4007c633c3386d6f58b22c274809e
+  f6fbb35d8ac958bbe70035e4c789c18471cdc0af bccb3d243420ef26782fa11f209830db360c34b2
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-exchange-obsmarkers-case-C2.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-C2.t	Tue May 30 13:16:43 2017 +0200
@@ -80,7 +80,7 @@
   ===========
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 0000000000000000000000000000000000000000
   28b51eb45704506b5c603decd6bf7ac5e0f6a52f 72f95b7b9fa12243aeb90433d211f2c38263da31
-  06055a7959d4128e6e3bccfd01482e83a2db8a3a 58ecf9a107b10986d88da605eb0d03b7f24ae486
+  06055a7959d4128e6e3bccfd01482e83a2db8a3a 9d758cd0bf02f27e9b7de5665b10ceb1dc8bb1f1
   e5ea8f9c73143125d36658e90ef70c6d2027a5b7 289cb0d058c81c763eca8bb438657dba9a7ba646
   obshashrange
   ============
--- a/tests/test-exchange-obsmarkers-case-C3.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-C3.t	Tue May 30 13:16:43 2017 +0200
@@ -84,8 +84,8 @@
   ===========
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 40be80b35671116f2c61ef25797806536a6eb5a0
   28b51eb45704506b5c603decd6bf7ac5e0f6a52f beac7228bbe708bc7c9181c3c27f8a17f21dbd9f
-  06055a7959d4128e6e3bccfd01482e83a2db8a3a 8b648bd67281e9e525919285ac7b3bb2836c2f02
-  e5ea8f9c73143125d36658e90ef70c6d2027a5b7 dcd2b566ad0983333be704afdc205066e1a6b742
+  06055a7959d4128e6e3bccfd01482e83a2db8a3a 04b20150f38991d297ecfe0bf0f77deb816aed9d
+  e5ea8f9c73143125d36658e90ef70c6d2027a5b7 a59f7d5ea437389a33d2e98b9b85ba1d568a743e
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-exchange-obsmarkers-case-C4.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-exchange-obsmarkers-case-C4.t	Tue May 30 13:16:43 2017 +0200
@@ -87,7 +87,7 @@
   a9bdc8b26820b1b87d585b82eb0ceb4a2ecdbc04 a9c02d134f5b98acc74d1dc4eb28fd59f958a2bd
   f5bc6836db60e308a17ba08bf050154ba9c4fad7 619b4d13bd9878f04d7208dcfcf1e89da826f6be
   35b1839966785d5703a01607229eea932db42f87 ddeb7b7a87378f59cecb36d5146df0092b6b3327
-  7f7f229b13a629a5b20581c6cb723f4e2ca54bed 58ef2e726c5bd89bceffb6243294b38eadbf3d60
+  7f7f229b13a629a5b20581c6cb723f4e2ca54bed 0ef78fef48a60c677f55ba6efa4126dab2d6caf2
   obshashrange
   ============
            rev         node        index         size        depth      obshash
--- a/tests/test-obsolete-push.t	Tue May 30 17:39:00 2017 +0200
+++ b/tests/test-obsolete-push.t	Tue May 30 13:16:43 2017 +0200
@@ -56,7 +56,7 @@
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  1 new obsolescence markers
+  2 new obsolescence markers
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd strict-publish-client