Show More
@@ -1910,7 +1910,13 b' def checksignature(func, depth=1):' | |||||
1910 |
|
1910 | |||
1911 |
|
1911 | |||
1912 | def copyfile( |
|
1912 | def copyfile( | |
1913 | src, dest, hardlink=False, copystat=False, checkambig=False, nb_bytes=None |
|
1913 | src, | |
|
1914 | dest, | |||
|
1915 | hardlink=False, | |||
|
1916 | copystat=False, | |||
|
1917 | checkambig=False, | |||
|
1918 | nb_bytes=None, | |||
|
1919 | no_hardlink_cb=None, | |||
1914 | ): |
|
1920 | ): | |
1915 | """copy a file, preserving mode and optionally other stat info like |
|
1921 | """copy a file, preserving mode and optionally other stat info like | |
1916 | atime/mtime |
|
1922 | atime/mtime | |
@@ -1937,6 +1943,8 b' def copyfile(' | |||||
1937 | except OSError: |
|
1943 | except OSError: | |
1938 | fstype = None |
|
1944 | fstype = None | |
1939 | if fstype not in _hardlinkfswhitelist: |
|
1945 | if fstype not in _hardlinkfswhitelist: | |
|
1946 | if no_hardlink_cb is not None: | |||
|
1947 | no_hardlink_cb() | |||
1940 | hardlink = False |
|
1948 | hardlink = False | |
1941 | if hardlink: |
|
1949 | if hardlink: | |
1942 | try: |
|
1950 | try: | |
@@ -1945,8 +1953,10 b' def copyfile(' | |||||
1945 | m = "the `nb_bytes` argument is incompatible with `hardlink`" |
|
1953 | m = "the `nb_bytes` argument is incompatible with `hardlink`" | |
1946 | raise error.ProgrammingError(m) |
|
1954 | raise error.ProgrammingError(m) | |
1947 | return |
|
1955 | return | |
1948 | except (IOError, OSError): |
|
1956 | except (IOError, OSError) as exc: | |
1949 | pass # fall back to normal copy |
|
1957 | if exc.errno != errno.EEXIST and no_hardlink_cb is not None: | |
|
1958 | no_hardlink_cb() | |||
|
1959 | # fall back to normal copy | |||
1950 | if os.path.islink(src): |
|
1960 | if os.path.islink(src): | |
1951 | os.symlink(os.readlink(src), dest) |
|
1961 | os.symlink(os.readlink(src), dest) | |
1952 | # copytime is ignored for symlinks, but in general copytime isn't needed |
|
1962 | # copytime is ignored for symlinks, but in general copytime isn't needed |
General Comments 0
You need to be logged in to leave comments.
Login now