diff options
Diffstat (limited to 'libbe/storage/vcs/git.py')
-rw-r--r-- | libbe/storage/vcs/git.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libbe/storage/vcs/git.py b/libbe/storage/vcs/git.py index 8d1b529..35dcd68 100644 --- a/libbe/storage/vcs/git.py +++ b/libbe/storage/vcs/git.py @@ -118,6 +118,26 @@ class Git(base.VCS): status,output,error = self._u_invoke_client('show', arg) return output + + def _vcs_path(self, id, revision): + return self._u_find_id(id, revision) + + def _vcs_isdir(self, path, revision): + arg = '%s:%s' % (revision,path) + args = ['ls-tree', arg] + status,output,error = self._u_invoke_client(*args, expect=(0,128)) + if status != 0: + if 'not a tree object' in error: + return False + raise base.CommandError(args, status, stderr=error) + return True + + def _vcs_listdir(self, path, revision): + arg = '%s:%s' % (revision,path) + status,output,error = self._u_invoke_client( + 'ls-tree', '--name-only', arg) + return output.rstrip('\n').splitlines() + def _vcs_commit(self, commitfile, allow_empty=False): args = ['commit', '--all', '--file', commitfile] if allow_empty == True: |