mercurial/filemerge.py
changeset 41600 a8ccd821b7d2
parent 41510 faa49a5914bb
child 42565 4764e8436b2a
equal deleted inserted replaced
41599:106b0bec162a 41600:a8ccd821b7d2
   741     if fcd.isabsent():
   741     if fcd.isabsent():
   742         return None
   742         return None
   743     # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
   743     # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
   744     # merge -> filemerge). (I suspect the fileset import is the weakest link)
   744     # merge -> filemerge). (I suspect the fileset import is the weakest link)
   745     from . import context
   745     from . import context
   746     a = _workingpath(repo, fcd)
   746     back = scmutil.backuppath(ui, repo, fcd.path())
   747     back = scmutil.origpath(ui, repo, a)
       
   748     inworkingdir = (back.startswith(repo.wvfs.base) and not
   747     inworkingdir = (back.startswith(repo.wvfs.base) and not
   749         back.startswith(repo.vfs.base))
   748         back.startswith(repo.vfs.base))
   750     if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
   749     if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
   751         # If the backup file is to be in the working directory, and we're
   750         # If the backup file is to be in the working directory, and we're
   752         # merging in-memory, we must redirect the backup to the memory context
   751         # merging in-memory, we must redirect the backup to the memory context
   762             # in-memory so we can use the fast path of ``util.copy`` if both are
   761             # in-memory so we can use the fast path of ``util.copy`` if both are
   763             # on disk.
   762             # on disk.
   764             if isinstance(fcd, context.overlayworkingfilectx):
   763             if isinstance(fcd, context.overlayworkingfilectx):
   765                 util.writefile(back, fcd.data())
   764                 util.writefile(back, fcd.data())
   766             else:
   765             else:
       
   766                 a = _workingpath(repo, fcd)
   767                 util.copyfile(a, back)
   767                 util.copyfile(a, back)
   768         # A arbitraryfilectx is returned, so we can run the same functions on
   768         # A arbitraryfilectx is returned, so we can run the same functions on
   769         # the backup context regardless of where it lives.
   769         # the backup context regardless of where it lives.
   770         return context.arbitraryfilectx(back, repo=repo)
   770         return context.arbitraryfilectx(back, repo=repo)
   771 
   771