aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage
diff options
context:
space:
mode:
Diffstat (limited to 'libbe/storage')
-rw-r--r--libbe/storage/vcs/base.py6
-rw-r--r--libbe/storage/vcs/bzr.py4
-rw-r--r--libbe/storage/vcs/git.py20
3 files changed, 26 insertions, 4 deletions
diff --git a/libbe/storage/vcs/base.py b/libbe/storage/vcs/base.py
index 3b66019..8a8b3ca 100644
--- a/libbe/storage/vcs/base.py
+++ b/libbe/storage/vcs/base.py
@@ -783,9 +783,11 @@ os.listdir(self.get_path("bugs")):
return default
relpath = self._u_rel_path(path)
try:
- contents = self._vcs_get_file_contents(relpath,revision)
+ contents = self._vcs_get_file_contents(relpath, revision)
except InvalidID, e:
- raise InvalidPath(path=path, root=self.repo, id=id)
+ if InvalidID == None:
+ e.id = InvalidID
+ raise
if contents in [libbe.storage.base.InvalidDirectory,
libbe.util.InvalidObject]:
raise InvalidID(id)
diff --git a/libbe/storage/vcs/bzr.py b/libbe/storage/vcs/bzr.py
index d6e7799..397267a 100644
--- a/libbe/storage/vcs/bzr.py
+++ b/libbe/storage/vcs/bzr.py
@@ -129,7 +129,7 @@ class Bzr(base.VCS):
cmd.run(filename=path, revision=revision)
except bzrlib.errors.BzrCommandError, e:
if 'not present in revision' in str(e):
- raise base.InvalidID(path, revision)
+ raise base.InvalidPath(path, root=self.repo, revision=revision)
raise
return cmd.outf.getvalue()
@@ -154,7 +154,7 @@ class Bzr(base.VCS):
cmd.run(revision=revision, path=path)
except bzrlib.errors.BzrCommandError, e:
if 'not present in revision' in str(e):
- raise base.InvalidID(path, revision)
+ raise base.InvalidPath(path, root=self.repo, revision=revision)
raise
children = cmd.outf.getvalue().rstrip('\n').splitlines()
children = [self._u_rel_path(c, path) for c in children]
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: