Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 27651:07fc2f2134ba
origpath: move from cmdutil to scmutil
This is a lower-level function so it doesn't need to be in cmdutil, and putting
it here avoids a bunch of potential import cycle issues.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sat, 02 Jan 2016 03:02:57 -0800 |
parents | b502138f5faa |
children | dad6404ccddb |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sun Nov 22 17:57:35 2015 -0800 +++ b/mercurial/cmdutil.py Sat Jan 02 03:02:57 2016 -0800 @@ -3098,7 +3098,7 @@ xlist.append(abs) if dobackup and (backup <= dobackup or wctx[abs].cmp(ctx[abs])): - bakname = origpath(ui, repo, rel) + bakname = scmutil.origpath(ui, repo, rel) ui.note(_('saving current version of %s as %s\n') % (rel, bakname)) if not opts.get('dry_run'): @@ -3130,26 +3130,6 @@ finally: wlock.release() -def origpath(ui, repo, filepath): - '''customize where .orig files are created - - Fetch user defined path from config file: [ui] origbackuppath = <path> - Fall back to default (filepath) if not specified - ''' - origbackuppath = ui.config('ui', 'origbackuppath', None) - if origbackuppath is None: - return filepath + ".orig" - - filepathfromroot = os.path.relpath(filepath, start=repo.root) - fullorigpath = repo.wjoin(origbackuppath, filepathfromroot) - - origbackupdir = repo.vfs.dirname(fullorigpath) - if not repo.vfs.exists(origbackupdir): - ui.note(_('creating directory: %s\n') % origbackupdir) - util.makedirs(origbackupdir) - - return fullorigpath + ".orig" - def _revertprefetch(repo, ctx, *files): """Let extension changing the storage layer prefetch content""" pass