Show More
@@ -444,9 +444,9 b' def updatelfiles(ui, repo, filelist=None' | |||
|
444 | 444 | updated, removed = 0, 0 |
|
445 | 445 | for lfile in lfiles: |
|
446 | 446 | abslfile = repo.wjoin(lfile) |
|
447 |
abslfileorig = cm |
|
|
447 | abslfileorig = scmutil.origpath(ui, repo, abslfile) | |
|
448 | 448 | absstandin = repo.wjoin(lfutil.standin(lfile)) |
|
449 |
absstandinorig = cm |
|
|
449 | absstandinorig = scmutil.origpath(ui, repo, absstandin) | |
|
450 | 450 | if os.path.exists(absstandin): |
|
451 | 451 | if (os.path.exists(absstandinorig) and |
|
452 | 452 | os.path.exists(abslfile)): |
@@ -700,9 +700,9 b' class queue(object):' | |||
|
700 | 700 | absf = repo.wjoin(f) |
|
701 | 701 | if os.path.lexists(absf): |
|
702 | 702 | self.ui.note(_('saving current version of %s as %s\n') % |
|
703 |
(f, cm |
|
|
704 | ||
|
705 |
absorig = cm |
|
|
703 | (f, scmutil.origpath(self.ui, repo, f))) | |
|
704 | ||
|
705 | absorig = scmutil.origpath(self.ui, repo, absf) | |
|
706 | 706 | if copy: |
|
707 | 707 | util.copyfile(absf, absorig) |
|
708 | 708 | else: |
@@ -512,7 +512,7 b' def mergefiles(ui, repo, wctx, shelvectx' | |||
|
512 | 512 | # revert will overwrite unknown files, so move them out of the way |
|
513 | 513 | for file in repo.status(unknown=True).unknown: |
|
514 | 514 | if file in files: |
|
515 |
util.rename(file, cm |
|
|
515 | util.rename(file, scmutil.origpath(ui, repo, file)) | |
|
516 | 516 | ui.pushbuffer(True) |
|
517 | 517 | cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(), |
|
518 | 518 | *pathtofiles(repo, files), |
@@ -3098,7 +3098,7 b' def revert(ui, repo, ctx, parents, *pats' | |||
|
3098 | 3098 | xlist.append(abs) |
|
3099 | 3099 | if dobackup and (backup <= dobackup |
|
3100 | 3100 | or wctx[abs].cmp(ctx[abs])): |
|
3101 | bakname = origpath(ui, repo, rel) | |
|
3101 | bakname = scmutil.origpath(ui, repo, rel) | |
|
3102 | 3102 | ui.note(_('saving current version of %s as %s\n') % |
|
3103 | 3103 | (rel, bakname)) |
|
3104 | 3104 | if not opts.get('dry_run'): |
@@ -3130,26 +3130,6 b' def revert(ui, repo, ctx, parents, *pats' | |||
|
3130 | 3130 | finally: |
|
3131 | 3131 | wlock.release() |
|
3132 | 3132 | |
|
3133 | def origpath(ui, repo, filepath): | |
|
3134 | '''customize where .orig files are created | |
|
3135 | ||
|
3136 | Fetch user defined path from config file: [ui] origbackuppath = <path> | |
|
3137 | Fall back to default (filepath) if not specified | |
|
3138 | ''' | |
|
3139 | origbackuppath = ui.config('ui', 'origbackuppath', None) | |
|
3140 | if origbackuppath is None: | |
|
3141 | return filepath + ".orig" | |
|
3142 | ||
|
3143 | filepathfromroot = os.path.relpath(filepath, start=repo.root) | |
|
3144 | fullorigpath = repo.wjoin(origbackuppath, filepathfromroot) | |
|
3145 | ||
|
3146 | origbackupdir = repo.vfs.dirname(fullorigpath) | |
|
3147 | if not repo.vfs.exists(origbackupdir): | |
|
3148 | ui.note(_('creating directory: %s\n') % origbackupdir) | |
|
3149 | util.makedirs(origbackupdir) | |
|
3150 | ||
|
3151 | return fullorigpath + ".orig" | |
|
3152 | ||
|
3153 | 3133 | def _revertprefetch(repo, ctx, *files): |
|
3154 | 3134 | """Let extension changing the storage layer prefetch content""" |
|
3155 | 3135 | pass |
@@ -5953,7 +5953,7 b' def resolve(ui, repo, *pats, **opts):' | |||
|
5953 | 5953 | if complete: |
|
5954 | 5954 | try: |
|
5955 | 5955 | util.rename(a + ".resolve", |
|
5956 |
cm |
|
|
5956 | scmutil.origpath(ui, repo, a)) | |
|
5957 | 5957 | except OSError as inst: |
|
5958 | 5958 | if inst.errno != errno.ENOENT: |
|
5959 | 5959 | raise |
@@ -5973,7 +5973,7 b' def resolve(ui, repo, *pats, **opts):' | |||
|
5973 | 5973 | # replace filemerge's .orig file with our resolve file |
|
5974 | 5974 | a = repo.wjoin(f) |
|
5975 | 5975 | try: |
|
5976 |
util.rename(a + ".resolve", cm |
|
|
5976 | util.rename(a + ".resolve", scmutil.origpath(ui, repo, a)) | |
|
5977 | 5977 | except OSError as inst: |
|
5978 | 5978 | if inst.errno != errno.ENOENT: |
|
5979 | 5979 | raise |
@@ -16,9 +16,9 b' from .i18n import _' | |||
|
16 | 16 | from .node import nullid, short |
|
17 | 17 | |
|
18 | 18 | from . import ( |
|
19 | cmdutil, | |
|
20 | 19 | error, |
|
21 | 20 | match, |
|
21 | scmutil, | |
|
22 | 22 | simplemerge, |
|
23 | 23 | tagmerge, |
|
24 | 24 | templatekw, |
@@ -608,7 +608,7 b' def _filemerge(premerge, repo, mynode, o' | |||
|
608 | 608 | b = temp("base", fca) |
|
609 | 609 | c = temp("other", fco) |
|
610 | 610 | if not fcd.isabsent(): |
|
611 |
back = cm |
|
|
611 | back = scmutil.origpath(ui, repo, a) | |
|
612 | 612 | if premerge: |
|
613 | 613 | util.copyfile(a, back) |
|
614 | 614 | else: |
@@ -838,6 +838,26 b' def matchfiles(repo, files, badfn=None):' | |||
|
838 | 838 | '''Return a matcher that will efficiently match exactly these files.''' |
|
839 | 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 | 861 | def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None): |
|
842 | 862 | if opts is None: |
|
843 | 863 | opts = {} |
@@ -1910,7 +1910,7 b' class gitsubrepo(abstractsubrepo):' | |||
|
1910 | 1910 | status = self.status(None) |
|
1911 | 1911 | names = status.modified |
|
1912 | 1912 | for name in names: |
|
1913 |
bakname = cm |
|
|
1913 | bakname = scmutil.origpath(self.ui, self._subparent, name) | |
|
1914 | 1914 | self.ui.note(_('saving current version of %s as %s\n') % |
|
1915 | 1915 | (name, bakname)) |
|
1916 | 1916 | self.wvfs.rename(name, bakname) |
General Comments 0
You need to be logged in to leave comments.
Login now