##// END OF EJS Templates
sidedatacopies: read rename information from sidedata...
marmoute -
r43416:0171483b default
parent child Browse files
Show More
@@ -362,6 +362,9 b' class changelogrevision(object):'
362 362
363 363 @property
364 364 def filesadded(self):
365 if sidedatamod.SD_FILESADDED in self._sidedata:
366 rawindices = self._sidedata.get(sidedatamod.SD_FILESADDED)
367 else:
365 368 rawindices = self.extra.get(b'filesadded')
366 369 if rawindices is None:
367 370 return None
@@ -369,6 +372,9 b' class changelogrevision(object):'
369 372
370 373 @property
371 374 def filesremoved(self):
375 if sidedatamod.SD_FILESREMOVED in self._sidedata:
376 rawindices = self._sidedata.get(sidedatamod.SD_FILESREMOVED)
377 else:
372 378 rawindices = self.extra.get(b'filesremoved')
373 379 if rawindices is None:
374 380 return None
@@ -376,6 +382,9 b' class changelogrevision(object):'
376 382
377 383 @property
378 384 def p1copies(self):
385 if sidedatamod.SD_P1COPIES in self._sidedata:
386 rawcopies = self._sidedata.get(sidedatamod.SD_P1COPIES)
387 else:
379 388 rawcopies = self.extra.get(b'p1copies')
380 389 if rawcopies is None:
381 390 return None
@@ -383,6 +392,9 b' class changelogrevision(object):'
383 392
384 393 @property
385 394 def p2copies(self):
395 if sidedatamod.SD_P2COPIES in self._sidedata:
396 rawcopies = self._sidedata.get(sidedatamod.SD_P2COPIES)
397 else:
386 398 rawcopies = self.extra.get(b'p2copies')
387 399 if rawcopies is None:
388 400 return None
@@ -533,55 +533,76 b' class changectx(basectx):'
533 533 return sorted(modified)
534 534
535 535 def filesadded(self):
536 filesadded = self._changeset.filesadded
537 compute_on_none = True
538 if self._repo.filecopiesmode == b'changeset-sidedata':
539 compute_on_none = False
540 else:
536 541 source = self._repo.ui.config(b'experimental', b'copies.read-from')
537 filesadded = self._changeset.filesadded
538 542 if source == b'changeset-only':
543 compute_on_none = False
544 elif source != b'compatibility':
545 # filelog mode, ignore any changelog content
546 filesadded = None
539 547 if filesadded is None:
540 filesadded = []
541 elif source == b'compatibility':
542 if filesadded is None:
548 if compute_on_none:
543 549 filesadded = scmutil.computechangesetfilesadded(self)
544 550 else:
545 filesadded = scmutil.computechangesetfilesadded(self)
551 filesadded = []
546 552 return filesadded
547 553
548 554 def filesremoved(self):
555 filesremoved = self._changeset.filesremoved
556 compute_on_none = True
557 if self._repo.filecopiesmode == b'changeset-sidedata':
558 compute_on_none = False
559 else:
549 560 source = self._repo.ui.config(b'experimental', b'copies.read-from')
550 filesremoved = self._changeset.filesremoved
551 561 if source == b'changeset-only':
562 compute_on_none = False
563 elif source != b'compatibility':
564 # filelog mode, ignore any changelog content
565 filesremoved = None
552 566 if filesremoved is None:
553 filesremoved = []
554 elif source == b'compatibility':
555 if filesremoved is None:
567 if compute_on_none:
556 568 filesremoved = scmutil.computechangesetfilesremoved(self)
557 569 else:
558 filesremoved = scmutil.computechangesetfilesremoved(self)
570 filesremoved = []
559 571 return filesremoved
560 572
561 573 @propertycache
562 574 def _copies(self):
563 source = self._repo.ui.config(b'experimental', b'copies.read-from')
564 575 p1copies = self._changeset.p1copies
565 576 p2copies = self._changeset.p2copies
566 # If config says to get copy metadata only from changeset, then return
567 # that, defaulting to {} if there was no copy metadata.
568 # In compatibility mode, we return copy data from the changeset if
569 # it was recorded there, and otherwise we fall back to getting it from
577 compute_on_none = True
578 if self._repo.filecopiesmode == b'changeset-sidedata':
579 compute_on_none = False
580 else:
581 source = self._repo.ui.config(b'experimental', b'copies.read-from')
582 # If config says to get copy metadata only from changeset, then
583 # return that, defaulting to {} if there was no copy metadata. In
584 # compatibility mode, we return copy data from the changeset if it
585 # was recorded there, and otherwise we fall back to getting it from
570 586 # the filelogs (below).
587 #
588 # If we are in compatiblity mode and there is not data in the
589 # changeset), we get the copy metadata from the filelogs.
590 #
591 # otherwise, when config said to read only from filelog, we get the
592 # copy metadata from the filelogs.
571 593 if source == b'changeset-only':
594 compute_on_none = False
595 elif source != b'compatibility':
596 # filelog mode, ignore any changelog content
597 p1copies = p2copies = None
598 if p1copies is None:
599 if compute_on_none:
600 p1copies, p2copies = super(changectx, self)._copies
601 else:
572 602 if p1copies is None:
573 603 p1copies = {}
574 604 if p2copies is None:
575 605 p2copies = {}
576 elif source == b'compatibility':
577 if p1copies is None:
578 # we are in compatiblity mode and there is not data in the
579 # changeset), we get the copy metadata from the filelogs.
580 p1copies, p2copies = super(changectx, self)._copies
581 else:
582 # config said to read only from filelog, we get the copy metadata
583 # from the filelogs.
584 p1copies, p2copies = super(changectx, self)._copies
585 606 return p1copies, p2copies
586 607
587 608 def description(self):
@@ -188,6 +188,8 b' def _computeforwardmissing(a, b, match=N'
188 188
189 189 def usechangesetcentricalgo(repo):
190 190 """Checks if we should use changeset-centric copy algorithms"""
191 if repo.filecopiesmode == b'changeset-sidedata':
192 return True
191 193 readfrom = repo.ui.config(b'experimental', b'copies.read-from')
192 194 changesetsource = (b'changeset-only', b'compatibility')
193 195 return readfrom in changesetsource
@@ -179,8 +179,8 b' the break.'
179 179 o 0 add x
180 180 x
181 181 $ hg debugpathcopies 0 5
182 x -> y (no-filelog no-sidedata !)
183 #if no-filelog no-sidedata
182 x -> y (no-filelog !)
183 #if no-filelog
184 184 $ hg graft -r 2
185 185 grafting 2:* "modify x again" (glob)
186 186 merging y and x to y
@@ -347,8 +347,8 b' different between the branches.'
347 347 o 0 base
348 348 a
349 349 $ hg debugpathcopies 1 5
350 x -> y (no-filelog no-sidedata !)
351 #if no-filelog no-sidedata
350 x -> y (no-filelog !)
351 #if no-filelog
352 352 $ hg graft -r 2
353 353 grafting 2:* "modify x" (glob)
354 354 merging y and x to y
@@ -309,7 +309,6 b" It's a little weird that it shows up on "
309 309 x -> z
310 310 $ hg debugpathcopies 0 2
311 311 x -> z (filelog !)
312 x -> z (sidedata !)
313 312
314 313 Copy file that exists on both sides of the merge, different content
315 314 $ newrepo
@@ -338,12 +337,14 b' Copy file that exists on both sides of t'
338 337 x
339 338 $ hg debugp1copies -r 2
340 339 x -> z (changeset !)
340 x -> z (sidedata !)
341 341 $ hg debugp2copies -r 2
342 x -> z (no-changeset !)
342 x -> z (no-changeset no-sidedata !)
343 343 $ hg debugpathcopies 1 2
344 344 x -> z (changeset !)
345 x -> z (sidedata !)
345 346 $ hg debugpathcopies 0 2
346 x -> z (no-changeset !)
347 x -> z (no-changeset no-sidedata !)
347 348
348 349 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent
349 350 of the merge to the merge should include the copy from the other side.
@@ -403,7 +404,7 b' Copy x to y on one side of merge, create'
403 404 $ hg debugpathcopies 2 3
404 405 y -> z
405 406 $ hg debugpathcopies 1 3
406 y -> z (no-filelog no-sidedata !)
407 y -> z (no-filelog !)
407 408
408 409 Create x and y, then rename x to z on one side of merge, and rename y to z and
409 410 modify z on the other side. When storing copies in the changeset, we don't
@@ -448,18 +449,16 b' Try merging the other direction too'
448 449 o 0 add x and y
449 450 x y
450 451 $ hg debugpathcopies 1 4
451 y -> z (no-filelog no-sidedata !)
452 y -> z (no-filelog !)
452 453 $ hg debugpathcopies 2 4
453 x -> z (no-filelog no-sidedata !)
454 x -> z (no-filelog !)
454 455 $ hg debugpathcopies 0 4
455 456 x -> z (filelog !)
456 x -> z (sidedata !)
457 y -> z (compatibility !)
458 y -> z (changeset !)
457 y -> z (no-filelog !)
459 458 $ hg debugpathcopies 1 5
460 y -> z (no-filelog no-sidedata !)
459 y -> z (no-filelog !)
461 460 $ hg debugpathcopies 2 5
462 x -> z (no-filelog no-sidedata !)
461 x -> z (no-filelog !)
463 462 $ hg debugpathcopies 0 5
464 463 x -> z
465 464
General Comments 0
You need to be logged in to leave comments. Login now