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