Edgewall Software

Ticket #7807: suppress_file_diff.patch

File suppress_file_diff.patch, 1.9 KB (added by anonymous, 4 years ago)
  • trac/versioncontrol/web_ui/changeset.py

     
    2525import re 
    2626from StringIO import StringIO 
    2727import time 
     28from fnmatch import fnmatchcase 
    2829 
    2930from genshi.builder import tag 
    3031 
    31 from trac.config import Option, BoolOption, IntOption 
     32from trac.config import Option, BoolOption, IntOption, ListOption 
    3233from trac.core import * 
    3334from trac.mimeview import Mimeview, is_binary, Context 
    3435from trac.perm import IPermissionRequestor 
     
    164165        If this option is disabled, changeset messages will be rendered as 
    165166        pre-formatted text.""") 
    166167 
     168    suppress_file_diff = ListOption('changeset', 'suppress_file_diff', '',  
     169        """List of files for which no diffs should be displayed in the changesets.  
     170        Leave this option empty if users should see the diffs for all files  
     171        (under the constraints of options like max_diff_bytes and friends,  
     172        of course). Otherwise set it to a comma-separated list of names.  
     173        The list contains of glob patterns, i.e. "*" can be used as wildcard.""")  
     174     
    167175    # INavigationContributor methods 
    168176 
    169177    def get_active_navigation_item(self, req): 
     
    507515            The list is empty when no differences between comparable files 
    508516            are detected, but the return value is None for non-comparable files. 
    509517            """ 
     518            patterns = self.suppress_file_diff 
     519            if filter(None, [fnmatchcase(old_node.path, p) for p in patterns]):  
     520                return None  
     521              
     522            if filter(None, [fnmatchcase(new_node.path, p) for p in patterns]):  
     523                return None  
     524 
    510525            old_content = old_node.get_content().read() 
    511526            if is_binary(old_content): 
    512527                return None