comparison mercurial/changegroup.py @ 39733:5adc5fe41a7d

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
author Augie Fackler <augie@google.com>
date Thu, 20 Sep 2018 09:52:59 -0400
parents e03c1a63155c
children db5501d93bcf
comparison
equal deleted inserted replaced
39732:e03c1a63155c 39733:5adc5fe41a7d
1069 while tmfnodes: 1069 while tmfnodes:
1070 tree, nodes = tmfnodes.popitem() 1070 tree, nodes = tmfnodes.popitem()
1071 store = mfl.getstorage(tree) 1071 store = mfl.getstorage(tree)
1072 1072
1073 if not self._filematcher.visitdir(store.tree[:-1] or '.'): 1073 if not self._filematcher.visitdir(store.tree[:-1] or '.'):
1074 # No nodes to send because this directory is out of
1075 # the client's view of the repository (probably
1076 # because of narrow clones).
1074 prunednodes = [] 1077 prunednodes = []
1075 else: 1078 else:
1079 # Avoid sending any manifest nodes we can prove the
1080 # client already has by checking linkrevs. See the
1081 # related comment in generatefiles().
1076 prunednodes = self._prunemanifests(store, nodes, commonrevs) 1082 prunednodes = self._prunemanifests(store, nodes, commonrevs)
1077 if tree and not prunednodes: 1083 if tree and not prunednodes:
1078 continue 1084 continue
1079 1085
1080 lookupfn = makelookupmflinknode(tree, nodes) 1086 lookupfn = makelookupmflinknode(tree, nodes)
1162 # fastpath case and with lookupmf in the slowpath case. 1168 # fastpath case and with lookupmf in the slowpath case.
1163 def lookupfilelog(x): 1169 def lookupfilelog(x):
1164 return linkrevnodes[x] 1170 return linkrevnodes[x]
1165 1171
1166 frev, flr = filerevlog.rev, filerevlog.linkrev 1172 frev, flr = filerevlog.rev, filerevlog.linkrev
1173 # Skip sending any filenode we know the client already
1174 # has. This avoids over-sending files relatively
1175 # inexpensively, so it's not a problem if we under-filter
1176 # here.
1167 filenodes = [n for n in linkrevnodes 1177 filenodes = [n for n in linkrevnodes
1168 if flr(frev(n)) not in commonrevs] 1178 if flr(frev(n)) not in commonrevs]
1169 1179
1170 if not filenodes: 1180 if not filenodes:
1171 continue 1181 continue