# HG changeset patch # User Pierre-Yves David # Date 2014-08-20 08:15:09 # Node ID 6d113cc7a31a244148590b8c624c24a557c8a8a2 # Parent 9d1f3896f39c4280fd832f6f400da980e79e2609 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. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -297,7 +297,11 @@ def _pushdiscoveryobsmarkers(pushop): 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 @@ def _pushobsolete(pushop): 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): diff --git a/tests/test-bundle2.t b/tests/test-bundle2.t --- a/tests/test-bundle2.t +++ b/tests/test-bundle2.t @@ -878,7 +878,7 @@ push 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 @@ push 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