##// END OF EJS Templates
rename: return error status if any rename/copy failed...
Martin von Zweigbergk -
r39386:5b92a717 default
parent child Browse files
Show More
@@ -1184,7 +1184,7 b' def copy(ui, repo, pats, opts, rename=Fa'
1184 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
1184 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
1185 (reltarget, repo.pathto(abssrc, cwd),
1185 (reltarget, repo.pathto(abssrc, cwd),
1186 repo.pathto(prevsrc, cwd)))
1186 repo.pathto(prevsrc, cwd)))
1187 return
1187 return True # report a failure
1188
1188
1189 # check for overwrites
1189 # check for overwrites
1190 exists = os.path.lexists(target)
1190 exists = os.path.lexists(target)
@@ -1194,7 +1194,7 b' def copy(ui, repo, pats, opts, rename=Fa'
1194 repo.dirstate.normalize(abstarget)):
1194 repo.dirstate.normalize(abstarget)):
1195 if not rename:
1195 if not rename:
1196 ui.warn(_("%s: can't copy - same file\n") % reltarget)
1196 ui.warn(_("%s: can't copy - same file\n") % reltarget)
1197 return
1197 return True # report a failure
1198 exists = False
1198 exists = False
1199 samefile = True
1199 samefile = True
1200
1200
@@ -1220,7 +1220,7 b' def copy(ui, repo, pats, opts, rename=Fa'
1220 hint = _("('hg copy --after' to record the copy)\n")
1220 hint = _("('hg copy --after' to record the copy)\n")
1221 ui.warn(msg % reltarget)
1221 ui.warn(msg % reltarget)
1222 ui.warn(hint)
1222 ui.warn(hint)
1223 return
1223 return True # report a failure
1224
1224
1225 if after:
1225 if after:
1226 if not exists:
1226 if not exists:
@@ -1230,7 +1230,7 b' def copy(ui, repo, pats, opts, rename=Fa'
1230 else:
1230 else:
1231 ui.warn(_('%s: not recording copy - %s does not exist\n') %
1231 ui.warn(_('%s: not recording copy - %s does not exist\n') %
1232 (relsrc, reltarget))
1232 (relsrc, reltarget))
1233 return
1233 return True # report a failure
1234 elif not dryrun:
1234 elif not dryrun:
1235 try:
1235 try:
1236 if exists:
1236 if exists:
@@ -148,6 +148,7 b' moving a missing file'
148 copy --after to a nonexistent target filename
148 copy --after to a nonexistent target filename
149 $ hg cp -A foo dummy
149 $ hg cp -A foo dummy
150 foo: not recording copy - dummy does not exist
150 foo: not recording copy - dummy does not exist
151 [1]
151
152
152 dry-run; should show that foo is clean
153 dry-run; should show that foo is clean
153 $ hg copy --dry-run foo bar
154 $ hg copy --dry-run foo bar
@@ -225,11 +226,13 b' Trying to copy on top of an existing fil'
225 $ hg copy -A bar foo
226 $ hg copy -A bar foo
226 foo: not overwriting - file already committed
227 foo: not overwriting - file already committed
227 ('hg copy --after --force' to replace the file by recording a copy)
228 ('hg copy --after --force' to replace the file by recording a copy)
229 [1]
228 same error without the --after, so the user doesn't have to go through
230 same error without the --after, so the user doesn't have to go through
229 two hints:
231 two hints:
230 $ hg copy bar foo
232 $ hg copy bar foo
231 foo: not overwriting - file already committed
233 foo: not overwriting - file already committed
232 ('hg copy --force' to replace the file by recording a copy)
234 ('hg copy --force' to replace the file by recording a copy)
235 [1]
233 but it's considered modified after a copy --after --force
236 but it's considered modified after a copy --after --force
234 $ hg copy -Af bar foo
237 $ hg copy -Af bar foo
235 $ hg st -AC foo
238 $ hg st -AC foo
@@ -241,5 +244,6 b' mention --force:'
241 $ hg cp bar xyzzy
244 $ hg cp bar xyzzy
242 xyzzy: not overwriting - file exists
245 xyzzy: not overwriting - file exists
243 ('hg copy --after' to record the copy)
246 ('hg copy --after' to record the copy)
247 [1]
244
248
245 $ cd ..
249 $ cd ..
@@ -71,6 +71,7 b' rename --after a single file to a nonexi'
71
71
72 $ hg rename --after d1/a dummy
72 $ hg rename --after d1/a dummy
73 d1/a: not recording move - dummy does not exist
73 d1/a: not recording move - dummy does not exist
74 [1]
74
75
75 move a single file to an existing directory
76 move a single file to an existing directory
76
77
@@ -268,6 +269,7 b' overwrite existing files (d2/b)'
268 d2/b: not overwriting - file already committed
269 d2/b: not overwriting - file already committed
269 ('hg rename --force' to replace the file by recording a rename)
270 ('hg rename --force' to replace the file by recording a rename)
270 moving d1/d11/a1 to d2/d11/a1
271 moving d1/d11/a1 to d2/d11/a1
272 [1]
271 $ hg status -C
273 $ hg status -C
272 A d2/a
274 A d2/a
273 d1/a
275 d1/a
@@ -338,6 +340,7 b' move --after some files under d1 to d2/d'
338 d1/b: not recording move - d2/d21/b does not exist
340 d1/b: not recording move - d2/d21/b does not exist
339 d1/ba: not recording move - d2/d21/ba does not exist
341 d1/ba: not recording move - d2/d21/ba does not exist
340 moving d1/d11/a1 to d2/d21/a1
342 moving d1/d11/a1 to d2/d21/a1
343 [1]
341 $ hg status -C
344 $ hg status -C
342 A d2/d21/a
345 A d2/d21/a
343 d1/a
346 d1/a
@@ -372,6 +375,7 b' attempt to overwrite an existing file'
372 $ hg rename d1/ba d1/ca
375 $ hg rename d1/ba d1/ca
373 d1/ca: not overwriting - file exists
376 d1/ca: not overwriting - file exists
374 ('hg rename --after' to record the rename)
377 ('hg rename --after' to record the rename)
378 [1]
375 $ hg status -C
379 $ hg status -C
376 ? d1/ca
380 ? d1/ca
377 $ hg update -C
381 $ hg update -C
@@ -396,6 +400,7 b' attempt to overwrite an existing broken '
396 $ hg rename --traceback d1/ba d1/ca
400 $ hg rename --traceback d1/ba d1/ca
397 d1/ca: not overwriting - file exists
401 d1/ca: not overwriting - file exists
398 ('hg rename --after' to record the rename)
402 ('hg rename --after' to record the rename)
403 [1]
399 $ hg status -C
404 $ hg status -C
400 ? d1/ca
405 ? d1/ca
401 $ hg update -C
406 $ hg update -C
@@ -421,6 +426,7 b' do not copy more than one source file to'
421 $ hg rename d1/* d2/* d3
426 $ hg rename d1/* d2/* d3
422 moving d1/d11/a1 to d3/d11/a1
427 moving d1/d11/a1 to d3/d11/a1
423 d3/b: not overwriting - d2/b collides with d1/b
428 d3/b: not overwriting - d2/b collides with d1/b
429 [1]
424 $ hg status -C
430 $ hg status -C
425 A d3/a
431 A d3/a
426 d1/a
432 d1/a
General Comments 0
You need to be logged in to leave comments. Login now