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