diff options
author | W. Trevor King <wking@drexel.edu> | 2010-01-28 12:46:18 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2010-01-28 12:46:18 -0500 |
commit | 9ef5ba29e9fc2804784b7f33dde80000a16f43cb (patch) | |
tree | daca720b1f11e33a4f32d525d8e8149839a4bd80 /libbe/storage | |
parent | 76d983ec670ec7f09dace232e8553a80b2a08878 (diff) | |
download | bugseverywhere-9ef5ba29e9fc2804784b7f33dde80000a16f43cb.tar.gz |
Fix bzrlib.builtins.cmd_cat() output for pre 1.6.0 bzrlibs.
Fixed in bzr.dev
revno: 3341.2.1
revision-id: bialix@ukr.net-20080407074826-5lwuyv4dn1qlijg4
parent: pqm@pqm.ubuntu.com-20080407044456-s1a9orh0kssphdh9
committer: Alexander Belchenko <bialix@ukr.net>
branch nick: cmd-cat
timestamp: Mon 2008-04-07 10:48:26 +0300
message: `bzr cat` no more internally used Tree.print_file().
Merged into bzr.dev's trunk
revno: 3512 [merge]
revision-id: pqm@pqm.ubuntu.com-20080626004245-dnw85so4xqg8r9hy
parent: pqm@pqm.ubuntu.com-20080625230724-lyux37pu8nx8tq34
parent: aaron@aaronbentley.com-20080626001706-wo3w74fwgliy12s4
committer: Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-06-26 01:42:45 +0100
message: (bialix) Deprectate (Branch|Repository).print_file, fix cmd_cat
Before bzr branch 1.6
bzr.dev$ bzr tags
...
bzr-1.5rc1 3418.6.3
bzr-1.6 3606.5.9
...
Fixes:
python test.py -q libbe.storage.vcs.bzr
...............................FSome value:1E..
======================================================================
ERROR: Get should be able to return the previous version.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/wking/src/fun/be/be.wtk/libbe/storage/base.py", line 976, in test_
get_previous_version
ret = self.s.get(self.id, revision=revs[i])
File "/home/wking/src/fun/be/be.wtk/libbe/storage/base.py", line 335, in get
value = self._get(*args, **kwargs)
File "/home/wking/src/fun/be/be.wtk/libbe/storage/vcs/base.py", line 849, in _
get
raise InvalidID(id, revision)
InvalidID: unlikely id in revision 1
...
Diffstat (limited to 'libbe/storage')
-rw-r--r-- | libbe/storage/vcs/bzr.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libbe/storage/vcs/bzr.py b/libbe/storage/vcs/bzr.py index b617d68..03a64f8 100644 --- a/libbe/storage/vcs/bzr.py +++ b/libbe/storage/vcs/bzr.py @@ -172,12 +172,20 @@ 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: + # old bzrlib cmd_cat uses sys.stdout not self.outf for output. + stdout = sys.stdout + sys.stdout = cmd.outf try: cmd.run(filename=path, revision=revision) except bzrlib.errors.BzrCommandError, e: if 'not present in revision' in str(e): raise base.InvalidPath(path, root=self.repo, revision=revision) raise + finally: + if self.version_cmp(2,0,0) == -1: + cmd.outf = sys.stdout + sys.stdout = stdout return cmd.outf.getvalue() def _vcs_path(self, id, revision): @@ -200,7 +208,7 @@ class Bzr(base.VCS): cmd = bzrlib.builtins.cmd_ls() cmd.outf = StringIO.StringIO() try: - if self.version_cmp(2,0,0) == 1: + if self.version_cmp(2,0,0) >= 0: cmd.run(revision=revision, path=path, recursive=recursive) else: # Pre-2.0 Bazaar cmd.run(revision=revision, path=path, |