record: suggest the right command when running non interactively
authorIdan Kamara <idankk86@gmail.com>
Sun, 22 May 2011 16:10:02 +0300
changeset 14407 51cabd567ac6
parent 14406 c97c10a1b4bc
child 14408 054da1e0afbe
record: suggest the right command when running non interactively
hgext/record.py
--- a/hgext/record.py	Sun May 22 11:03:15 2011 +0200
+++ 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.