Show More
@@ -674,9 +674,10 b' class sqlitefilestore(object):' | |||
|
674 | 674 | linkmapper, |
|
675 | 675 | transaction, |
|
676 | 676 | addrevisioncb=None, |
|
677 | duplicaterevisioncb=None, | |
|
677 | 678 | maybemissingparents=False, |
|
678 | 679 | ): |
|
679 |
|
|
|
680 | empty = True | |
|
680 | 681 | |
|
681 | 682 | for node, p1, p2, linknode, deltabase, delta, wireflags in deltas: |
|
682 | 683 | storeflags = 0 |
@@ -715,8 +716,6 b' class sqlitefilestore(object):' | |||
|
715 | 716 | |
|
716 | 717 | linkrev = linkmapper(linknode) |
|
717 | 718 | |
|
718 | nodes.append(node) | |
|
719 | ||
|
720 | 719 | if node in self._revisions: |
|
721 | 720 | # Possibly reset parents to make them proper. |
|
722 | 721 | entry = self._revisions[node] |
@@ -741,6 +740,9 b' class sqlitefilestore(object):' | |||
|
741 | 740 | (self._nodetorev[p1], entry.flags, entry.rid), |
|
742 | 741 | ) |
|
743 | 742 | |
|
743 | if duplicaterevisioncb: | |
|
744 | duplicaterevisioncb(self, node) | |
|
745 | empty = False | |
|
744 | 746 | continue |
|
745 | 747 | |
|
746 | 748 | if deltabase == nullid: |
@@ -763,8 +765,9 b' class sqlitefilestore(object):' | |||
|
763 | 765 | |
|
764 | 766 | if addrevisioncb: |
|
765 | 767 | addrevisioncb(self, node) |
|
768 | empty = False | |
|
766 | 769 | |
|
767 |
return no |
|
|
770 | return not empty | |
|
768 | 771 | |
|
769 | 772 | def censorrevision(self, tr, censornode, tombstone=b''): |
|
770 | 773 | tombstone = storageutil.packmeta({b'censored': tombstone}, b'') |
@@ -316,20 +316,29 b' class cg1unpacker(object):' | |||
|
316 | 316 | self.callback = progress.increment |
|
317 | 317 | |
|
318 | 318 | efilesset = set() |
|
319 | cgnodes = [] | |
|
319 | 320 | |
|
320 | 321 | def onchangelog(cl, node): |
|
321 | 322 | efilesset.update(cl.readfiles(node)) |
|
323 | cgnodes.append(node) | |
|
324 | ||
|
325 | def ondupchangelog(cl, node): | |
|
326 | cgnodes.append(node) | |
|
322 | 327 | |
|
323 | 328 | self.changelogheader() |
|
324 | 329 | deltas = self.deltaiter() |
|
325 | cgnodes = cl.addgroup(deltas, csmap, trp, addrevisioncb=onchangelog) | |
|
326 | efiles = len(efilesset) | |
|
327 | ||
|
328 | if not cgnodes: | |
|
330 | if not cl.addgroup( | |
|
331 | deltas, | |
|
332 | csmap, | |
|
333 | trp, | |
|
334 | addrevisioncb=onchangelog, | |
|
335 | duplicaterevisioncb=ondupchangelog, | |
|
336 | ): | |
|
329 | 337 | repo.ui.develwarn( |
|
330 | 338 | b'applied empty changelog from changegroup', |
|
331 | 339 | config=b'warn-empty-changegroup', |
|
332 | 340 | ) |
|
341 | efiles = len(efilesset) | |
|
333 | 342 | clend = len(cl) |
|
334 | 343 | changesets = clend - clstart |
|
335 | 344 | progress.complete() |
@@ -343,16 +343,21 b' def _processchangesetdata(repo, tr, objs' | |||
|
343 | 343 | ) |
|
344 | 344 | |
|
345 | 345 | manifestnodes = {} |
|
346 | added = [] | |
|
346 | 347 | |
|
347 | 348 | def linkrev(node): |
|
348 | 349 | repo.ui.debug(b'add changeset %s\n' % short(node)) |
|
349 | 350 | # Linkrev for changelog is always self. |
|
350 | 351 | return len(cl) |
|
351 | 352 | |
|
353 | def ondupchangeset(cl, node): | |
|
354 | added.append(node) | |
|
355 | ||
|
352 | 356 | def onchangeset(cl, node): |
|
353 | 357 | progress.increment() |
|
354 | 358 | |
|
355 | 359 | revision = cl.changelogrevision(node) |
|
360 | added.append(node) | |
|
356 | 361 | |
|
357 | 362 | # We need to preserve the mapping of changelog revision to node |
|
358 | 363 | # so we can set the linkrev accordingly when manifests are added. |
@@ -403,8 +408,12 b' def _processchangesetdata(repo, tr, objs' | |||
|
403 | 408 | 0, |
|
404 | 409 | ) |
|
405 | 410 | |
|
406 |
|
|
|
407 | iterrevisions(), linkrev, weakref.proxy(tr), addrevisioncb=onchangeset | |
|
411 | cl.addgroup( | |
|
412 | iterrevisions(), | |
|
413 | linkrev, | |
|
414 | weakref.proxy(tr), | |
|
415 | addrevisioncb=onchangeset, | |
|
416 | duplicaterevisioncb=ondupchangeset, | |
|
408 | 417 | ) |
|
409 | 418 | |
|
410 | 419 | progress.complete() |
@@ -516,12 +525,15 b' def _fetchmanifests(repo, tr, remote, ma' | |||
|
516 | 525 | # Chomp off header object. |
|
517 | 526 | next(objs) |
|
518 | 527 | |
|
519 | added.extend( | |
|
520 | rootmanifest.addgroup( | |
|
521 | iterrevisions(objs, progress), | |
|
522 | linkrevs.__getitem__, | |
|
523 | weakref.proxy(tr), | |
|
524 | ) | |
|
528 | def onchangeset(cl, node): | |
|
529 | added.append(node) | |
|
530 | ||
|
531 | rootmanifest.addgroup( | |
|
532 | iterrevisions(objs, progress), | |
|
533 | linkrevs.__getitem__, | |
|
534 | weakref.proxy(tr), | |
|
535 | addrevisioncb=onchangeset, | |
|
536 | duplicaterevisioncb=onchangeset, | |
|
525 | 537 | ) |
|
526 | 538 | |
|
527 | 539 | progress.complete() |
@@ -139,6 +139,7 b' class filelog(object):' | |||
|
139 | 139 | linkmapper, |
|
140 | 140 | transaction, |
|
141 | 141 | addrevisioncb=None, |
|
142 | duplicaterevisioncb=None, | |
|
142 | 143 | maybemissingparents=False, |
|
143 | 144 | ): |
|
144 | 145 | if maybemissingparents: |
@@ -150,7 +151,11 b' class filelog(object):' | |||
|
150 | 151 | ) |
|
151 | 152 | |
|
152 | 153 | return self._revlog.addgroup( |
|
153 | deltas, linkmapper, transaction, addrevisioncb=addrevisioncb | |
|
154 | deltas, | |
|
155 | linkmapper, | |
|
156 | transaction, | |
|
157 | addrevisioncb=addrevisioncb, | |
|
158 | duplicaterevisioncb=duplicaterevisioncb, | |
|
154 | 159 | ) |
|
155 | 160 | |
|
156 | 161 | def getstrippoint(self, minlink): |
@@ -756,6 +756,7 b' class ifilemutation(interfaceutil.Interf' | |||
|
756 | 756 | linkmapper, |
|
757 | 757 | transaction, |
|
758 | 758 | addrevisioncb=None, |
|
759 | duplicaterevisioncb=None, | |
|
759 | 760 | maybemissingparents=False, |
|
760 | 761 | ): |
|
761 | 762 | """Process a series of deltas for storage. |
@@ -1247,7 +1248,13 b' class imanifeststorage(interfaceutil.Int' | |||
|
1247 | 1248 | See the documentation for ``ifiledata`` for more. |
|
1248 | 1249 | """ |
|
1249 | 1250 | |
|
1250 | def addgroup(deltas, linkmapper, transaction, addrevisioncb=None): | |
|
1251 | def addgroup( | |
|
1252 | deltas, | |
|
1253 | linkmapper, | |
|
1254 | transaction, | |
|
1255 | addrevisioncb=None, | |
|
1256 | duplicaterevisioncb=None, | |
|
1257 | ): | |
|
1251 | 1258 | """Process a series of deltas for storage. |
|
1252 | 1259 | |
|
1253 | 1260 | See the documentation in ``ifilemutation`` for more. |
@@ -1832,9 +1832,20 b' class manifestrevlog(object):' | |||
|
1832 | 1832 | deltamode=deltamode, |
|
1833 | 1833 | ) |
|
1834 | 1834 | |
|
1835 | def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None): | |
|
1835 | def addgroup( | |
|
1836 | self, | |
|
1837 | deltas, | |
|
1838 | linkmapper, | |
|
1839 | transaction, | |
|
1840 | addrevisioncb=None, | |
|
1841 | duplicaterevisioncb=None, | |
|
1842 | ): | |
|
1836 | 1843 | return self._revlog.addgroup( |
|
1837 | deltas, linkmapper, transaction, addrevisioncb=addrevisioncb | |
|
1844 | deltas, | |
|
1845 | linkmapper, | |
|
1846 | transaction, | |
|
1847 | addrevisioncb=addrevisioncb, | |
|
1848 | duplicaterevisioncb=duplicaterevisioncb, | |
|
1838 | 1849 | ) |
|
1839 | 1850 | |
|
1840 | 1851 | def rawsize(self, rev): |
@@ -2368,7 +2368,14 b' class revlog(object):' | |||
|
2368 | 2368 | self._enforceinlinesize(transaction, ifh) |
|
2369 | 2369 | nodemaputil.setup_persistent_nodemap(transaction, self) |
|
2370 | 2370 | |
|
2371 | def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None): | |
|
2371 | def addgroup( | |
|
2372 | self, | |
|
2373 | deltas, | |
|
2374 | linkmapper, | |
|
2375 | transaction, | |
|
2376 | addrevisioncb=None, | |
|
2377 | duplicaterevisioncb=None, | |
|
2378 | ): | |
|
2372 | 2379 | """ |
|
2373 | 2380 | add a delta group |
|
2374 | 2381 | |
@@ -2383,8 +2390,6 b' class revlog(object):' | |||
|
2383 | 2390 | if self._writinghandles: |
|
2384 | 2391 | raise error.ProgrammingError(b'cannot nest addgroup() calls') |
|
2385 | 2392 | |
|
2386 | nodes = [] | |
|
2387 | ||
|
2388 | 2393 | r = len(self) |
|
2389 | 2394 | end = 0 |
|
2390 | 2395 | if r: |
@@ -2405,6 +2410,7 b' class revlog(object):' | |||
|
2405 | 2410 | ifh.flush() |
|
2406 | 2411 | |
|
2407 | 2412 | self._writinghandles = (ifh, dfh) |
|
2413 | empty = True | |
|
2408 | 2414 | |
|
2409 | 2415 | try: |
|
2410 | 2416 | deltacomputer = deltautil.deltacomputer(self) |
@@ -2414,11 +2420,12 b' class revlog(object):' | |||
|
2414 | 2420 | link = linkmapper(linknode) |
|
2415 | 2421 | flags = flags or REVIDX_DEFAULT_FLAGS |
|
2416 | 2422 | |
|
2417 | nodes.append(node) | |
|
2418 | ||
|
2419 | 2423 | if self.index.has_node(node): |
|
2424 | # this can happen if two branches make the same change | |
|
2420 | 2425 | self._nodeduplicatecallback(transaction, node) |
|
2421 | # this can happen if two branches make the same change | |
|
2426 | if duplicaterevisioncb: | |
|
2427 | duplicaterevisioncb(self, node) | |
|
2428 | empty = False | |
|
2422 | 2429 | continue |
|
2423 | 2430 | |
|
2424 | 2431 | for p in (p1, p2): |
@@ -2472,6 +2479,7 b' class revlog(object):' | |||
|
2472 | 2479 | |
|
2473 | 2480 | if addrevisioncb: |
|
2474 | 2481 | addrevisioncb(self, node) |
|
2482 | empty = False | |
|
2475 | 2483 | |
|
2476 | 2484 | if not dfh and not self._inline: |
|
2477 | 2485 | # addrevision switched from inline to conventional |
@@ -2486,8 +2494,7 b' class revlog(object):' | |||
|
2486 | 2494 | if dfh: |
|
2487 | 2495 | dfh.close() |
|
2488 | 2496 | ifh.close() |
|
2489 | ||
|
2490 | return nodes | |
|
2497 | return not empty | |
|
2491 | 2498 | |
|
2492 | 2499 | def iscensored(self, rev): |
|
2493 | 2500 | """Check if a file revision is censored.""" |
@@ -1117,7 +1117,22 b' class ifilemutationtests(basetestcase):' | |||
|
1117 | 1117 | return 0 |
|
1118 | 1118 | |
|
1119 | 1119 | with self._maketransactionfn() as tr: |
|
1120 | nodes = f.addgroup([], None, tr, addrevisioncb=cb) | |
|
1120 | nodes = [] | |
|
1121 | ||
|
1122 | def onchangeset(cl, node): | |
|
1123 | nodes.append(node) | |
|
1124 | cb(cl, node) | |
|
1125 | ||
|
1126 | def ondupchangeset(cl, node): | |
|
1127 | nodes.append(node) | |
|
1128 | ||
|
1129 | f.addgroup( | |
|
1130 | [], | |
|
1131 | None, | |
|
1132 | tr, | |
|
1133 | addrevisioncb=onchangeset, | |
|
1134 | duplicaterevisioncb=ondupchangeset, | |
|
1135 | ) | |
|
1121 | 1136 | |
|
1122 | 1137 | self.assertEqual(nodes, []) |
|
1123 | 1138 | self.assertEqual(callbackargs, []) |
@@ -1136,7 +1151,22 b' class ifilemutationtests(basetestcase):' | |||
|
1136 | 1151 | ] |
|
1137 | 1152 | |
|
1138 | 1153 | with self._maketransactionfn() as tr: |
|
1139 | nodes = f.addgroup(deltas, linkmapper, tr, addrevisioncb=cb) | |
|
1154 | nodes = [] | |
|
1155 | ||
|
1156 | def onchangeset(cl, node): | |
|
1157 | nodes.append(node) | |
|
1158 | cb(cl, node) | |
|
1159 | ||
|
1160 | def ondupchangeset(cl, node): | |
|
1161 | nodes.append(node) | |
|
1162 | ||
|
1163 | f.addgroup( | |
|
1164 | deltas, | |
|
1165 | linkmapper, | |
|
1166 | tr, | |
|
1167 | addrevisioncb=onchangeset, | |
|
1168 | duplicaterevisioncb=ondupchangeset, | |
|
1169 | ) | |
|
1140 | 1170 | |
|
1141 | 1171 | self.assertEqual( |
|
1142 | 1172 | nodes, |
@@ -1175,7 +1205,19 b' class ifilemutationtests(basetestcase):' | |||
|
1175 | 1205 | deltas.append((nodes[i], nullid, nullid, nullid, nullid, delta, 0)) |
|
1176 | 1206 | |
|
1177 | 1207 | with self._maketransactionfn() as tr: |
|
1178 | self.assertEqual(f.addgroup(deltas, lambda x: 0, tr), nodes) | |
|
1208 | newnodes = [] | |
|
1209 | ||
|
1210 | def onchangeset(cl, node): | |
|
1211 | newnodes.append(node) | |
|
1212 | ||
|
1213 | f.addgroup( | |
|
1214 | deltas, | |
|
1215 | lambda x: 0, | |
|
1216 | tr, | |
|
1217 | addrevisioncb=onchangeset, | |
|
1218 | duplicaterevisioncb=onchangeset, | |
|
1219 | ) | |
|
1220 | self.assertEqual(newnodes, nodes) | |
|
1179 | 1221 | |
|
1180 | 1222 | self.assertEqual(len(f), len(deltas)) |
|
1181 | 1223 | self.assertEqual(list(f.revs()), [0, 1, 2]) |
@@ -129,6 +129,7 b' class unionrevlog(revlog.revlog):' | |||
|
129 | 129 | linkmapper, |
|
130 | 130 | transaction, |
|
131 | 131 | addrevisioncb=None, |
|
132 | duplicaterevisioncb=None, | |
|
132 | 133 | maybemissingparents=False, |
|
133 | 134 | ): |
|
134 | 135 | raise NotImplementedError |
@@ -532,6 +532,7 b' class filestorage(object):' | |||
|
532 | 532 | linkmapper, |
|
533 | 533 | transaction, |
|
534 | 534 | addrevisioncb=None, |
|
535 | duplicaterevisioncb=None, | |
|
535 | 536 | maybemissingparents=False, |
|
536 | 537 | ): |
|
537 | 538 | if maybemissingparents: |
@@ -539,7 +540,7 b' class filestorage(object):' | |||
|
539 | 540 | _('simple store does not support missing parents ' 'write mode') |
|
540 | 541 | ) |
|
541 | 542 | |
|
542 |
|
|
|
543 | empty = True | |
|
543 | 544 | |
|
544 | 545 | transaction.addbackup(self._indexpath) |
|
545 | 546 | |
@@ -547,9 +548,10 b' class filestorage(object):' | |||
|
547 | 548 | linkrev = linkmapper(linknode) |
|
548 | 549 | flags = flags or revlog.REVIDX_DEFAULT_FLAGS |
|
549 | 550 | |
|
550 | nodes.append(node) | |
|
551 | ||
|
552 | 551 | if node in self._indexbynode: |
|
552 | if duplicaterevisioncb: | |
|
553 | duplicaterevisioncb(self, node) | |
|
554 | empty = False | |
|
553 | 555 | continue |
|
554 | 556 | |
|
555 | 557 | # Need to resolve the fulltext from the delta base. |
@@ -564,7 +566,8 b' class filestorage(object):' | |||
|
564 | 566 | |
|
565 | 567 | if addrevisioncb: |
|
566 | 568 | addrevisioncb(self, node) |
|
567 | return nodes | |
|
569 | empty = False | |
|
570 | return not empty | |
|
568 | 571 | |
|
569 | 572 | def _headrevs(self): |
|
570 | 573 | # Assume all revisions are heads by default. |
General Comments 0
You need to be logged in to leave comments.
Login now