--- a/mercurial/changegroup.py Sun Oct 09 03:11:18 2016 +0200
+++ b/mercurial/changegroup.py Thu Oct 13 12:49:47 2016 +0200
@@ -818,8 +818,15 @@
def deltaparent(self, revlog, rev, p1, p2, prev):
dp = revlog.deltaparent(rev)
- # avoid storing full revisions; pick prev in those cases
- # also pick prev when we can't be sure remote has dp
+ # Avoid sending full revisions when delta parent is null. Pick
+ # prev in that case. It's tempting to pick p1 in this case, as p1
+ # will be smaller in the common case. However, computing a delta
+ # against p1 may require resolving the raw text of p1, which could
+ # be expensive. The revlog caches should have prev cached, meaning
+ # less CPU for changegroup generation. There is likely room to add
+ # a flag and/or config option to control this behavior.
+ #
+ # Pick prev when we can't be sure remote has the base revision.
if dp == nullrev or (dp != p1 and dp != p2 and dp != prev):
return prev
return dp