Mercurial > public > mercurial-scm > hg
diff mercurial/exchange.py @ 35259:ad5f2b923b0d
push: include a 'check:bookmarks' part when possible
Before updating the actual bookmark update, we can start with updating the way
we check for push race. Checking bookmarks state earlier is useful even if we
still use pushkey. Aborting before the changegroup is added can save a lot of
time.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 13 Nov 2017 04:22:45 +0100 |
parents | 5a62910948d2 |
children | 3fd5f05a5b87 |
line wrap: on
line diff
--- a/mercurial/exchange.py Sun Oct 15 15:01:03 2017 +0200 +++ b/mercurial/exchange.py Mon Nov 13 04:22:45 2017 +0100 @@ -13,6 +13,7 @@ from .i18n import _ from .node import ( + bin, hex, nullid, ) @@ -743,6 +744,22 @@ or pushop.outobsmarkers or pushop.outbookmarks) +@b2partsgenerator('check-bookmarks') +def _pushb2checkbookmarks(pushop, bundler): + """insert bookmark move checking""" + if not _pushing(pushop) or pushop.force: + return + b2caps = bundle2.bundle2caps(pushop.remote) + hasbookmarkcheck = 'bookmarks' in b2caps + if not (pushop.outbookmarks and hasbookmarkcheck): + return + data = [] + for book, old, new in pushop.outbookmarks: + old = bin(old) + data.append((book, old)) + checkdata = bookmod.binaryencode(data) + bundler.newpart('check:bookmarks', data=checkdata) + @b2partsgenerator('check-phases') def _pushb2checkphases(pushop, bundler): """insert phase move checking"""