1676 |
1676 |
1677 if not after and exists or after and already_commited: |
1677 if not after and exists or after and already_commited: |
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 if after: |
1681 # Check if if the target was added in the parent and the |
1682 flags = b'--after --force' |
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 ) |
1683 else: |
1698 else: |
1684 flags = b'--force' |
1699 if after: |
1685 if rename: |
1700 flags = b'--after --force' |
1686 hint = ( |
1701 else: |
1687 _( |
1702 flags = b'--force' |
1688 b"('hg rename %s' to replace the file by " |
1703 if rename: |
1689 b'recording a rename)\n' |
1704 hint = ( |
|
1705 _( |
|
1706 b"('hg rename %s' to replace the file by " |
|
1707 b'recording a rename)\n' |
|
1708 ) |
|
1709 % flags |
1690 ) |
1710 ) |
1691 % flags |
1711 else: |
1692 ) |
1712 hint = ( |
1693 else: |
1713 _( |
1694 hint = ( |
1714 b"('hg copy %s' to replace the file by " |
1695 _( |
1715 b'recording a copy)\n' |
1696 b"('hg copy %s' to replace the file by " |
1716 ) |
1697 b'recording a copy)\n' |
1717 % flags |
1698 ) |
1718 ) |
1699 % flags |
|
1700 ) |
|
1701 else: |
1719 else: |
1702 msg = _(b'%s: not overwriting - file exists\n') |
1720 msg = _(b'%s: not overwriting - file exists\n') |
1703 if rename: |
1721 if rename: |
1704 hint = _( |
1722 hint = _( |
1705 b"('hg rename --after' to record the rename)\n" |
1723 b"('hg rename --after' to record the rename)\n" |