# HG changeset patch # User Augie Fackler # Date 2018-09-20 13:52:59 # Node ID 5adc5fe41a7daa292272f43493a23e4aa7a3d9b6 # Parent e03c1a63155cb6443f9b5da592ef40a1b17208f8 changegroup: reintroduce some comments that have gotten lost over the years I got concerned about the correctness of the pruning logic, but I was misreading it. I didn't figure that out until I walked all the way back to 0252abaafb8a from 20111, where I was finally able to see (in the deleted side of the change!) a complete explanation from b6d9ea0bc107 in 2005. Differential Revision: https://phab.mercurial-scm.org/D4686 diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -1071,8 +1071,14 @@ class cgpacker(object): store = mfl.getstorage(tree) if not self._filematcher.visitdir(store.tree[:-1] or '.'): + # No nodes to send because this directory is out of + # the client's view of the repository (probably + # because of narrow clones). prunednodes = [] else: + # Avoid sending any manifest nodes we can prove the + # client already has by checking linkrevs. See the + # related comment in generatefiles(). prunednodes = self._prunemanifests(store, nodes, commonrevs) if tree and not prunednodes: continue @@ -1164,6 +1170,10 @@ class cgpacker(object): return linkrevnodes[x] frev, flr = filerevlog.rev, filerevlog.linkrev + # Skip sending any filenode we know the client already + # has. This avoids over-sending files relatively + # inexpensively, so it's not a problem if we under-filter + # here. filenodes = [n for n in linkrevnodes if flr(frev(n)) not in commonrevs]