Show
Ignore:
Timestamp:
2009年08月23日 12时15分25秒 (3 years ago)
Author:
jiangx
Message:

Fixed #26: EolStyleCheck? plugin enhancement : in loose mode, svn:eol-style no need for unix files.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pysvnmanager/hooks/plugins/EolStyleCheck.py

    r50 r92  
    3939     
    4040    # Plugin config option/value in config ini file. 
    41     key = "eol_style_check" 
    42     value = "yes" 
     41    key_switch = "eol_style_check" 
     42    key_force  = "eol_style_check_force" 
    4343     
    4444    section = 'pre_commit' 
     
    4949        Simply call 'has_config()'. 
    5050        """ 
    51         return self.has_config() 
     51        return self.has_config(self.key_switch) 
    5252     
    5353    def install_info(self): 
     
    5858        reST reference: http://docutils.sourceforge.net/docs/user/rst/quickref.html 
    5959        """ 
    60         return self.description 
     60        result = self.description 
     61        if self.enabled(): 
     62            result += "\n\n" 
     63            result += "**" + _("Current configuration") + "**\n\n" 
     64            force = self.get_config(self.key_force) 
     65            if force == "no": 
     66                result += "- " + _("Loose mode: permit checkin without svn:eol-style properity if no CRLF in text file.") 
     67            else: 
     68                result += "- " + _("Strict mode: must have svn:eol-style even if not CRLF in text file.") 
     69 
     70        return result 
     71  
    6172     
    6273    def install_config_form(self): 
     
    6677        Any html and javascript are welcome. 
    6778        """ 
    68         return "" 
     79        if self.get_config(self.key_force)=="no": 
     80            enable_checked  = "" 
     81            disable_checked = "checked" 
     82        else: 
     83            enable_checked  = "checked" 
     84            disable_checked = "" 
     85 
     86        result = "" 
     87        result += "<p><strong>%s</strong></p>" % _("Fill this form") 
     88        result += "<blockquote>" 
     89        result += "<dl>" 
     90        result += "\n<dt>" 
     91        result += "<input type='radio' name='force' value='yes' " + \ 
     92                enable_checked  + ">" + _("Strict mode") + "&nbsp;" 
     93        result += "\n<dd>" 
     94        result += _("Must set svn:eol-style even if CRLF not in text file (in Unix format).") 
     95        result += "\n<dt>" 
     96        result += "<input type='radio' name='force' value='no' " + \ 
     97                disable_checked + ">" + _("Loose mode") + "<br>" 
     98        result += "\n<dd>" 
     99        result += _("Permit checkin without svn:eol-style properity if is in Unix file format (no crlf in text file).") 
     100        result += "\n</dl>" 
     101        result += "</blockquote>" 
     102        return result 
    69103         
    70104    def uninstall(self): 
     
    73107        Simply call 'unset_config()' and 'save()'. 
    74108        """ 
    75         self.unset_config() 
     109        self.unset_config(self.key_switch) 
     110        self.unset_config(self.key_force) 
    76111        self.save() 
    77112     
     
    83118        Form fields in setup_config() will pass as params. 
    84119        """ 
    85         self.set_config() 
     120        force = params.get('force', 'no') 
     121        if force != 'no': 
     122            force = 'yes' 
     123        self.set_config(self.key_switch, 'yes') 
     124        self.set_config(self.key_force, force) 
    86125        self.save() 
    87126