diff --git a/mercurial/exchange.py b/mercurial/exchange.py index c894fdff56d13d4ca299606294f01cabe4cb1f83_bWVyY3VyaWFsL2V4Y2hhbmdlLnB5..0688010ee38fc2b0b0e1a793759d76fb7262c519_bWVyY3VyaWFsL2V4Y2hhbmdlLnB5 100644 --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -83,6 +83,8 @@ self.fallbackoutdatedphases = None # outgoing obsmarkers self.outobsmarkers = set() + # outgoing bookmarks + self.outbookmarks = [] @util.propertycache def futureheads(self): @@ -280,6 +282,24 @@ def _pushdiscoveryobsmarkers(pushop): pushop.outobsmarkers = pushop.repo.obsstore +@pushdiscovery('bookmarks') +def _pushdiscoverybookmarks(pushop): + ui = pushop.ui + repo = pushop.repo.unfiltered() + remote = pushop.remote + ui.debug("checking for updated bookmarks\n") + ancestors = () + if pushop.revs: + revnums = map(repo.changelog.rev, pushop.revs) + ancestors = repo.changelog.ancestors(revnums, inclusive=True) + remotebookmark = remote.listkeys('bookmarks') + + comp = bookmarks.compare(repo, repo._bookmarks, remotebookmark, srchex=hex) + (addsrc, adddst, advsrc, advdst, diverge, differ, invalid) = comp + for b, scid, dcid in advsrc: + if not ancestors or repo[scid].rev() in ancestors: + pushop.outbookmarks.append((b, dcid, scid)) + def _pushcheckoutgoing(pushop): outgoing = pushop.outgoing unfi = pushop.repo.unfiltered() @@ -616,5 +636,4 @@ if pushop.ret == 0: return ui = pushop.ui - repo = pushop.repo.unfiltered() remote = pushop.remote @@ -620,16 +639,6 @@ remote = pushop.remote - ui.debug("checking for updated bookmarks\n") - ancestors = () - if pushop.revs: - revnums = map(repo.changelog.rev, pushop.revs) - ancestors = repo.changelog.ancestors(revnums, inclusive=True) - remotebookmark = remote.listkeys('bookmarks') - comp = bookmarks.compare(repo, repo._bookmarks, remotebookmark, srchex=hex) - (addsrc, adddst, advsrc, advdst, diverge, differ, invalid) = comp - for b, scid, dcid in advsrc: - if ancestors and repo[scid].rev() not in ancestors: - continue - if remote.pushkey('bookmarks', b, dcid, scid): + for b, old, new in pushop.outbookmarks: + if remote.pushkey('bookmarks', b, old, new): ui.status(_("updating bookmark %s\n") % b) else: ui.warn(_('updating bookmark %s failed!\n') % b) diff --git a/tests/test-acl.t b/tests/test-acl.t index c894fdff56d13d4ca299606294f01cabe4cb1f83_dGVzdHMvdGVzdC1hY2wudA==..0688010ee38fc2b0b0e1a793759d76fb7262c519_dGVzdHMvdGVzdC1hY2wudA== 100644 --- a/tests/test-acl.t +++ b/tests/test-acl.t @@ -83,6 +83,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 3 changesets found list of changesets: @@ -120,8 +122,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) 0:6675d58eff77 @@ -142,6 +142,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -182,8 +184,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) 0:6675d58eff77 @@ -205,6 +205,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -255,8 +257,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) 0:6675d58eff77 @@ -278,6 +278,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -346,6 +348,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -419,6 +423,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -489,6 +495,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -564,6 +572,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -636,6 +646,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -710,6 +722,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -760,8 +774,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) 0:6675d58eff77 @@ -790,6 +802,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -871,6 +885,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -908,6 +924,6 @@ added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: checking access for user "barney" - error: pretxnchangegroup.acl hook raised an exception: [Errno *] *: '../acl.config' (glob) + error: pretxnchangegroup.acl hook raised an exception: [Errno 2] No such file or directory: '../acl.config' transaction abort! rollback completed @@ -912,6 +928,6 @@ transaction abort! rollback completed - abort: *: ../acl.config (glob) + abort: No such file or directory: ../acl.config no rollback information available 0:6675d58eff77 @@ -947,6 +963,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -1034,6 +1052,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -1084,8 +1104,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) 0:6675d58eff77 @@ -1115,6 +1133,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -1165,8 +1185,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) 0:6675d58eff77 @@ -1192,6 +1210,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -1269,6 +1289,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -1320,8 +1342,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) 0:6675d58eff77 @@ -1347,6 +1367,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" invalid branchheads cache (served): tip differs listing keys for "bookmarks" 3 changesets found @@ -1463,6 +1485,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 4 changesets found list of changesets: @@ -1523,8 +1547,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 2 (undo push) 2:fb35475503ef @@ -1547,6 +1569,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 4 changesets found list of changesets: @@ -1627,6 +1651,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 4 changesets found list of changesets: @@ -1703,6 +1729,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 4 changesets found list of changesets: @@ -1773,6 +1801,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 4 changesets found list of changesets: @@ -1833,8 +1863,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 2 (undo push) 2:fb35475503ef @@ -1862,6 +1890,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 4 changesets found list of changesets: @@ -1922,8 +1952,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 2 (undo push) 2:fb35475503ef @@ -1950,6 +1978,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 4 changesets found list of changesets: @@ -2025,6 +2055,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 4 changesets found list of changesets: @@ -2085,8 +2117,6 @@ updating the branch cache listing keys for "phases" try to push obsolete markers to remote - checking for updated bookmarks - listing keys for "bookmarks" repository tip rolled back to revision 2 (undo push) 2:fb35475503ef @@ -2107,6 +2137,8 @@ searching for changes all remote heads known locally listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" 4 changesets found list of changesets: diff --git a/tests/test-hook.t b/tests/test-hook.t index c894fdff56d13d4ca299606294f01cabe4cb1f83_dGVzdHMvdGVzdC1ob29rLnQ=..0688010ee38fc2b0b0e1a793759d76fb7262c519_dGVzdHMvdGVzdC1ob29rLnQ= 100644 --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -211,6 +211,7 @@ pushing to ../a searching for changes listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} + listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} no changes found listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} @@ -214,7 +215,6 @@ no changes found listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} - listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} exporting bookmark baz prepushkey.forbid hook: HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 abort: prepushkey hook exited with status 1 diff --git a/tests/test-http.t b/tests/test-http.t index c894fdff56d13d4ca299606294f01cabe4cb1f83_dGVzdHMvdGVzdC1odHRwLnQ=..0688010ee38fc2b0b0e1a793759d76fb7262c519_dGVzdHMvdGVzdC1odHRwLnQ= 100644 --- a/tests/test-http.t +++ b/tests/test-http.t @@ -263,8 +263,9 @@ "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases + "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks "GET /?cmd=branchmap HTTP/1.1" 200 - "GET /?cmd=branchmap HTTP/1.1" 200 - "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases @@ -266,9 +267,8 @@ "GET /?cmd=branchmap HTTP/1.1" 200 - "GET /?cmd=branchmap HTTP/1.1" 200 - "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases - "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks #endif $ cd .. diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t index c894fdff56d13d4ca299606294f01cabe4cb1f83_dGVzdHMvdGVzdC1vYnNvbGV0ZS50..0688010ee38fc2b0b0e1a793759d76fb7262c519_dGVzdHMvdGVzdC1vYnNvbGV0ZS50 100644 --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -326,5 +326,6 @@ $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd pushing to tmpd listkeys phases + listkeys bookmarks no changes found listkeys phases @@ -329,6 +330,5 @@ no changes found listkeys phases - listkeys bookmarks [1] clone support diff --git a/tests/test-push-warn.t b/tests/test-push-warn.t index c894fdff56d13d4ca299606294f01cabe4cb1f83_dGVzdHMvdGVzdC1wdXNoLXdhcm4udA==..0688010ee38fc2b0b0e1a793759d76fb7262c519_dGVzdHMvdGVzdC1wdXNoLXdhcm4udA== 100644 --- a/tests/test-push-warn.t +++ b/tests/test-push-warn.t @@ -36,6 +36,8 @@ query 2; still undecided: 1, sample size is: 1 2 total queries listing keys for "phases" + checking for updated bookmarks + listing keys for "bookmarks" listing keys for "bookmarks" remote has heads on branch 'default' that are not known locally: 1c9246a22a0a new remote heads on branch 'default': diff --git a/tests/test-treediscovery.t b/tests/test-treediscovery.t index c894fdff56d13d4ca299606294f01cabe4cb1f83_dGVzdHMvdGVzdC10cmVlZGlzY292ZXJ5LnQ=..0688010ee38fc2b0b0e1a793759d76fb7262c519_dGVzdHMvdGVzdC10cmVlZGlzY292ZXJ5LnQ= 100644 --- a/tests/test-treediscovery.t +++ b/tests/test-treediscovery.t @@ -523,8 +523,9 @@ "GET /?cmd=capabilities HTTP/1.1" 200 - "GET /?cmd=heads HTTP/1.1" 200 - "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases + "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks "GET /?cmd=branchmap HTTP/1.1" 200 - "GET /?cmd=branchmap HTTP/1.1" 200 - "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+1827a5bb63e602382eb89dd58f2ac9f3b007ad91 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases @@ -526,9 +527,8 @@ "GET /?cmd=branchmap HTTP/1.1" 200 - "GET /?cmd=branchmap HTTP/1.1" 200 - "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+1827a5bb63e602382eb89dd58f2ac9f3b007ad91 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases - "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks "GET /?cmd=capabilities HTTP/1.1" 200 - "GET /?cmd=heads HTTP/1.1" 200 - "GET /?cmd=capabilities HTTP/1.1" 200 -