##// END OF EJS Templates
rename: add --forget option and stop suggesting `hg revert` for undoing...
Martin von Zweigbergk -
r47648:37f49d46 default
parent child Browse files
Show More
@@ -2413,7 +2413,8 b' def copy(ui, repo, *pats, **opts):'
2413
2413
2414 To undo marking a destination file as copied, use --forget. With that
2414 To undo marking a destination file as copied, use --forget. With that
2415 option, all given (positional) arguments are unmarked as copies. The
2415 option, all given (positional) arguments are unmarked as copies. The
2416 destination file(s) will be left in place (still tracked).
2416 destination file(s) will be left in place (still tracked). Note that
2417 :hg:`copy --forget` behaves the same way as :hg:`rename --forget`.
2417
2418
2418 This command takes effect with the next commit by default.
2419 This command takes effect with the next commit by default.
2419
2420
@@ -5914,6 +5915,7 b' def remove(ui, repo, *pats, **opts):'
5914 @command(
5915 @command(
5915 b'rename|move|mv',
5916 b'rename|move|mv',
5916 [
5917 [
5918 (b'', b'forget', None, _(b'unmark a destination file as renamed')),
5917 (b'A', b'after', None, _(b'record a rename that has already occurred')),
5919 (b'A', b'after', None, _(b'record a rename that has already occurred')),
5918 (
5920 (
5919 b'',
5921 b'',
@@ -5945,8 +5947,13 b' def rename(ui, repo, *pats, **opts):'
5945 exist in the working directory. If invoked with -A/--after, the
5947 exist in the working directory. If invoked with -A/--after, the
5946 operation is recorded, but no copying is performed.
5948 operation is recorded, but no copying is performed.
5947
5949
5948 This command takes effect at the next commit. To undo a rename
5950 To undo marking a destination file as renamed, use --forget. With that
5949 before that, see :hg:`revert`.
5951 option, all given (positional) arguments are unmarked as renames. The
5952 destination file(s) will be left in place (still tracked). The source
5953 file(s) will not be restored. Note that :hg:`rename --forget` behaves
5954 the same way as :hg:`copy --forget`.
5955
5956 This command takes effect with the next commit by default.
5950
5957
5951 Returns 0 on success, 1 if errors are encountered.
5958 Returns 0 on success, 1 if errors are encountered.
5952 """
5959 """
@@ -361,7 +361,7 b' Show all commands + options'
361 push: force, rev, bookmark, all-bookmarks, branch, new-branch, pushvars, publish, ssh, remotecmd, insecure
361 push: force, rev, bookmark, all-bookmarks, branch, new-branch, pushvars, publish, ssh, remotecmd, insecure
362 recover: verify
362 recover: verify
363 remove: after, force, subrepos, include, exclude, dry-run
363 remove: after, force, subrepos, include, exclude, dry-run
364 rename: after, at-rev, force, include, exclude, dry-run
364 rename: forget, after, at-rev, force, include, exclude, dry-run
365 resolve: all, list, mark, unmark, no-status, re-merge, tool, include, exclude, template
365 resolve: all, list, mark, unmark, no-status, re-merge, tool, include, exclude, template
366 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
366 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
367 rollback: dry-run, force
367 rollback: dry-run, force
@@ -277,19 +277,25 b' mention --force:'
277 $ rm baz xyzzy
277 $ rm baz xyzzy
278
278
279
279
280 Test unmarking copy of a single file
280 Test unmarking copy/rename of a single file
281
281
282 # Set up by creating a copy
282 # Set up by creating a copy
283 $ hg cp bar baz
283 $ hg cp bar baz
284 # Test uncopying a non-existent file
284 # Test unmarking as copy a non-existent file
285 $ hg copy --forget non-existent
285 $ hg copy --forget non-existent
286 non-existent: $ENOENT$
286 non-existent: $ENOENT$
287 # Test uncopying an tracked but unrelated file
287 $ hg rename --forget non-existent
288 non-existent: $ENOENT$
289 # Test unmarking as copy an tracked but unrelated file
288 $ hg copy --forget foo
290 $ hg copy --forget foo
289 foo: not unmarking as copy - file is not marked as copied
291 foo: not unmarking as copy - file is not marked as copied
290 # Test uncopying a copy source
292 $ hg rename --forget foo
293 foo: not unmarking as copy - file is not marked as copied
294 # Test unmarking as copy a copy source
291 $ hg copy --forget bar
295 $ hg copy --forget bar
292 bar: not unmarking as copy - file is not marked as copied
296 bar: not unmarking as copy - file is not marked as copied
297 $ hg rename --forget bar
298 bar: not unmarking as copy - file is not marked as copied
293 # baz should still be marked as a copy
299 # baz should still be marked as a copy
294 $ hg st -C
300 $ hg st -C
295 A baz
301 A baz
@@ -298,17 +304,38 b' Test unmarking copy of a single file'
298 $ hg copy --forget baz
304 $ hg copy --forget baz
299 $ hg st -C
305 $ hg st -C
300 A baz
306 A baz
301 # Test uncopy with matching an non-matching patterns
307 $ rm bar
308 $ hg rename --after bar baz
309 $ hg st -C
310 A baz
311 bar
312 R bar
313 $ hg rename --forget baz
314 $ hg st -C
315 A baz
316 R bar
317 $ hg revert bar
318 # Test unmarking as copy with matching an non-matching patterns
302 $ hg cp bar baz --after
319 $ hg cp bar baz --after
303 $ hg copy --forget bar baz
320 $ hg copy --forget bar baz
304 bar: not unmarking as copy - file is not marked as copied
321 bar: not unmarking as copy - file is not marked as copied
322 $ hg cp bar baz --after
323 $ hg rename --forget bar baz
324 bar: not unmarking as copy - file is not marked as copied
305 $ hg st -C
325 $ hg st -C
306 A baz
326 A baz
307 # Test uncopy with no exact matches
327 # Test unmarking as copy with no exact matches
308 $ hg cp bar baz --after
328 $ hg cp bar baz --after
309 $ hg copy --forget .
329 $ hg copy --forget .
310 $ hg st -C
330 $ hg st -C
311 A baz
331 A baz
332 $ hg cp bar baz --after
333 $ hg st -C
334 A baz
335 bar
336 $ hg rename --forget .
337 $ hg st -C
338 A baz
312 $ hg forget baz
339 $ hg forget baz
313 $ rm baz
340 $ rm baz
314
341
General Comments 0
You need to be logged in to leave comments. Login now