Show More
@@ -1010,10 +1010,14 b' def checksignature(func):' | |||||
1010 |
|
1010 | |||
1011 | return check |
|
1011 | return check | |
1012 |
|
1012 | |||
1013 | def copyfile(src, dest, hardlink=False, copystat=False): |
|
1013 | def copyfile(src, dest, hardlink=False, copystat=False, checkambig=False): | |
1014 | '''copy a file, preserving mode and optionally other stat info like |
|
1014 | '''copy a file, preserving mode and optionally other stat info like | |
1015 | atime/mtime''' |
|
1015 | atime/mtime''' | |
|
1016 | assert not (copystat and checkambig) | |||
|
1017 | oldstat = None | |||
1016 | if os.path.lexists(dest): |
|
1018 | if os.path.lexists(dest): | |
|
1019 | if checkambig: | |||
|
1020 | oldstat = checkambig and filestat(dest) | |||
1017 | unlink(dest) |
|
1021 | unlink(dest) | |
1018 | # hardlinks are problematic on CIFS, quietly ignore this flag |
|
1022 | # hardlinks are problematic on CIFS, quietly ignore this flag | |
1019 | # until we find a way to work around it cleanly (issue4546) |
|
1023 | # until we find a way to work around it cleanly (issue4546) | |
@@ -1035,6 +1039,12 b' def copyfile(src, dest, hardlink=False, ' | |||||
1035 | shutil.copystat(src, dest) |
|
1039 | shutil.copystat(src, dest) | |
1036 | else: |
|
1040 | else: | |
1037 | shutil.copymode(src, dest) |
|
1041 | shutil.copymode(src, dest) | |
|
1042 | if oldstat and oldstat.stat: | |||
|
1043 | newstat = filestat(dest) | |||
|
1044 | if newstat.isambig(oldstat): | |||
|
1045 | # stat of copied file is ambiguous to original one | |||
|
1046 | advanced = (oldstat.stat.st_mtime + 1) & 0x7fffffff | |||
|
1047 | os.utime(dest, (advanced, advanced)) | |||
1038 | except shutil.Error as inst: |
|
1048 | except shutil.Error as inst: | |
1039 | raise Abort(str(inst)) |
|
1049 | raise Abort(str(inst)) | |
1040 |
|
1050 |
General Comments 0
You need to be logged in to leave comments.
Login now