changeset 25795:69145daacdfa

cmdutil: allow callers of cmdutil.dorecord to omit suggestion Interactive committing under non-interactive mode shows command suggestion, but sometimes it is meaningless. command suggestion usability ------------ ---------- ----------- record commit commit -i commit meaningless qrecord qnew qnew -i qnew meaningless qrefersh -i qrefresh meaningless shelve -i commit incorrect ------------ ---------- ----------- This patch allows callers of 'cmdutil.dorecord()' to omit meaningless suggestion by passing None or so for 'cmdsuggest' argument of it. This is a preparation for subsequent patches, which fix each suggestion issues above.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 15 Jul 2015 03:43:16 +0900
parents 902148444889
children 4eb8d8a44bf1
files mercurial/cmdutil.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sun Jul 12 01:51:01 2015 +0800
+++ b/mercurial/cmdutil.py	Wed Jul 15 03:43:16 2015 +0900
@@ -81,8 +81,11 @@
     import merge as mergemod
 
     if not ui.interactive():
-        raise util.Abort(_('running non-interactively, use %s instead') %
-                         cmdsuggest)
+        if cmdsuggest:
+            msg = _('running non-interactively, use %s instead') % cmdsuggest
+        else:
+            msg = _('running non-interactively')
+        raise util.Abort(msg)
 
     # make sure username is set before going interactive
     if not opts.get('user'):