Mercurial > hg
comparison mercurial/changegroup.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 | a2f521773761 |
children | 66cf046ef60f |
comparison
equal
deleted
inserted
replaced
38884:a2f521773761 | 38885:5839a170357d |
---|---|
849 # generally doesn't help, so we disable it by default (treating | 849 # generally doesn't help, so we disable it by default (treating |
850 # bundle.reorder=auto just like bundle.reorder=False). | 850 # bundle.reorder=auto just like bundle.reorder=False). |
851 self._reorder = False | 851 self._reorder = False |
852 | 852 |
853 def deltaparent(self, revlog, rev, p1, p2, prev): | 853 def deltaparent(self, revlog, rev, p1, p2, prev): |
854 # Narrow ellipses mode. | |
855 if util.safehasattr(self, 'full_nodes'): | |
856 # TODO: send better deltas when in narrow mode. | |
857 # | |
858 # changegroup.group() loops over revisions to send, | |
859 # including revisions we'll skip. What this means is that | |
860 # `prev` will be a potentially useless delta base for all | |
861 # ellipsis nodes, as the client likely won't have it. In | |
862 # the future we should do bookkeeping about which nodes | |
863 # have been sent to the client, and try to be | |
864 # significantly smarter about delta bases. This is | |
865 # slightly tricky because this same code has to work for | |
866 # all revlogs, and we don't have the linkrev/linknode here. | |
867 return p1 | |
868 | |
854 dp = revlog.deltaparent(rev) | 869 dp = revlog.deltaparent(rev) |
855 if dp == nullrev and revlog.storedeltachains: | 870 if dp == nullrev and revlog.storedeltachains: |
856 # Avoid sending full revisions when delta parent is null. Pick prev | 871 # Avoid sending full revisions when delta parent is null. Pick prev |
857 # in that case. It's tempting to pick p1 in this case, as p1 will | 872 # in that case. It's tempting to pick p1 in this case, as p1 will |
858 # be smaller in the common case. However, computing a delta against | 873 # be smaller in the common case. However, computing a delta against |