Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 26937:dda0aa3baedd
cmdutil: add origbackuppath helper
author | Christian Delahousse <cdelahousse@fb.com> |
---|---|
date | Thu, 12 Nov 2015 16:56:06 -0600 |
parents | 1aee2ab0f902 |
children | 080276d377d9 |
comparison
equal
deleted
inserted
replaced
26936:d47ac02fcefa | 26937:dda0aa3baedd |
---|---|
3112 raise error.Abort("subrepository '%s' does not exist in %s!" | 3112 raise error.Abort("subrepository '%s' does not exist in %s!" |
3113 % (sub, short(ctx.node()))) | 3113 % (sub, short(ctx.node()))) |
3114 finally: | 3114 finally: |
3115 wlock.release() | 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 def _revertprefetch(repo, ctx, *files): | 3137 def _revertprefetch(repo, ctx, *files): |
3118 """Let extension changing the storage layer prefetch content""" | 3138 """Let extension changing the storage layer prefetch content""" |
3119 pass | 3139 pass |
3120 | 3140 |
3121 def _performrevert(repo, parents, ctx, actions, interactive=False): | 3141 def _performrevert(repo, parents, ctx, actions, interactive=False): |