##// END OF EJS Templates
filemerge: fix backing up an in-memory file to a custom location...
Phil Cohen -
r35720:c0439e11 default
parent child Browse files
Show More
@@ -618,6 +618,9 b' def _makebackup(repo, ui, wctx, fcd, pre'
618 618 (if any), the backup is used to undo certain premerges, confirm whether a
619 619 merge changed anything, and determine what line endings the new file should
620 620 have.
621
622 Backups only need to be written once (right before the premerge) since their
623 content doesn't change afterwards.
621 624 """
622 625 if fcd.isabsent():
623 626 return None
@@ -628,7 +631,6 b' def _makebackup(repo, ui, wctx, fcd, pre'
628 631 back = scmutil.origpath(ui, repo, a)
629 632 inworkingdir = (back.startswith(repo.wvfs.base) and not
630 633 back.startswith(repo.vfs.base))
631
632 634 if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
633 635 # If the backup file is to be in the working directory, and we're
634 636 # merging in-memory, we must redirect the backup to the memory context
@@ -637,12 +639,17 b' def _makebackup(repo, ui, wctx, fcd, pre'
637 639 wctx[relpath].write(fcd.data(), fcd.flags())
638 640 return wctx[relpath]
639 641 else:
640 # Otherwise, write to wherever the user specified the backups should go.
641 #
642 if premerge:
643 # Otherwise, write to wherever path the user specified the backups
644 # should go. We still need to switch based on whether the source is
645 # in-memory so we can use the fast path of ``util.copy`` if both are
646 # on disk.
647 if isinstance(fcd, context.overlayworkingfilectx):
648 util.writefile(back, fcd.data())
649 else:
650 util.copyfile(a, back)
642 651 # A arbitraryfilectx is returned, so we can run the same functions on
643 652 # the backup context regardless of where it lives.
644 if premerge:
645 util.copyfile(a, back)
646 653 return context.arbitraryfilectx(back, repo=repo)
647 654
648 655 def _maketempfiles(repo, fco, fca):
General Comments 0
You need to be logged in to leave comments. Login now