diff options
author | W. Trevor King <wking@drexel.edu> | 2010-01-28 13:06:06 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2010-01-28 13:06:06 -0500 |
commit | 7e120421446f88f9bde0674f57fb1667c5f70ebd (patch) | |
tree | 0a08c4a643585300a631bd63c1c8fb457c2bf0ff /libbe | |
parent | 9ef5ba29e9fc2804784b7f33dde80000a16f43cb (diff) | |
download | bugseverywhere-7e120421446f88f9bde0674f57fb1667c5f70ebd.tar.gz |
Work around "bzr ls --non-recursive PATH : no list" bug in old bzrlib.
See: https://bugs.launchpad.net/bzr/+bug/158690
Bug affected versions:
0.90.0 (reported)
1.3.1 (my test suite hit it)
Doesn't affect versions:
2.0+ (non_recursive -> recursive)
But I haven't isolated the source more specifically.
Working around it for everything < 2.0 should be safe, but the cutoff
could be fine-tuned if someone wants to dig through the bzr.dev
history...
Diffstat (limited to 'libbe')
-rw-r--r-- | libbe/storage/vcs/bzr.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libbe/storage/vcs/bzr.py b/libbe/storage/vcs/bzr.py index 03a64f8..ce140bc 100644 --- a/libbe/storage/vcs/bzr.py +++ b/libbe/storage/vcs/bzr.py @@ -172,7 +172,7 @@ class Bzr(base.VCS): revision = self._parse_revision_string(revision) cmd = bzrlib.builtins.cmd_cat() cmd.outf = StringIO.StringIO() - if self.version_cmp(1,6,0) == -1: + if self.version_cmp(1,6,0) < 0: # old bzrlib cmd_cat uses sys.stdout not self.outf for output. stdout = sys.stdout sys.stdout = cmd.outf @@ -183,7 +183,7 @@ class Bzr(base.VCS): raise base.InvalidPath(path, root=self.repo, revision=revision) raise finally: - if self.version_cmp(2,0,0) == -1: + if self.version_cmp(2,0,0) < 0: cmd.outf = sys.stdout sys.stdout = stdout return cmd.outf.getvalue() @@ -210,15 +210,20 @@ class Bzr(base.VCS): try: if self.version_cmp(2,0,0) >= 0: cmd.run(revision=revision, path=path, recursive=recursive) - else: # Pre-2.0 Bazaar + else: + # Pre-2.0 Bazaar (non_recursive) + # + working around broken non_recursive+path implementation + # (https://bugs.launchpad.net/bzr/+bug/158690) cmd.run(revision=revision, path=path, - non_recursive=not recursive) + non_recursive=False) except bzrlib.errors.BzrCommandError, e: if 'not present in revision' in str(e): 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] + if self.version_cmp(2,0,0) < 0 and recursive == False: + children = [c for c in children if os.path.sep not in c] return children def _vcs_commit(self, commitfile, allow_empty=False): |