diff options
author | W. Trevor King <wking@drexel.edu> | 2009-12-28 12:30:19 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-12-28 12:30:19 -0500 |
commit | c90044dff5feaf5f43fee9e8559fecec2ec60091 (patch) | |
tree | 6bce45819cb11d87f8bd80464568f9b1dcb5f40c /libbe/storage/vcs/bzr.py | |
parent | 2d6ed9ec7181ef805f305c6c8b7152c1b9ec6ec8 (diff) | |
download | bugseverywhere-c90044dff5feaf5f43fee9e8559fecec2ec60091.tar.gz |
Fixed VCS.children() and Bzr.children() for non-None revisions.
Now they both pass
VersionedStorage_commit_TestCase.test_commit_revision_ids()
The .children() implementation for previous revisions lacks the
working directory's id<->path cache, so it's fairly slow...
Diffstat (limited to 'libbe/storage/vcs/bzr.py')
-rw-r--r-- | libbe/storage/vcs/bzr.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/libbe/storage/vcs/bzr.py b/libbe/storage/vcs/bzr.py index 4e3f330..d6e7799 100644 --- a/libbe/storage/vcs/bzr.py +++ b/libbe/storage/vcs/bzr.py @@ -129,10 +129,37 @@ 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) + raise base.InvalidID(path, revision) raise return cmd.outf.getvalue() + def _vcs_path(self, id, revision): + return self._u_find_id(id, revision) + + def _vcs_isdir(self, path, revision): + try: + self._vcs_listdir(path, revision) + except AttributeError, e: + if 'children' in str(e): + return False + raise + return True + + def _vcs_listdir(self, path, revision): + path = os.path.join(self.repo, path) + revision = self._parse_revision_string(revision) + cmd = bzrlib.builtins.cmd_ls() + cmd.outf = StringIO.StringIO() + try: + 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 + children = cmd.outf.getvalue().rstrip('\n').splitlines() + children = [self._u_rel_path(c, path) for c in children] + return children + def _vcs_commit(self, commitfile, allow_empty=False): cmd = bzrlib.builtins.cmd_commit() cmd.outf = StringIO.StringIO() |