##// END OF EJS Templates
merge: backup conflicting directories when getting files...
Mark Thomas -
r34550:a991e1d6 default
parent child Browse files
Show More
@@ -1167,14 +1167,18 b' def batchget(repo, mctx, wctx, actions):'
1167 repo.ui.note(_("getting %s\n") % f)
1167 repo.ui.note(_("getting %s\n") % f)
1168
1168
1169 if backup:
1169 if backup:
1170 # If a file or directory exists with the same name, back that
1171 # up. Otherwise, look to see if there is a file that conflicts
1172 # with a directory this file is in, and if so, back that up.
1170 absf = repo.wjoin(f)
1173 absf = repo.wjoin(f)
1174 if not repo.wvfs.lexists(f):
1175 for p in util.finddirs(f):
1176 if repo.wvfs.isfileorlink(p):
1177 absf = repo.wjoin(p)
1178 break
1171 orig = scmutil.origpath(ui, repo, absf)
1179 orig = scmutil.origpath(ui, repo, absf)
1172 try:
1180 if repo.wvfs.lexists(absf):
1173 if repo.wvfs.isfileorlink(f):
1181 util.rename(absf, orig)
1174 util.rename(absf, orig)
1175 except OSError as e:
1176 if e.errno != errno.ENOENT:
1177 raise
1178 wctx[f].clearunknown()
1182 wctx[f].clearunknown()
1179 wctx[f].write(fctx(f).data(), flags, backgroundclose=True)
1183 wctx[f].write(fctx(f).data(), flags, backgroundclose=True)
1180 if i == 100:
1184 if i == 100:
General Comments 0
You need to be logged in to leave comments. Login now