##// END OF EJS Templates
wireprotov2: unify file revision collection and linknode derivation...
Gregory Szorc -
r40960:08cfa77d default
parent child Browse files
Show More
@@ -426,8 +426,10 b' When ``haveparents`` is false, the comma'
426 426 has no file revisions data. This means that all referenced file revisions
427 427 in the queried set of changeset revisions will be sent.
428 428
429 TODO we'll probably want a more complicated mechanism for the client to
430 specify which ancestor revisions are known.
429 TODO we want a more complicated mechanism for the client to specify which
430 ancestor revisions are known. This is needed so intelligent deltas can be
431 emitted and so updated linknodes can be sent if the client needs to adjust
432 its linknodes for existing file nodes to older changeset revisions.
431 433 TODO we may want to make linknodes an array so multiple changesets can be
432 434 marked as introducing a file revision, since this can occur with e.g. hidden
433 435 changesets.
@@ -1156,47 +1156,37 b' def filesdata(repo, proto, haveparents, '
1156 1156 # changeset, it should probably be allowed to access files data for that
1157 1157 # changeset.
1158 1158
1159 cl = repo.changelog
1160 clnode = cl.node
1161 1159 outgoing = resolvenodes(repo, revisions)
1162 1160 filematcher = makefilematcher(repo, pathfilter)
1163 1161
1164 # Figure out what needs to be emitted.
1165 changedpaths = set()
1166 1162 # path -> {fnode: linknode}
1167 1163 fnodes = collections.defaultdict(dict)
1168 1164
1165 # We collect the set of relevant file revisions by iterating the changeset
1166 # revisions and either walking the set of files recorded in the changeset
1167 # or by walking the manifest at that revision. There is probably room for a
1168 # storage-level API to request this data, as it can be expensive to compute
1169 # and would benefit from caching or alternate storage from what revlogs
1170 # provide.
1169 1171 for node in outgoing:
1170 1172 ctx = repo[node]
1171 changedpaths.update(ctx.files())
1173 mctx = ctx.manifestctx()
1174 md = mctx.read()
1172 1175
1173 changedpaths = sorted(p for p in changedpaths if filematcher(p))
1174
1175 # If ancestors are known, we send file revisions having a linkrev in the
1176 # outgoing set of changeset revisions.
1177 1176 if haveparents:
1178 outgoingclrevs = set(cl.rev(n) for n in outgoing)
1179
1180 for path in changedpaths:
1181 try:
1182 store = getfilestore(repo, proto, path)
1183 except FileAccessError as e:
1184 raise error.WireprotoCommandError(e.msg, e.args)
1177 checkpaths = ctx.files()
1178 else:
1179 checkpaths = md.keys()
1185 1180
1186 for rev in store:
1187 linkrev = store.linkrev(rev)
1188
1189 if linkrev in outgoingclrevs:
1190 fnodes[path].setdefault(store.node(rev), clnode(linkrev))
1181 for path in checkpaths:
1182 fnode = md[path]
1191 1183
1192 # If ancestors aren't known, we walk the manifests and send all
1193 # encountered file revisions.
1194 else:
1195 for node in outgoing:
1196 mctx = repo[node].manifestctx()
1184 if path in fnodes and fnode in fnodes[path]:
1185 continue
1197 1186
1198 for path, fnode in mctx.read().items():
1199 if filematcher(path):
1187 if not filematcher(path):
1188 continue
1189
1200 1190 fnodes[path].setdefault(fnode, node)
1201 1191
1202 1192 yield {
@@ -1267,8 +1267,6 b' rewritten accordingly'
1267 1267 }
1268 1268 ]
1269 1269
1270 TODO this is buggy
1271
1272 1270 $ sendhttpv2peer << EOF
1273 1271 > command filesdata
1274 1272 > revisions eval:[{
@@ -1284,8 +1282,16 b' TODO this is buggy'
1284 1282 sending filesdata command
1285 1283 response: gen[
1286 1284 {
1287 b'totalitems': 0,
1288 b'totalpaths': 0
1285 b'totalitems': 1,
1286 b'totalpaths': 1
1287 },
1288 {
1289 b'path': b'dupe-file',
1290 b'totalitems': 1
1291 },
1292 {
1293 b'linknode': b'G\xfc0X\t\x11#,\xb2dg[@(\x19\xde\xdd\xf6\xc6\xf0',
1294 b'node': b'.\xd2\xa3\x91*\x0b$P C\xea\xe8N\xe4\xb2y\xc1\x8b\x90\xdd'
1289 1295 }
1290 1296 ]
1291 1297
@@ -1300,21 +1300,6 b' Perform an incremental pull of both head'
1300 1300
1301 1301 #if reporevlogstore
1302 1302 $ hg -R client-linknode-2 debugrevlogindex dupe-file
1303 abort: revlog 'dupe-file' not found
1304 [255]
1303 rev linkrev nodeid p1 p2
1304 0 2 2ed2a3912a0b 000000000000 000000000000
1305 1305 #endif
1306
1307 $ hg -R client-linknode-2 verify
1308 checking changesets
1309 checking manifests
1310 crosschecking files in changesets and manifests
1311 checking files
1312 warning: revlog 'data/dupe-file.i' not in fncache!
1313 2: empty or missing dupe-file
1314 dupe-file@2: manifest refers to unknown revision 2ed2a3912a0b
1315 checked 3 changesets with 2 changes to 3 files
1316 1 warnings encountered!
1317 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
1318 2 integrity errors encountered!
1319 (first damaged changeset appears to be 2)
1320 [1]
General Comments 0
You need to be logged in to leave comments. Login now