Mercurial > hg
comparison hgext/narrow/narrowchangegroup.py @ 38885:5839a170357d
changegroup: move deltaparent() from narrow
I'm not keen on performing the attribute sniff to test for
presence of ellipses mode: I'd rather we use a separate packer
instance that was ellipses mode specific. But I've tried to
formalize a better API without narrow in core and I can't
make sense of all the monkeypatching. My goal is to inline
as much of the monkeypatching as possible then refactor the
changegroup generation API.
We add this code to the cg2packer because narrow doesn't work
with cg1.
Differential Revision: https://phab.mercurial-scm.org/D4062
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 02 Aug 2018 09:40:18 -0700 |
parents | ee1ea96cf9c9 |
children | 66cf046ef60f |
comparison
equal
deleted
inserted
replaced
38884:a2f521773761 | 38885:5839a170357d |
---|---|
314 p1, p2 = sorted(local(p) for p in linkparents) | 314 p1, p2 = sorted(local(p) for p in linkparents) |
315 n = revlog.node(rev) | 315 n = revlog.node(rev) |
316 yield changegroup.ellipsisdata( | 316 yield changegroup.ellipsisdata( |
317 self, rev, revlog, p1, p2, revlog.revision(n), linknode) | 317 self, rev, revlog, p1, p2, revlog.revision(n), linknode) |
318 extensions.wrapfunction(changegroup.cg1packer, 'revchunk', revchunk) | 318 extensions.wrapfunction(changegroup.cg1packer, 'revchunk', revchunk) |
319 | |
320 def deltaparent(orig, self, revlog, rev, p1, p2, prev): | |
321 if util.safehasattr(self, 'full_nodes'): | |
322 # TODO: send better deltas when in narrow mode. | |
323 # | |
324 # changegroup.group() loops over revisions to send, | |
325 # including revisions we'll skip. What this means is that | |
326 # `prev` will be a potentially useless delta base for all | |
327 # ellipsis nodes, as the client likely won't have it. In | |
328 # the future we should do bookkeeping about which nodes | |
329 # have been sent to the client, and try to be | |
330 # significantly smarter about delta bases. This is | |
331 # slightly tricky because this same code has to work for | |
332 # all revlogs, and we don't have the linkrev/linknode here. | |
333 return p1 | |
334 return orig(self, revlog, rev, p1, p2, prev) | |
335 extensions.wrapfunction(changegroup.cg2packer, 'deltaparent', deltaparent) |