Commits

Piotr Klecha committed a0bcd53

repowidget: rebase selecting both source and destination (refs #3322)

Comments (0)

Files changed (1)

tortoisehg/hgqt/repowidget.py

                 return
             dlg = compress.CompressDialog(self._repoagent, revs, self)
             dlg.exec_()
+        def rebaseDlg():
+            opts = {'source': self.menuselection[0],
+                    'dest': self.menuselection[1]}
+            dlg = rebase.RebaseDialog(self._repoagent, self, **opts)
+            dlg.finished.connect(dlg.deleteLater)
+            dlg.exec_()
+
+        exs = self.repo.extensions()
 
         menu = QMenu(self)
-        for name, cb, icon in (
-                (_('Visual Diff...'), diffPair, 'visualdiff'),
-                (_('Export Diff...'), exportDiff, 'hg-export'),
-                (None, None, None),
-                (_('Export Selected...'), exportPair, 'hg-export'),
-                (_('Email Selected...'), emailPair, 'mail-forward'),
-                (_('Copy Selected as Patch'), self.copyPatch, 'copy-patch'),
-                (None, None, None),
-                (_('Export DAG Range...'), exportDagRange, 'hg-export'),
-                (_('Email DAG Range...'), emailDagRange, 'mail-forward'),
-                (_('Bundle DAG Range...'), bundleDagRange, 'hg-bundle'),
-                (None, None, None),
-                (_('Bisect - Good, Bad...'), bisectNormal, 'hg-bisect-good-bad'),
-                (_('Bisect - Bad, Good...'), bisectReverse, 'hg-bisect-bad-good'),
-                (_('Compress History...'), compressDlg, 'hg-compress'),
-                (None, None, None),
-                (_('Goto common ancestor'), self._gotoAncestor, 'hg-merge'),
-                (_('Similar revisions...'), self.matchRevision, 'view-filter'),
-                (None, None, None),
-                (_('Graft Selected to local...'), self.graftRevisions, 'hg-transplant'),
+        for name, cb, icon, ext in (
+                (_('Visual Diff...'), diffPair, 'visualdiff', None),
+                (_('Export Diff...'), exportDiff, 'hg-export', None),
+                (None, None, None, None),
+                (_('Export Selected...'), exportPair, 'hg-export', None),
+                (_('Email Selected...'), emailPair, 'mail-forward', None),
+                (_('Copy Selected as Patch'), self.copyPatch, 'copy-patch', None),
+                (None, None, None, None),
+                (_('Export DAG Range...'), exportDagRange, 'hg-export', None),
+                (_('Email DAG Range...'), emailDagRange, 'mail-forward', None),
+                (_('Bundle DAG Range...'), bundleDagRange, 'hg-bundle', None),
+                (None, None, None, None),
+                (_('Bisect - Good, Bad...'), bisectNormal, 'hg-bisect-good-bad', None),
+                (_('Bisect - Bad, Good...'), bisectReverse, 'hg-bisect-bad-good', None),
+                (_('Compress History...'), compressDlg, 'hg-compress', None),
+                (_('Rebase...'), rebaseDlg, 'hg-rebase', 'rebase'),
+                (None, None, None, None),
+                (_('Goto common ancestor'), self._gotoAncestor, 'hg-merge', None),
+                (_('Similar revisions...'), self.matchRevision, 'view-filter', None),
+                (None, None, None, None),
+                (_('Graft Selected to local...'), self.graftRevisions, 'hg-transplant', None),
                 ):
             if name is None:
                 menu.addSeparator()
                 continue
+            if ext and ext not in exs:
+                continue
             a = QAction(name, self)
             if icon:
                 a.setIcon(qtlib.geticon(icon))