Commits

Yuya Nishihara  committed d99d861

rebase: use helper to build cmdline parameters

  • Participants
  • Parent commits d77c611

Comments (0)

Files changed (1)

File tortoisehg/hgqt/rebase.py

         self.keepbrancheschk.setEnabled(False)
         self.basechk.setEnabled(False)
         self.collapsechk.setEnabled(False)
-        cmdline = ['rebase']
-        cmdline += ['--config', 'ui.merge=internal:' +
-                    (self.autoresolvechk.isChecked() and 'merge' or 'fail')]
+
+        itool = self.autoresolvechk.isChecked() and 'merge' or 'fail'
+        opts = {'config': 'ui.merge=internal:%s' % itool}
         if os.path.exists(self.repo.join('rebasestate')):
-            cmdline += ['--continue']
+            opts['continue'] = True
         else:
-            if self.keepchk.isChecked():
-                cmdline += ['--keep']
-            if self.keepbrancheschk.isChecked():
-                cmdline += ['--keepbranches']
-            if self.collapsechk.isChecked():
-                cmdline += ['--collapse']
+            opts.update({
+                'keep': self.keepchk.isChecked(),
+                'keepbranches': self.keepbrancheschk.isChecked(),
+                'collapse': self.collapsechk.isChecked(),
+                })
             if self.svnchk is not None and self.svnchk.isChecked():
-                cmdline += ['--svn']
+                opts['svn'] = True
             else:
-                source = self.opts.get('source')
-                dest = self.opts.get('dest')
-                sourcearg = '--source'
+                sourcearg = 'source'
                 if self.basechk.isChecked():
-                    sourcearg = '--base'
-                cmdline += [sourcearg, hglib.tounicode(str(source)),
-                            '--dest', hglib.tounicode(str(dest))]
+                    sourcearg = 'base'
+                opts[sourcearg] = hglib.tounicode(str(self.opts.get('source')))
+                opts['dest'] = hglib.tounicode(str(self.opts.get('dest')))
+        cmdline = hglib.buildcmdargs('rebase', **opts)
         sess = self._runCommand(cmdline)
         sess.commandFinished.connect(self._rebaseFinished)
 
         self.opts['dest'] = oldsource
 
     def abort(self):
-        cmdline = ['rebase', '--abort']
+        cmdline = hglib.buildcmdargs('rebase', abort=True)
         sess = self._runCommand(cmdline)
         sess.commandFinished.connect(self._abortFinished)