Commits

Dominik P  committed 8164a71

sync: add support for the --mq option in the sync tool

This patch adds a combobox to the sync options dialog if the mq extension is
enabled. If one checks that combobox, the sync commands know that they should
work on the patch queue by setting the --mq option. If the mq extension is
disabled while the combobox is still checked, the stored mq option choice gets
discarded.

This patch does change only apply to push and pull, but not to incoming and
outgoing.

  • Participants
  • Parent commits d61bfde
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/sync.py

         self.targetargs = []
 
         s = QSettings()
-        for opt in ('subrepos', 'force', 'new-branch', 'noproxy', 'debug'):
+        for opt in ('subrepos', 'force', 'new-branch', 'noproxy', 'debug', 'mq'):
             val = s.value('sync/' + opt, None).toBool()
             if val:
-                self.opts[opt] = val
+                if opt != 'mq' or 'mq' in self.repo.extensions():
+                    self.opts[opt] = val
         for opt in ('remotecmd', 'branch'):
             val = str(s.value('sync/' + opt, None).toString())
             if val:
 
         safeurl = self.currentUrl(True)
         display = ' '.join(cmdline + [safeurl]).replace('\n', '^M')
-        cmdline.append(cururl)
+        if not self.opts['mq']:
+            cmdline.append(cururl)
         self.repo.incrementBusyCount()
         self.cmd.run(cmdline, display=display, useproc='p4://' in cururl)
 
             cmdline += ['--update', '--config', uimerge]
         elif self.cachedpp == 'fetch':
             cmdline[2] = 'fetch'
-        self.run(cmdline, ('force', 'branch', 'rev', 'bookmark'))
+        elif self.opts['mq']:
+            # force the tool to update to the pulled changeset
+            cmdline += ['--update', '--config', uimerge]
+        self.run(cmdline, ('force', 'branch', 'rev', 'bookmark', 'mq'))
 
     def outclicked(self):
         self.syncStarted.emit()
         self.run(['--repository', self.repo.root, 'p4pending', '--verbose'], ())
 
     def pushclicked(self, confirm, rev=None, branch=None):
-        validopts = ('force', 'new-branch', 'branch', 'rev', 'bookmark')
+        validopts = ('force', 'new-branch', 'branch', 'rev', 'bookmark', 'mq')
         self.syncStarted.emit()
         url = self.currentUrl(True)
         urlu = hglib.tounicode(url)
         self.debugcb.setChecked(opts.get('debug', False))
         layout.addWidget(self.debugcb)
 
+        if 'mq' in self.repo.extensions():
+            self.mqcb = QCheckBox(
+                _('Work on patch queue (--mq)'))
+            self.mqcb.setChecked(opts.get('mq', False))
+            layout.addWidget(self.mqcb)
+
         form = QFormLayout()
         layout.addLayout(form)
 
         outopts['new-branch'] = self.newbranchcb.isChecked()
         outopts['noproxy'] = self.noproxycb.isChecked()
         outopts['debug'] = self.debugcb.isChecked()
+        if 'mq' in self.repo.extensions():
+            outopts['mq'] = self.mqcb.isChecked()
 
         self.outopts = outopts
         QDialog.accept(self)