changeset 22350:6d113cc7a31a

push: only push obsmarkers relevant to the "pushed subset" We should only exchange obsolete markers related to the changesets that are being exchanged. For example, if `A'` is a successor of `A`, we do not want to push the marker if we are not exchanging `A'`. Otherwise `A` would disappear without a successor, leading to confusion for both users and the evolution mechanism. Therefore we now exchange only the markers relevant to the subset of nodes involved in the push (the nodes themselves may be already common but were selected by --rev (or the lack of --rev)). Note that all selected markers are still exchanged on each push. We do not have a discovery protocol for markers in core yet. Such discovery would save us the exchange of markers known on both side.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 20 Aug 2014 01:15:09 -0700
parents 9d1f3896f39c
children 7e6dd496d327
files mercurial/exchange.py tests/test-bundle2.t
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Wed Aug 20 19:47:35 2014 -0700
+++ b/mercurial/exchange.py	Wed Aug 20 01:15:09 2014 -0700
@@ -297,7 +297,11 @@
     if (obsolete._enabled
         and pushop.repo.obsstore
         and 'obsolete' in pushop.remote.listkeys('namespaces')):
-        pushop.outobsmarkers = pushop.repo.obsstore
+        repo = pushop.repo
+        # very naive computation, that can be quite expensive on big repo.
+        # However: evolution is currently slow on them anyway.
+        nodes = (c.node() for c in repo.set('::%ln', pushop.futureheads))
+        pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(nodes)
 
 @pushdiscovery('bookmarks')
 def _pushdiscoverybookmarks(pushop):
@@ -680,7 +684,7 @@
     repo = pushop.repo
     remote = pushop.remote
     pushop.stepsdone.add('obsmarkers')
-    if (pushop.outobsmarkers):
+    if pushop.outobsmarkers:
         rslts = []
         remotedata = obsolete._pushkeyescape(pushop.outobsmarkers)
         for key in sorted(remotedata, reverse=True):
--- a/tests/test-bundle2.t	Wed Aug 20 19:47:35 2014 -0700
+++ b/tests/test-bundle2.t	Wed Aug 20 01:15:09 2014 -0700
@@ -878,7 +878,7 @@
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 0 changes to 0 files (-1 heads)
-  remote: 5 new obsolescence markers
+  remote: 1 new obsolescence markers
   updating bookmark book_eea1
   exporting bookmark book_eea1
   $ hg -R other log -G
@@ -894,10 +894,6 @@
   1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  7777777777777777777777777777777777777777 32af7686d403cf45b5d95f2d70cebea587ac806a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
 
 pull over ssh