Show More
@@ -873,41 +873,6 b' def backuppath(ui, repo, filepath):' | |||||
873 |
|
873 | |||
874 | return origvfs.join(filepath) |
|
874 | return origvfs.join(filepath) | |
875 |
|
875 | |||
876 | def origpath(ui, repo, filepath): |
|
|||
877 | '''customize where .orig files are created |
|
|||
878 |
|
||||
879 | Fetch user defined path from config file: [ui] origbackuppath = <path> |
|
|||
880 | Fall back to default (filepath with .orig suffix) if not specified |
|
|||
881 | ''' |
|
|||
882 | origvfs = getorigvfs(ui, repo) |
|
|||
883 | if origvfs is None: |
|
|||
884 | return filepath + ".orig" |
|
|||
885 |
|
||||
886 | # Convert filepath from an absolute path into a path inside the repo. |
|
|||
887 | filepathfromroot = util.normpath(os.path.relpath(filepath, |
|
|||
888 | start=repo.root)) |
|
|||
889 |
|
||||
890 | origbackupdir = origvfs.dirname(filepathfromroot) |
|
|||
891 | if not origvfs.isdir(origbackupdir) or origvfs.islink(origbackupdir): |
|
|||
892 | ui.note(_('creating directory: %s\n') % origvfs.join(origbackupdir)) |
|
|||
893 |
|
||||
894 | # Remove any files that conflict with the backup file's path |
|
|||
895 | for f in reversed(list(util.finddirs(filepathfromroot))): |
|
|||
896 | if origvfs.isfileorlink(f): |
|
|||
897 | ui.note(_('removing conflicting file: %s\n') |
|
|||
898 | % origvfs.join(f)) |
|
|||
899 | origvfs.unlink(f) |
|
|||
900 | break |
|
|||
901 |
|
||||
902 | origvfs.makedirs(origbackupdir) |
|
|||
903 |
|
||||
904 | if origvfs.isdir(filepathfromroot) and not origvfs.islink(filepathfromroot): |
|
|||
905 | ui.note(_('removing conflicting directory: %s\n') |
|
|||
906 | % origvfs.join(filepathfromroot)) |
|
|||
907 | origvfs.rmtree(filepathfromroot, forcibly=True) |
|
|||
908 |
|
||||
909 | return origvfs.join(filepathfromroot) |
|
|||
910 |
|
||||
911 | class _containsnode(object): |
|
876 | class _containsnode(object): | |
912 | """proxy __contains__(node) to container.__contains__ which accepts revs""" |
|
877 | """proxy __contains__(node) to container.__contains__ which accepts revs""" | |
913 |
|
878 |
General Comments 0
You need to be logged in to leave comments.
Login now