Show More
@@ -606,9 +606,24 b' def _makebackup(repo, ui, wctx, fcd, pre' | |||||
606 | from . import context |
|
606 | from . import context | |
607 | a = _workingpath(repo, fcd) |
|
607 | a = _workingpath(repo, fcd) | |
608 | back = scmutil.origpath(ui, repo, a) |
|
608 | back = scmutil.origpath(ui, repo, a) | |
609 | if premerge: |
|
609 | inworkingdir = (back.startswith(repo.wvfs.base) and not | |
610 | util.copyfile(a, back) |
|
610 | back.startswith(repo.vfs.base)) | |
611 | return context.arbitraryfilectx(back, repo=repo) |
|
611 | ||
|
612 | if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir: | |||
|
613 | # If the backup file is to be in the working directory, and we're | |||
|
614 | # merging in-memory, we must redirect the backup to the memory context | |||
|
615 | # so we don't disturb the working directory. | |||
|
616 | relpath = back[len(repo.wvfs.base) + 1:] | |||
|
617 | wctx[relpath].write(fcd.data(), fcd.flags()) | |||
|
618 | return wctx[relpath] | |||
|
619 | else: | |||
|
620 | # Otherwise, write to wherever the user specified the backups should go. | |||
|
621 | # | |||
|
622 | # A arbitraryfilectx is returned, so we can run the same functions on | |||
|
623 | # the backup context regardless of where it lives. | |||
|
624 | if premerge: | |||
|
625 | util.copyfile(a, back) | |||
|
626 | return context.arbitraryfilectx(back, repo=repo) | |||
612 |
|
627 | |||
613 | def _maketempfiles(repo, fco, fca): |
|
628 | def _maketempfiles(repo, fco, fca): | |
614 | """Writes out `fco` and `fca` as temporary files, so an external merge |
|
629 | """Writes out `fco` and `fca` as temporary files, so an external merge |
General Comments 0
You need to be logged in to leave comments.
Login now