--- a/mercurial/cmdutil.py Sun Oct 09 01:03:20 2016 +0900
+++ b/mercurial/cmdutil.py Mon Sep 19 17:15:39 2016 -0400
@@ -646,8 +646,26 @@
if not after and exists or after and state in 'mn':
if not opts['force']:
- ui.warn(_('%s: not overwriting - file exists\n') %
- reltarget)
+ if state in 'mn':
+ msg = _('%s: not overwriting - file already committed\n')
+ if after:
+ flags = '--after --force'
+ else:
+ flags = '--force'
+ if rename:
+ hint = _('(hg rename %s to replace the file by '
+ 'recording a rename)\n') % flags
+ else:
+ hint = _('(hg copy %s to replace the file by '
+ 'recording a copy)\n') % flags
+ else:
+ msg = _('%s: not overwriting - file exists\n')
+ if rename:
+ hint = _('(hg rename --after to record the rename)\n')
+ else:
+ hint = _('(hg copy --after to record the copy)\n')
+ ui.warn(msg % reltarget)
+ ui.warn(hint)
return
if after: