comparison mercurial/scmutil.py @ 34146:9e4f82bc2b0b

scmutil: don't append .orig to backups in origbackuppath (BC) When ui.origbackuppath is set, .orig files are stored outside of the working copy, however they still have a .orig suffix appended to them. This can cause unexpected conflicts, particularly when tracked files or directories have .orig at the end. This change removes the .orig suffix from files stored in an out-of-tree origbackuppath. Test Plan: Update and run unit tests. Differential Revision: https://phab.mercurial-scm.org/D679
author Mark Thomas <mbthomas@fb.com>
date Mon, 11 Sep 2017 17:49:49 +0000
parents d5b2beca16c0
children 4647e0a8d3d7
comparison
equal deleted inserted replaced
34142:24bf823377fc 34146:9e4f82bc2b0b
551 551
552 def origpath(ui, repo, filepath): 552 def origpath(ui, repo, filepath):
553 '''customize where .orig files are created 553 '''customize where .orig files are created
554 554
555 Fetch user defined path from config file: [ui] origbackuppath = <path> 555 Fetch user defined path from config file: [ui] origbackuppath = <path>
556 Fall back to default (filepath) if not specified 556 Fall back to default (filepath with .orig suffix) if not specified
557 ''' 557 '''
558 origbackuppath = ui.config('ui', 'origbackuppath') 558 origbackuppath = ui.config('ui', 'origbackuppath')
559 if origbackuppath is None: 559 if origbackuppath is None:
560 return filepath + ".orig" 560 return filepath + ".orig"
561 561
565 origbackupdir = repo.vfs.dirname(fullorigpath) 565 origbackupdir = repo.vfs.dirname(fullorigpath)
566 if not repo.vfs.exists(origbackupdir): 566 if not repo.vfs.exists(origbackupdir):
567 ui.note(_('creating directory: %s\n') % origbackupdir) 567 ui.note(_('creating directory: %s\n') % origbackupdir)
568 util.makedirs(origbackupdir) 568 util.makedirs(origbackupdir)
569 569
570 return fullorigpath + ".orig" 570 return fullorigpath
571 571
572 class _containsnode(object): 572 class _containsnode(object):
573 """proxy __contains__(node) to container.__contains__ which accepts revs""" 573 """proxy __contains__(node) to container.__contains__ which accepts revs"""
574 574
575 def __init__(self, repo, revcontainer): 575 def __init__(self, repo, revcontainer):