[PATCH] record: suggest the right command when running non interactively

Idan Kamara idankk86 at gmail.com
Sun May 22 08:29:17 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1306069802 -10800
# Node ID 937b1185cd56cd9649ff9a2403269746ebf76ad3
# Parent  97b742ca3600b5ec7e438013b3df1494f784bfbd
record: suggest the right command when running non interactively

diff -r 97b742ca3600 -r 937b1185cd56 hgext/record.py
--- a/hgext/record.py	Sun May 22 16:10:01 2011 +0300
+++ b/hgext/record.py	Sun May 22 16:10:02 2011 +0300
@@ -368,7 +368,7 @@
 
     This command is not available when committing a merge.'''
 
-    dorecord(ui, repo, commands.commit, *pats, **opts)
+    dorecord(ui, repo, commands.commit, 'commit', *pats, **opts)
 
 
 def qrecord(ui, repo, patch, *pats, **opts):
@@ -386,12 +386,13 @@
     def committomq(ui, repo, *pats, **opts):
         mq.new(ui, repo, patch, *pats, **opts)
 
-    dorecord(ui, repo, committomq, *pats, **opts)
+    dorecord(ui, repo, committomq, 'qnew', *pats, **opts)
 
 
-def dorecord(ui, repo, commitfunc, *pats, **opts):
+def dorecord(ui, repo, commitfunc, cmdsuggest, *pats, **opts):
     if not ui.interactive():
-        raise util.Abort(_('running non-interactively, use commit instead'))
+        raise util.Abort(_('running non-interactively, use %s instead') %
+                         cmdsuggest)
 
     def recordfunc(ui, repo, message, match, opts):
         """This is generic record driver.


More information about the Mercurial-devel mailing list