mercurial/scmutil.py
changeset 27651 07fc2f2134ba
parent 27610 b8405d739149
child 27706 22e362da27cf
equal deleted inserted replaced
27650:e7222d326ea2 27651:07fc2f2134ba
   836 
   836 
   837 def matchfiles(repo, files, badfn=None):
   837 def matchfiles(repo, files, badfn=None):
   838     '''Return a matcher that will efficiently match exactly these files.'''
   838     '''Return a matcher that will efficiently match exactly these files.'''
   839     return matchmod.exact(repo.root, repo.getcwd(), files, badfn=badfn)
   839     return matchmod.exact(repo.root, repo.getcwd(), files, badfn=badfn)
   840 
   840 
       
   841 def origpath(ui, repo, filepath):
       
   842     '''customize where .orig files are created
       
   843 
       
   844     Fetch user defined path from config file: [ui] origbackuppath = <path>
       
   845     Fall back to default (filepath) if not specified
       
   846     '''
       
   847     origbackuppath = ui.config('ui', 'origbackuppath', None)
       
   848     if origbackuppath is None:
       
   849         return filepath + ".orig"
       
   850 
       
   851     filepathfromroot = os.path.relpath(filepath, start=repo.root)
       
   852     fullorigpath = repo.wjoin(origbackuppath, filepathfromroot)
       
   853 
       
   854     origbackupdir = repo.vfs.dirname(fullorigpath)
       
   855     if not repo.vfs.exists(origbackupdir):
       
   856         ui.note(_('creating directory: %s\n') % origbackupdir)
       
   857         util.makedirs(origbackupdir)
       
   858 
       
   859     return fullorigpath + ".orig"
       
   860 
   841 def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None):
   861 def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None):
   842     if opts is None:
   862     if opts is None:
   843         opts = {}
   863         opts = {}
   844     m = matcher
   864     m = matcher
   845     if dry_run is None:
   865     if dry_run is None: