Commits

Yuya Nishihara committed 3de0fd6

hglib: have buildcmdargs accept command name

  • Participants
  • Parent commits 0c35de0

Comments (0)

Files changed (2)

File tortoisehg/hgqt/hgemail.py

 
         opts = self._patchbombopts()
         try:
-            cmd = cmdui.Dialog(['email'] + hglib.buildcmdargs(**opts),
-                               parent=self)
+            cmd = cmdui.Dialog(hglib.buildcmdargs('email', **opts), parent=self)
             cmd.setWindowTitle(_('Sending Email'))
             cmd.setShowOutput(False)
             cmd.finished.connect(cmd.deleteLater)

File tortoisehg/util/hglib.py

     req = hgdispatch.request(args, ui)
     return hgdispatch._dispatch(req)
 
-def buildcmdargs(**opts):
+def buildcmdargs(name, **opts):
     """Build list of command-line arguments
 
-    >>> buildcmdargs(branch='foo')
-    ['--branch', 'foo']
-    >>> buildcmdargs(rev=['0', '1'])
-    ['--rev', '0', '--rev', '1']
-    >>> buildcmdargs(no_merges=True, quiet=False)
-    ['--no-merges']
+    >>> buildcmdargs('push', branch='foo')
+    ['push', '--branch', 'foo']
+    >>> buildcmdargs('graft', rev=['0', '1'])
+    ['graft', '--rev', '0', '--rev', '1']
+    >>> buildcmdargs('log', no_merges=True, quiet=False)
+    ['log', '--no-merges']
     """
-    fullargs = []
+    fullargs = [name]
     for k, v in opts.iteritems():
         aname = '--%s' % k.replace('_', '-')
         if isinstance(v, bool):