Changeset 3238

Show
Ignore:
Timestamp:
02/15/08 03:36:44 (10 months ago)
Author:
hvr
Message:

GitPlugin: made git_version a static method of Storage

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gitplugin/0.11/tracext/git/git_fs.py

    r3235 r3238  
    6262 
    6363                try: 
    64                         self._version = PyGIT.git_version() 
     64                        self._version = PyGIT.Storage.git_version() 
    6565                except PyGIT.GitError, e: 
    6666                        self.log.error("GitError: "+e.message) 
  • gitplugin/0.11/tracext/git/PyGIT.py

    r3237 r3238  
    5252 
    5353 
    54 GIT_VERSION_MIN_REQUIRED = (1,5,2) # for PyGit.Storage 
    55  
    56 def git_version(): 
    57     try: 
    58         g = GitCore() 
    59         output = g.version() 
    60         [v] = output.readlines() 
    61         [a,b,version] = v.strip().split() 
    62         split_version = tuple(map(int, version.split('.'))) 
    63  
    64         result = {} 
    65         result['v_str'] = version 
    66         result['v_tuple'] = split_version 
    67         result['v_min_tuple'] = GIT_VERSION_MIN_REQUIRED 
    68         result['v_min_str'] = ".".join(map(str, GIT_VERSION_MIN_REQUIRED)) 
    69         result['v_compatible'] = split_version >= GIT_VERSION_MIN_REQUIRED 
    70         return result 
    71     except: 
    72         raise GitError("Could not retrieve GIT version") 
    73  
    7454# helper class for caching... 
    7555class SizedDict(dict): 
     
    134114 
    135115class Storage: 
     116    @staticmethod 
     117    def git_version(): 
     118        GIT_VERSION_MIN_REQUIRED = (1,5,2) 
     119        try: 
     120            g = GitCore() 
     121            output = g.version() 
     122            [v] = output.readlines() 
     123            [a,b,version] = v.strip().split() 
     124            split_version = tuple(map(int, version.split('.'))) 
     125 
     126            result = {} 
     127            result['v_str'] = version 
     128            result['v_tuple'] = split_version 
     129            result['v_min_tuple'] = GIT_VERSION_MIN_REQUIRED 
     130            result['v_min_str'] = ".".join(map(str, GIT_VERSION_MIN_REQUIRED)) 
     131            result['v_compatible'] = split_version >= GIT_VERSION_MIN_REQUIRED 
     132            return result 
     133        except: 
     134            raise GitError("Could not retrieve GIT version") 
     135 
    136136    def __init__(self, git_dir, log): 
    137137        self.logger = log