##// END OF EJS Templates
revert: extract origvfs logic in a sub-function...
Boris Feld -
r40783:65591a51 default
parent child Browse files
Show More
@@ -814,21 +814,29 b' def parsefollowlinespattern(repo, rev, p'
814 814 raise error.ParseError(msg)
815 815 return files[0]
816 816
817 def getorigvfs(ui, repo):
818 """return a vfs suitable to save 'orig' file
819
820 return None if no special directory is configured"""
821 origbackuppath = ui.config('ui', 'origbackuppath')
822 if not origbackuppath:
823 return None
824 return vfs.vfs(repo.wvfs.join(origbackuppath))
825
817 826 def origpath(ui, repo, filepath):
818 827 '''customize where .orig files are created
819 828
820 829 Fetch user defined path from config file: [ui] origbackuppath = <path>
821 830 Fall back to default (filepath with .orig suffix) if not specified
822 831 '''
823 origbackuppath = ui.config('ui', 'origbackuppath')
824 if not origbackuppath:
832 origvfs = getorigvfs(ui, repo)
833 if origvfs is None:
825 834 return filepath + ".orig"
826 835
827 836 # Convert filepath from an absolute path into a path inside the repo.
828 837 filepathfromroot = util.normpath(os.path.relpath(filepath,
829 838 start=repo.root))
830 839
831 origvfs = vfs.vfs(repo.wjoin(origbackuppath))
832 840 origbackupdir = origvfs.dirname(filepathfromroot)
833 841 if not origvfs.isdir(origbackupdir) or origvfs.islink(origbackupdir):
834 842 ui.note(_('creating directory: %s\n') % origvfs.join(origbackupdir))
General Comments 0
You need to be logged in to leave comments. Login now