Mercurial > evolve
changeset 1005:4fe159fdfc4c
push: extract obsmarkers discovery in a dedicated function
The need to factorise the computation of the markers to send in a dedicated
function. This prepare the inclusion of obsmarkers in an atomic bundle2 push.
For now, when obsmarkers are pushed using bundle2, they are still doing it on
their own, in a dedicated bundle2 push.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 28 Jul 2014 00:08:06 +0200 |
parents | 808a33826700 |
children | deba3a063c63 |
files | hgext/evolve.py |
diffstat | 1 files changed, 31 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py Tue Jul 29 17:15:57 2014 -0700 +++ b/hgext/evolve.py Mon Jul 28 00:08:06 2014 +0200 @@ -2320,18 +2320,26 @@ -@eh.wrapfunction(exchange, '_pushobsolete') -def _pushobsolete(orig, pushop): - """utility function to push obsolete markers to a remote""" - pushop.ui.debug('try to push obsolete markers to remote\n') + +def _obsmarkersdiscovery(pushop): + """return the list of marker that needs to be pushed to the server + + When used before (or at the same time) the changegroup have been pushed, it + returns the value as if the planned changegroup was succesful. Othewise it + use te actual common heads to decide whats needs to be pushed. + """ repo = pushop.repo remote = pushop.remote unfi = repo.unfiltered() cl = unfi.changelog + commonheads = pushop.commonheads + if commonheads is None: + # ctx not pushed yet, we try to be in the same bundle2 + commonheads = pushop.outgoing.missingheads if (obsolete._enabled and repo.obsstore and 'obsolete' in remote.listkeys('namespaces')): repo.ui.status("OBSEXC: computing relevant nodes\n") - revs = unfi.revs('::%ln', pushop.commonheads) + revs = unfi.revs('::%ln', commonheads) common = [] if remote.capable('_evoext_obshash_0'): repo.ui.status("OBSEXC: looking for common markers in %i nodes\n" @@ -2346,6 +2354,24 @@ else: repo.ui.status("OBSEXC: markers already in sync\n") markers = [] + return markers + +@eh.wrapfunction(exchange, '_pushobsolete') +def _pushobsolete(orig, pushop): + """utility function to push obsolete markers to a remote""" + stepsdone = getattr(pushop, 'stepsdone', None) + if stepsdone is not None: + if 'obsmarkers' in stepsdone: + return + stepsdone.add('obsmarkers') + pushop.ui.debug('try to push obsolete markers to remote\n') + repo = pushop.repo + remote = pushop.remote + unfi = repo.unfiltered() + cl = unfi.changelog + if (obsolete._enabled and repo.obsstore and + 'obsolete' in remote.listkeys('namespaces')): + markers = _obsmarkersdiscovery(pushop) if not markers: repo.ui.status("OBSEXC: no marker to push\n") elif remote.capable('_evoext_b2x_obsmarkers_0'):