diff options
author | W. Trevor King <wking@drexel.edu> | 2009-12-28 13:22:27 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-12-28 13:22:27 -0500 |
commit | e0e7328742b92cb5e08aeec348fce966375d7d52 (patch) | |
tree | c9a1a14cbe6213b2ad9c23bbdfac63db121aba2b /libbe/storage/vcs | |
parent | c90044dff5feaf5f43fee9e8559fecec2ec60091 (diff) | |
download | bugseverywhere-e0e7328742b92cb5e08aeec348fce966375d7d52.tar.gz |
Updated Git backend to support .children(revision).
+ some minor fixes to vcs/base.py and vcs/bzr.py
Also removed .be/id-cache, which should never have been versioned in
the first place.
Diffstat (limited to 'libbe/storage/vcs')
-rw-r--r-- | libbe/storage/vcs/base.py | 6 | ||||
-rw-r--r-- | libbe/storage/vcs/bzr.py | 4 | ||||
-rw-r--r-- | libbe/storage/vcs/git.py | 20 |
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: |