##// END OF EJS Templates
hardlink: duplicate hardlink detection for copying files and directories...
Jun Wu -
r31719:456efd1b default
parent child Browse files
Show More
@@ -1126,14 +1126,13 b' def copyfiles(src, dst, hardlink=None, p'
1126 """Copy a directory tree using hardlinks if possible."""
1126 """Copy a directory tree using hardlinks if possible."""
1127 num = 0
1127 num = 0
1128
1128
1129 if hardlink is None:
1130 hardlink = (os.stat(src).st_dev ==
1131 os.stat(os.path.dirname(dst)).st_dev)
1132
1133 gettopic = lambda: hardlink and _('linking') or _('copying')
1129 gettopic = lambda: hardlink and _('linking') or _('copying')
1134 topic = gettopic()
1135
1130
1136 if os.path.isdir(src):
1131 if os.path.isdir(src):
1132 if hardlink is None:
1133 hardlink = (os.stat(src).st_dev ==
1134 os.stat(os.path.dirname(dst)).st_dev)
1135 topic = gettopic()
1137 os.mkdir(dst)
1136 os.mkdir(dst)
1138 for name, kind in osutil.listdir(src):
1137 for name, kind in osutil.listdir(src):
1139 srcname = os.path.join(src, name)
1138 srcname = os.path.join(src, name)
@@ -1144,6 +1143,11 b' def copyfiles(src, dst, hardlink=None, p'
1144 hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog)
1143 hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog)
1145 num += n
1144 num += n
1146 else:
1145 else:
1146 if hardlink is None:
1147 hardlink = (os.stat(src).st_dev ==
1148 os.stat(os.path.dirname(dst)).st_dev)
1149 topic = gettopic()
1150
1147 if hardlink:
1151 if hardlink:
1148 try:
1152 try:
1149 oslink(src, dst)
1153 oslink(src, dst)
General Comments 0
You need to be logged in to leave comments. Login now