Mercurial > public > mercurial-scm > hg
diff mercurial/bundle2.py @ 34320:12c42bcd4133
phases: move the binary decoding function in the phases module
We move the decoding function near the encoding one in a place where they can
be reused in other place (current target, 'exchange.py').
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 19 Sep 2017 22:23:41 +0200 |
parents | 5779d096a696 |
children | 4ef472b975ff |
line wrap: on
line diff
--- a/mercurial/bundle2.py Tue Sep 19 22:01:31 2017 +0200 +++ b/mercurial/bundle2.py Tue Sep 19 22:23:41 2017 +0200 @@ -1836,23 +1836,10 @@ kwargs[key] = inpart.params[key] raise error.PushkeyFailed(partid=str(inpart.id), **kwargs) -def _readphaseheads(inpart): - headsbyphase = [[] for i in phases.allphases] - entrysize = phases._fphasesentry.size - while True: - entry = inpart.read(entrysize) - if len(entry) < entrysize: - if entry: - raise error.Abort(_('bad phase-heads bundle part')) - break - phase, node = phases._fphasesentry.unpack(entry) - headsbyphase[phase].append(node) - return headsbyphase - @parthandler('phase-heads') def handlephases(op, inpart): """apply phases from bundle part to repo""" - headsbyphase = _readphaseheads(inpart) + headsbyphase = phases.binarydecode(inpart) phases.updatephases(op.repo.unfiltered(), op.gettransaction(), headsbyphase) op.records.add('phase-heads', {})