##// END OF EJS Templates
cmdutil: add origbackuppath helper
Christian Delahousse -
r26937:dda0aa3b default
parent child Browse files
Show More
@@ -3114,6 +3114,26 def revert(ui, repo, ctx, parents, *pats
3114 3114 finally:
3115 3115 wlock.release()
3116 3116
3117 def origpath(ui, repo, filepath):
3118 '''customize where .orig files are created
3119
3120 Fetch user defined path from config file: [ui] origbackuppath = <path>
3121 Fall back to default (filepath) if not specified
3122 '''
3123 origbackuppath = ui.config('ui', 'origbackuppath', None)
3124 if origbackuppath is None:
3125 return filepath + ".orig"
3126
3127 filepathfromroot = os.path.relpath(filepath, start=repo.root)
3128 fullorigpath = repo.wjoin(origbackuppath, filepathfromroot)
3129
3130 origbackupdir = repo.vfs.dirname(fullorigpath)
3131 if not repo.vfs.exists(origbackupdir):
3132 ui.note(_('creating directory: %s\n') % origbackupdir)
3133 util.makedirs(origbackupdir)
3134
3135 return fullorigpath + ".orig"
3136
3117 3137 def _revertprefetch(repo, ctx, *files):
3118 3138 """Let extension changing the storage layer prefetch content"""
3119 3139 pass
@@ -1496,6 +1496,10 User interface controls.
1496 1496 markers is different from the encoding of the merged files,
1497 1497 serious problems may occur.
1498 1498
1499 ``origbackuppath``
1500 The path to a directory used to store generated .orig files. If the path is
1501 not a directory, one will be created.
1502
1499 1503 ``patch``
1500 1504 An optional external tool that ``hg import`` and some extensions
1501 1505 will use for applying patches. By default Mercurial uses an
General Comments 0
You need to be logged in to leave comments. Login now