##// END OF EJS Templates
largefiles: update standins only at the 1st commit of "hg rebase --continue"...
FUJIWARA Katsunori -
r23187:f726b05e default
parent child Browse files
Show More
@@ -447,8 +447,7 b' def updatestandinsbymatch(repo, match):'
447 # (2) aborting when standins are matched by "match",
447 # (2) aborting when standins are matched by "match",
448 # because automated committing may specify them directly
448 # because automated committing may specify them directly
449 #
449 #
450 if getattr(repo, "_isrebasing", False) or \
450 if getattr(repo, "_istransplanting", False):
451 getattr(repo, "_istransplanting", False):
452 return match
451 return match
453
452
454 # Case 1: user calls commit with no specific files or
453 # Case 1: user calls commit with no specific files or
@@ -537,3 +536,24 b' def updatestandinsbymatch(repo, match):'
537 match.matchfn = matchfn
536 match.matchfn = matchfn
538
537
539 return match
538 return match
539
540 class automatedcommithook(object):
541 '''Statefull hook to update standins at the 1st commit of resuming
542
543 For efficiency, updating standins in the working directory should
544 be avoided while automated committing (like rebase, transplant and
545 so on), because they should be updated before committing.
546
547 But the 1st commit of resuming automated committing (e.g. ``rebase
548 --continue``) should update them, because largefiles may be
549 modified manually.
550 '''
551 def __init__(self, resuming):
552 self.resuming = resuming
553
554 def __call__(self, repo, match):
555 if self.resuming:
556 self.resuming = False # avoids updating at subsequent commits
557 return updatestandinsbymatch(repo, match)
558 else:
559 return match
@@ -790,11 +790,14 b' def hgclone(orig, ui, opts, *args, **kwa'
790 return result
790 return result
791
791
792 def overriderebase(orig, ui, repo, **opts):
792 def overriderebase(orig, ui, repo, **opts):
793 resuming = opts.get('continue')
794 repo._lfcommithooks.append(lfutil.automatedcommithook(resuming))
793 repo._isrebasing = True
795 repo._isrebasing = True
794 try:
796 try:
795 return orig(ui, repo, **opts)
797 return orig(ui, repo, **opts)
796 finally:
798 finally:
797 repo._isrebasing = False
799 repo._isrebasing = False
800 repo._lfcommithooks.pop()
798
801
799 def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None,
802 def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None,
800 prefix=None, mtime=None, subrepos=None):
803 prefix=None, mtime=None, subrepos=None):
@@ -509,8 +509,25 b' it is aborted by conflict.'
509 $ cat large1
509 $ cat large1
510 large1 in #1
510 large1 in #1
511
511
512 $ hg rebase -q --abort
512 Test that rebase updates standins for manually modified largefiles at
513 rebase aborted
513 the 1st commit of resuming.
514
515 $ echo "manually modified before 'hg rebase --continue'" > large1
516 $ hg resolve -m normal1
517 (no more unresolved files)
518 $ hg rebase --continue --config ui.interactive=True <<EOF
519 > c
520 > EOF
521 local changed .hglf/large1 which remote deleted
522 use (c)hanged version or (d)elete? c
523
524 $ hg diff -c "tip~1" --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
525 -e5bb990443d6a92aaf7223813720f7566c9dd05b
526 +8a4f783556e7dea21139ca0466eafce954c75c13
527 $ rm -f large1
528 $ hg update -q -C tip
529 $ cat large1
530 manually modified before 'hg rebase --continue'
514
531
515 Test that transplant updates largefiles, of which standins are safely
532 Test that transplant updates largefiles, of which standins are safely
516 changed, even if it is aborted by conflict of other.
533 changed, even if it is aborted by conflict of other.
General Comments 0
You need to be logged in to leave comments. Login now