Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

repoview: disable context menu items according to validity

Changeset b60c0b5c7d34

Parent ea8479008ce4

by George Marrows

Changes to 2 files · Browse files at b60c0b5c7d34 Showing diff from parent ea8479008ce4 Diff from another changeset...

 
541
542
543
544
545
 
546
547
548
 
552
553
554
555
556
557
558
559
560
561
562
 
 
 
563
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
565
566
 
541
542
543
 
 
544
545
546
547
 
551
552
553
 
554
 
 
 
 
 
 
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
@@ -541,8 +541,7 @@
  # TODO: selection is ignored at the moment   menu = QMenu(self)   for act in ['update', 'manifest', 'merge', 'tag', 'backout', - 'email', 'archive', 'copyhash', None, - None]: + 'email', 'archive', 'copyhash']:   if act:   menu.addAction(self._actions[act])   else: @@ -552,15 +551,37 @@
  menu.addSeparator()   menu.addAction(self._actions['rebase'])   if 'mq' in exs: - ctx = self.repo.changectx(self.rev)   menu.addSeparator() - if ctx.thgmqappliedpatch(): - menu.addAction(self._actions['qfinish']) - elif ctx.thgmqunappliedpatch(): - menu.addAction(self._actions['qgoto']) - else: - menu.addAction(self._actions['qimport']) + menu.addAction(self._actions['qgoto']) + menu.addAction(self._actions['qimport']) + menu.addAction(self._actions['qfinish'])   menu.addAction(self._actions['strip']) + + ctx = self.repo.changectx(self.rev) + + workingdir = self.rev is None + appliedpatch = ctx.thgmqappliedpatch() + unappliedpatch = ctx.thgmqunappliedpatch() + patch = appliedpatch or unappliedpatch + realrev = not unappliedpatch and not workingdir + normalrev = not patch and not workingdir + + enabled = {'update': normalrev, + 'manifest': not unappliedpatch, + 'merge': normalrev, + 'tag': normalrev, + 'backout': normalrev, + 'email': not workingdir, + 'archive': realrev, + 'copyhash': realrev, + 'rebase': normalrev, + 'qgoto': patch, + 'qimport': normalrev, + 'qfinish': appliedpatch, + 'strip': normalrev} + for action, enabled in enabled.iteritems(): + self._actions[action].setEnabled(enabled) +   menu.exec_(point)     def updateToRevision(self):
 
385
386
387
388
 
389
390
391
 
385
386
387
 
388
389
390
391
@@ -385,7 +385,7 @@
    def thgmqappliedpatch(self):   '''True if self is an MQ applied patch''' - return bool(self._thgmqpatchtags()) + return self.rev() is not None and bool(self._thgmqpatchtags())     def thgmqunappliedpatch(self): return False