##// END OF EJS Templates
copy: recommend `--at-rev .` if target was added in parent commit...
Martin von Zweigbergk -
r49061:c62e4397 default
parent child Browse files
Show More
@@ -1678,6 +1678,24 b' def copy(ui, repo, pats, opts, rename=Fa'
1678 if not opts[b'force']:
1678 if not opts[b'force']:
1679 if already_commited:
1679 if already_commited:
1680 msg = _(b'%s: not overwriting - file already committed\n')
1680 msg = _(b'%s: not overwriting - file already committed\n')
1681 # Check if if the target was added in the parent and the
1682 # source already existed in the grandparent.
1683 looks_like_copy_in_pctx = abstarget in pctx and any(
1684 abssrc in gpctx and abstarget not in gpctx
1685 for gpctx in pctx.parents()
1686 )
1687 if looks_like_copy_in_pctx:
1688 if rename:
1689 hint = _(
1690 b"('hg rename --at-rev .' to record the rename "
1691 b"in the parent of the working copy)\n"
1692 )
1693 else:
1694 hint = _(
1695 b"('hg copy --at-rev .' to record the copy in "
1696 b"the parent of the working copy)\n"
1697 )
1698 else:
1681 if after:
1699 if after:
1682 flags = b'--after --force'
1700 flags = b'--after --force'
1683 else:
1701 else:
@@ -42,6 +42,17 b' Test single file'
42 d1/b
42 d1/b
43 A d1/d
43 A d1/d
44 d1/b
44 d1/b
45 # Should get helpful message if we try to copy or rename after commit
46 $ hg cp --forget --at-rev . d1/d
47 saved backup bundle to $TESTTMP/.hg/strip-backup/3f7c325d3f9e-46f377bb-uncopy.hg
48 $ hg cp d1/b d1/d
49 d1/d: not overwriting - file already committed
50 ('hg copy --at-rev .' to record the copy in the parent of the working copy)
51 [1]
52 $ hg mv d1/b d1/d
53 d1/d: not overwriting - file already committed
54 ('hg rename --at-rev .' to record the rename in the parent of the working copy)
55 [1]
45
56
46 Test moved file (not copied) using 'hg cp' command
57 Test moved file (not copied) using 'hg cp' command
47
58
General Comments 0
You need to be logged in to leave comments. Login now