##// 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 def copy(ui, repo, *pats, **opts):
2413 2413
2414 2414 To undo marking a destination file as copied, use --forget. With that
2415 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 2419 This command takes effect with the next commit by default.
2419 2420
@@ -5914,6 +5915,7 def remove(ui, repo, *pats, **opts):
5914 5915 @command(
5915 5916 b'rename|move|mv',
5916 5917 [
5918 (b'', b'forget', None, _(b'unmark a destination file as renamed')),
5917 5919 (b'A', b'after', None, _(b'record a rename that has already occurred')),
5918 5920 (
5919 5921 b'',
@@ -5945,8 +5947,13 def rename(ui, repo, *pats, **opts):
5945 5947 exist in the working directory. If invoked with -A/--after, the
5946 5948 operation is recorded, but no copying is performed.
5947 5949
5948 This command takes effect at the next commit. To undo a rename
5949 before that, see :hg:`revert`.
5950 To undo marking a destination file as renamed, use --forget. With that
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 5958 Returns 0 on success, 1 if errors are encountered.
5952 5959 """
@@ -361,7 +361,7 Show all commands + options
361 361 push: force, rev, bookmark, all-bookmarks, branch, new-branch, pushvars, publish, ssh, remotecmd, insecure
362 362 recover: verify
363 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 365 resolve: all, list, mark, unmark, no-status, re-merge, tool, include, exclude, template
366 366 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
367 367 rollback: dry-run, force
@@ -277,19 +277,25 mention --force:
277 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 282 # Set up by creating a copy
283 283 $ hg cp bar baz
284 # Test uncopying a non-existent file
284 # Test unmarking as copy a non-existent file
285 285 $ hg copy --forget non-existent
286 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 290 $ hg copy --forget foo
289 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 295 $ hg copy --forget bar
292 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 299 # baz should still be marked as a copy
294 300 $ hg st -C
295 301 A baz
@@ -298,17 +304,38 Test unmarking copy of a single file
298 304 $ hg copy --forget baz
299 305 $ hg st -C
300 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 319 $ hg cp bar baz --after
303 320 $ hg copy --forget bar baz
304 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 325 $ hg st -C
306 326 A baz
307 # Test uncopy with no exact matches
327 # Test unmarking as copy with no exact matches
308 328 $ hg cp bar baz --after
309 329 $ hg copy --forget .
310 330 $ hg st -C
311 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 339 $ hg forget baz
313 340 $ rm baz
314 341
General Comments 0
You need to be logged in to leave comments. Login now