Anonymous committed 36eb079

filectxactions: add "Folder history" command

When the folder specific manifest context menu was introduced the "File history"
and "Compare revisions" commands were removed for folders, because they did not
work in the first place.

This patch introduces a "Folder history" command which is somewhat similar to
the "File history" command.

Rather than opening a new dialog showing the file revisions, this command simply
sets the repowidget filter to only show revisions where any of the files
contained in the selected folder were modified.

  • Participants
  • Parent commits d433033

Comments (0)

Files changed (3)


     'file': ['diff', 'ldiff', None, 'edit', 'save', None, 'ledit', 'lopen',
              'copypath', None, 'revert', None, 'navigate', 'diffnavigate'],
-    'dir': ['diff', 'ldiff', None, 'revert',
+    'dir': ['diff', 'ldiff', None, 'revert', None, 'filter',
             None, 'explore', 'terminal', 'copypath'],
     """Container for repository file actions"""
     linkActivated = pyqtSignal(unicode)
+    filterRequested = pyqtSignal(QString)
+    """Ask the repowidget to change its revset filter"""
     def __init__(self, repo, parent=None, rev=None):
         super(FilectxActions, self).__init__(parent)
         for name, desc, icon, key, tip, cb in [
             ('navigate', _('File history'), 'hg-log', 'Shift+Return',
              _('Show the history of the selected file'), self.navigate),
+            ('filter', _('Folder history'), 'hg-log', None,
+             _('Show the history of the selected file'), self.navigate),
             ('diffnavigate', _('Compare file revisions'), 'compare-files', None,
              _('Compare revisions of the selected file'), self.diffNavigate),
             ('diff', _('Diff to parent'), 'visualdiff', 'Ctrl+D',
     def _navigate(self, filename, dlgclass, dlgdict):
         if not filename:
             filename = self._selectedfiles[0]
+        if self._itemisdir:
+            # ask the main repowidget to only show the revisions in which files
+            # on that folder are present
+            return self.filterRequested.emit("file('%s/**')" % filename)
         if filename is not None and len(self.repo.file(filename))>0:
             if filename not in dlgdict:
                 # dirty hack to pass workbench only if available


     linkActivated = pyqtSignal(QString)
     """Emitted (path) when user clicks on link"""
+    revsetFilterRequested = pyqtSignal(QString)
+    """Ask the repowidget to change its revset filter"""
     def canswitch(self):
         return False
         self._fileactions = filectxactions.FilectxActions(self._repo, self,
+        self._fileactions.filterRequested.connect(self.revsetFilterRequested)
     def showEvent(self, event):


+        w.revsetFilterRequested.connect(self.setFilter)
         return w
     def createSyncWidget(self):