comparison tests/test-copy.t @ 39350:5b92a717bfc1

rename: return error status if any rename/copy failed Ever since 447ea621e50e (copy: propagate errors properly, 2007-12-06), we have returned an error status if the source file did not exist. That commit did not return error status for any other errors, and it's unclear if that was on purpose or not. It seems to me like we should return an error in the other cases to, so that's what this patch does. Differential Revision: https://phab.mercurial-scm.org/D4419
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 29 Aug 2018 09:59:08 -0700
parents cde75233c415
children f1186c292d03
comparison
equal deleted inserted replaced
39349:534e451b6dda 39350:5b92a717bfc1
146 $ hg up -qC . 146 $ hg up -qC .
147 147
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
154 $ hg st -A 155 $ hg st -A
155 C foo 156 C foo
223 C foo 224 C foo
224 Trying to copy on top of an existing file fails, 225 Trying to copy on top of an existing file fails,
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
236 M foo 239 M foo
237 bar 240 bar
239 mention --force: 242 mention --force:
240 $ touch xyzzy 243 $ touch xyzzy
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 ..