aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage/vcs/bzr.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2011-02-22 15:38:03 -0500
committerW. Trevor King <wking@drexel.edu>2011-02-22 15:38:03 -0500
commit0d9ec7c727ff624ee1905831e806cab8c9e65537 (patch)
tree45a384b244c4c824bea91447302c1801941c3927 /libbe/storage/vcs/bzr.py
parent791da71e5c0d2a42eb6efe5c3a2d030b3bde4cfb (diff)
downloadbugseverywhere-0d9ec7c727ff624ee1905831e806cab8c9e65537.tar.gz
Don't call cmd.cleanup_now() for recent Bazaar versions.
Bug reported by Michael Chaffin: > C:\XXX\ZZZ>be init > Traceback (most recent call last): > ... > AttributeError: 'cmd_root' object has no attribute '_operation' Due to changes in bzrlib: revno: 5146 [merge] committer: Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com> branch nick: +trunk timestamp: Mon 2010-04-12 04:09:46 +0100 So for versions of bzr since then, we don't have to worry about calling cleanup_now() anymore.
Diffstat (limited to 'libbe/storage/vcs/bzr.py')
-rw-r--r--libbe/storage/vcs/bzr.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/libbe/storage/vcs/bzr.py b/libbe/storage/vcs/bzr.py
index 1862975..f426612 100644
--- a/libbe/storage/vcs/bzr.py
+++ b/libbe/storage/vcs/bzr.py
@@ -136,14 +136,16 @@ class Bzr(base.VCS):
cmd = bzrlib.builtins.cmd_root()
cmd.outf = StringIO.StringIO()
cmd.run(filename=path)
- cmd.cleanup_now()
+ if self.version_cmp(2,3,0) < 0:
+ cmd.cleanup_now()
return cmd.outf.getvalue().rstrip('\n')
def _vcs_init(self, path):
cmd = bzrlib.builtins.cmd_init()
cmd.outf = StringIO.StringIO()
cmd.run(location=path)
- cmd.cleanup_now()
+ if self.version_cmp(2,3,0) < 0:
+ cmd.cleanup_now()
def _vcs_destroy(self):
vcs_dir = os.path.join(self.repo, '.bzr')
@@ -155,7 +157,8 @@ class Bzr(base.VCS):
cmd = bzrlib.builtins.cmd_add()
cmd.outf = StringIO.StringIO()
cmd.run(file_list=[path], file_ids_from=self.repo)
- cmd.cleanup_now()
+ if self.version_cmp(2,3,0) < 0:
+ cmd.cleanup_now()
def _vcs_exists(self, path, revision=None):
manifest = self._vcs_listdir(
@@ -170,7 +173,8 @@ class Bzr(base.VCS):
cmd = bzrlib.builtins.cmd_remove()
cmd.outf = StringIO.StringIO()
cmd.run(file_list=[path], file_deletion_strategy='force')
- cmd.cleanup_now()
+ if self.version_cmp(2,3,0) < 0:
+ cmd.cleanup_now()
def _vcs_update(self, path):
pass
@@ -206,7 +210,8 @@ class Bzr(base.VCS):
if self.version_cmp(2,0,0) < 0:
cmd.outf = sys.stdout
sys.stdout = stdout
- cmd.cleanup_now()
+ if self.version_cmp(2,3,0) < 0:
+ cmd.cleanup_now()
return cmd.outf.getvalue()
def _vcs_path(self, id, revision):
@@ -242,7 +247,8 @@ class Bzr(base.VCS):
raise base.InvalidPath(path, root=self.repo, revision=revision)
raise
finally:
- cmd.cleanup_now()
+ if self.version_cmp(2,3,0) < 0:
+ cmd.cleanup_now()
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:
@@ -264,14 +270,16 @@ class Bzr(base.VCS):
raise
finally:
os.chdir(cwd)
- cmd.cleanup_now()
+ if self.version_cmp(2,3,0) < 0:
+ cmd.cleanup_now()
return self._vcs_revision_id(-1)
def _vcs_revision_id(self, index):
cmd = bzrlib.builtins.cmd_revno()
cmd.outf = StringIO.StringIO()
cmd.run(location=self.repo)
- cmd.cleanup_now()
+ if self.version_cmp(2,3,0) < 0:
+ cmd.cleanup_now()
current_revision = int(cmd.outf.getvalue())
if index > current_revision or index < -current_revision:
return None
@@ -290,7 +298,8 @@ class Bzr(base.VCS):
status = cmd.run(revision=revision, file_list=[self.repo])
finally:
sys.stdout = stdout
- cmd.cleanup_now()
+ if self.version_cmp(2,3,0) < 0:
+ cmd.cleanup_now()
assert status in [0,1], "Invalid status %d" % status
return cmd.outf.getvalue()