aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2011-09-07 22:54:00 -0400
committerW. Trevor King <wking@drexel.edu>2011-09-07 22:55:40 -0400
commit7d207f7c040db85da48ce3930663cfa10aa88864 (patch)
tree0217564b76091495ba9672e9db6f1d9cdeaf4585 /libbe/storage
parentd5e6385f6fa162a4f41219d4f523cc27446defcd (diff)
downloadbugseverywhere-7d207f7c040db85da48ce3930663cfa10aa88864.tar.gz
Adjust Mercurial execution so it works with version 1.9 and earlier.
This makes the changes for 1.9 brought in by bb645f8e489b9f50cd0aec7237ec9adb721797a8 optional. If the Mercurial version is 1.9 or greater, the new code is used. Otherwise, the old code is used.
Diffstat (limited to 'libbe/storage')
-rw-r--r--libbe/storage/vcs/hg.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/libbe/storage/vcs/hg.py b/libbe/storage/vcs/hg.py
index acf391d..b61e796 100644
--- a/libbe/storage/vcs/hg.py
+++ b/libbe/storage/vcs/hg.py
@@ -83,10 +83,16 @@ class Hg(base.VCS):
assert len(kwargs) == 1, kwargs
fullargs = ['--cwd', kwargs['cwd']]
fullargs.extend(args)
- output = StringIO.StringIO()
cwd = os.getcwd()
- req = mercurial.dispatch.request(fullargs, fout=output)
- mercurial.dispatch.dispatch(req)
+ output = StringIO.StringIO()
+ if self.version_cmp(1,9):
+ req = mercurial.dispatch.request(fullargs, fout=output)
+ mercurial.dispatch.dispatch(req)
+ else:
+ stdout = sys.stdout
+ sys.stdout = output
+ mercurial.dispatch.dispatch(fullargs)
+ sys.stdout = stdout
os.chdir(cwd)
return output.getvalue().rstrip('\n')