Changeset 3203
- Timestamp:
- 02/09/08 05:15:12 (10 months ago)
- Files:
-
- gitplugin/0.11/gitplugin/git_fs.py (modified) (4 diffs)
- gitplugin/0.11/gitplugin/PyGIT.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gitplugin/0.11/gitplugin/git_fs.py
r3202 r3203 218 218 return rc 219 219 220 def clear(self, youngest_rev=None): 221 self.sync() 222 220 223 def sync(self, rev_callback=None): 221 224 if rev_callback: … … 231 234 232 235 class GitNode(Node): 233 def __init__(self, git, path, rev, tree_ls_info=None):236 def __init__(self, git, path, rev, ls_tree_info=None): 234 237 self.git = git 235 238 self.sha = None … … 240 243 p = path.strip('/') 241 244 if p != "": 242 if tree_ls_info == None or tree_ls_info == "":243 tree_ls_info = git.tree_ls(rev, p)244 if tree_ls_info != []:245 [ tree_ls_info] = tree_ls_info245 if ls_tree_info == None or ls_tree_info == "": 246 ls_tree_info = git.ls_tree(rev, p) 247 if ls_tree_info != []: 248 [ls_tree_info] = ls_tree_info 246 249 else: 247 tree_ls_info = None248 249 if tree_ls_info != None:250 (self.perm, k, self.sha, fn) = tree_ls_info250 ls_tree_info = None 251 252 if ls_tree_info != None: 253 (self.perm, k, self.sha, fn) = ls_tree_info 251 254 else: 252 255 k = 'blob' … … 295 298 p = self.path.strip('/') 296 299 if p != '': p = p + '/' 297 for e in self.git. tree_ls(self.rev, p):300 for e in self.git.ls_tree(self.rev, p): 298 301 yield GitNode(self.git, e[3], self.rev, e) 299 302 gitplugin/0.11/gitplugin/PyGIT.py
r3202 r3203 220 220 221 221 # should never be reached if db is consistent 222 raise GitError 222 raise GitError("internal inconsistency detected") 223 223 224 224 def hist_next_revision(self, sha): … … 287 287 return result 288 288 289 def tree_ls(self, rev, path=""):289 def ls_tree(self, rev, path=""): 290 290 rev = str(rev) # paranoia 291 291 if path.startswith('/'): … … 326 326 327 327 def get_obj_size(self, sha): 328 return int(self._git_call("cat-file", ["-s", str(sha)]).strip()) 328 sha = str(sha) 329 try: 330 return int(self._git_call("cat-file", ["-s", sha]).strip()) 331 except ValueError: 332 raise GitErrorSha("object '%s' not found" % sha) 329 333 330 334 def children(self, sha): … … 365 369 return [] 366 370 367 def history(self, sha, path, limit=None , skip=0):371 def history(self, sha, path, limit=None): 368 372 if limit is None: 369 373 limit = -1 … … 371 375 ["--max-count=%d" % limit, 372 376 str(sha), "--", path]).readlines(): 373 if(skip > 0):374 skip = skip - 1375 continue376 377 yield rev.strip() 377 378 … … 453 454 454 455 print "[%s]" % g.head() 455 print g. tree_ls(g.head())456 print g.ls_tree(g.head()) 456 457 print "--------------" 457 458 print g.read_commit(g.head())
