1. TortoiseHg
  2. TortoiseHg
  3. thg


Angel Ezquerra  committed 5022d44

phases: add "change phase to" submenu to revision context menu

This menu lets the user change the phase of a given revision.
Currently it is only supported changing the phase of a single revision at a

  • Participants
  • Parent commits 5ac642f
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/repowidget.py

View file
  • Ignore whitespace
 import binascii
 import os
-from mercurial import revset, error, patch
+from mercurial import revset, error, patch, commands
 from tortoisehg.util import hglib, shlib, paths
+        # hg >= 2.1
+        if hasattr(commands, 'phase'):
+            submenu = menu.addMenu(_('Change Phase to'))
+            entry(submenu, None, isrev, _('Secret'), None,
+                  lambda: self.changePhase('secret'))
+            entry(submenu, None, isrev, _('Draft'), None,
+                  lambda: self.changePhase('draft'))
+            entry(submenu, None, isrev, _('Public'), None,
+                  lambda: self.changePhase('public'))
+            entry(menu)
         entry(menu, 'transplant', fixed, _('Transplant to local'), 'hg-transplant',
         clip = QApplication.clipboard()
+    def changePhase(self, phase):
+        cmdlines = []
+        cmdlines.append(['phase', '--rev', '%s' % self.rev,
+                       '--repository', self.repo.root])
+        self.runCommand(*cmdlines)
     def rebaseRevision(self):
         """Rebase selected revision on top of working directory parent"""
         opts = {'source' : self.rev, 'dest': self.repo['.'].rev()}