comparison mercurial/filemerge.py @ 35703:9a50ffd15b25

filemerge: only write in-memory backup during premerge This wasn't broken, but should mirror the non-in memory case to save an extra write. Differential Revision: https://phab.mercurial-scm.org/D1807
author Phil Cohen <phillco@fb.com>
date Thu, 04 Jan 2018 21:37:03 -0800
parents c0439e11af16
children c87926ebe096
comparison
equal deleted inserted replaced
35702:c0439e11af16 35703:9a50ffd15b25
634 if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir: 634 if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
635 # If the backup file is to be in the working directory, and we're 635 # If the backup file is to be in the working directory, and we're
636 # merging in-memory, we must redirect the backup to the memory context 636 # merging in-memory, we must redirect the backup to the memory context
637 # so we don't disturb the working directory. 637 # so we don't disturb the working directory.
638 relpath = back[len(repo.wvfs.base) + 1:] 638 relpath = back[len(repo.wvfs.base) + 1:]
639 wctx[relpath].write(fcd.data(), fcd.flags()) 639 if premerge:
640 wctx[relpath].write(fcd.data(), fcd.flags())
640 return wctx[relpath] 641 return wctx[relpath]
641 else: 642 else:
642 if premerge: 643 if premerge:
643 # Otherwise, write to wherever path the user specified the backups 644 # 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 # should go. We still need to switch based on whether the source is