comparison tests/test-copy.t @ 44364:8be0c63535b5

copy: add option to unmark file as copied To unmark a file as copied, the user currently has to do this: hg forget <dest> hg add <dest> The new command simplifies that to: hg copy --forget <dest> That's not a very big improvement, but I'm planning to also teach `hg copy [--forget]` a `--at-rev` argument for marking/unmarking copies after commit (usually with `--at-rev .`). Differential Revision: https://phab.mercurial-scm.org/D8029
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 20 Dec 2019 15:50:13 -0800
parents e41449818bee
children 7c4b98a4e536
comparison
equal deleted inserted replaced
44363:f7459da77f23 44364:8be0c63535b5
260 $ touch xyzzy 260 $ touch xyzzy
261 $ hg cp bar xyzzy 261 $ hg cp bar xyzzy
262 xyzzy: not overwriting - file exists 262 xyzzy: not overwriting - file exists
263 ('hg copy --after' to record the copy) 263 ('hg copy --after' to record the copy)
264 [1] 264 [1]
265 $ hg co -qC .
266 $ rm baz xyzzy
267
268
269 Test unmarking copy of a single file
270
271 # Set up by creating a copy
272 $ hg cp bar baz
273 # Test uncopying a non-existent file
274 $ hg copy --forget non-existent
275 non-existent: $ENOENT$
276 # Test uncopying an tracked but unrelated file
277 $ hg copy --forget foo
278 foo: not unmarking as copy - file is not marked as copied
279 # Test uncopying a copy source
280 $ hg copy --forget bar
281 bar: not unmarking as copy - file is not marked as copied
282 # baz should still be marked as a copy
283 $ hg st -C
284 A baz
285 bar
286 # Test the normal case
287 $ hg copy --forget baz
288 $ hg st -C
289 A baz
290 # Test uncopy with matching an non-matching patterns
291 $ hg cp bar baz --after
292 $ hg copy --forget bar baz
293 bar: not unmarking as copy - file is not marked as copied
294 $ hg st -C
295 A baz
296 # Test uncopy with no exact matches
297 $ hg cp bar baz --after
298 $ hg copy --forget .
299 $ hg st -C
300 A baz
301 $ hg forget baz
302 $ rm baz
303
304 Test unmarking copy of a directory
305
306 $ mkdir dir
307 $ echo foo > dir/foo
308 $ echo bar > dir/bar
309 $ hg add dir
310 adding dir/bar
311 adding dir/foo
312 $ hg ci -m 'add dir/'
313 $ hg cp dir dir2
314 copying dir/bar to dir2/bar
315 copying dir/foo to dir2/foo
316 $ touch dir2/untracked
317 $ hg copy --forget dir2
318 $ hg st -C
319 A dir2/bar
320 A dir2/foo
321 ? dir2/untracked
265 322
266 $ cd .. 323 $ cd ..