Changeset 1536
- Timestamp:
- 11/11/06 03:04:33 (2 years ago)
- Files:
-
- gitplugin/0.10/gitplugin/git_fs.py (modified) (2 diffs)
- gitplugin/0.10/gitplugin/PyGIT.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gitplugin/0.10/gitplugin/git_fs.py
r1321 r1536 16 16 from trac.util import TracError, shorten_line, escape 17 17 from trac.versioncontrol import Changeset, Node, Repository, \ 18 IRepositoryConnector 18 IRepositoryConnector, NoSuchChangeset, NoSuchNode 19 19 20 20 import PyGIT … … 44 44 if rev=='None' or rev == None or rev == '': 45 45 return self.get_youngest_rev() 46 return rev 46 normrev=self.git.verifyrev(rev) 47 if normrev is None: 48 raise NoSuchChangeset(rev) 49 return normrev 50 51 def short_rev(self, rev): 52 return self.git.shortrev(self.normalize_rev(rev)) 47 53 48 54 def get_oldest_rev(self): gitplugin/0.10/gitplugin/PyGIT.py
r1380 r1536 14 14 15 15 import os, re 16 #from traceback import print_stack 16 17 17 18 class GitError(Exception): … … 39 40 40 41 def head(self): 41 return self._git_call("git-rev-parse --verify HEAD").strip() 42 "get current HEAD commit id" 43 return self.verifyrev("HEAD") 44 45 def verifyrev(self,rev): 46 "verify/lookup given revision object and return a sha id or None if lookup failed" 47 rc=self._git_call("git-rev-parse --verify '%s'" % rev).strip() 48 if len(rc)==0: 49 return None 50 return rc 51 52 def shortrev(self,rev): 53 "try to shorten sha id" 54 return self._git_call("git-rev-parse --short '%s'" % rev).strip() 55 56 def get_branches(self): 57 "returns list of branches, with active (i.e. HEAD) one being the first item" 58 result=[] 59 for e in self._git_call_f("git-branch").readlines(): 60 bname=e[1:].strip() 61 if e[0]=='*': 62 result.insert(0,bname) 63 else: 64 result.append(bname) 65 return result 42 66 43 67 def tree_ls(self,sha,path=""): … … 118 142 print "--------------" 119 143 print g.get_commit_encoding() 144 print "--------------" 145 print g.get_branches()
