aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-29 21:37:14 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-29 21:37:14 -0500
commit16877141d526a5387a0f673b56c1cd6f3b900674 (patch)
tree47698a705ccd89dd531c38d011a2b55ce483afb1 /libbe
parentec2472daa930a46949fcdb3fb9ca715f9bb3f200 (diff)
downloadbugseverywhere-16877141d526a5387a0f673b56c1cd6f3b900674.tar.gz
Correct for possible directory changes in mercurial.dispatch.dispatch()
I ran across this when the hg unittests broke the vcs.base unittests: $ python test.py libbe.storage.vcs.base libbe.storage.vcs.hg ... OK $ python test.py libbe.storage.vcs.hg libbe.storage.vcs.base ... File ".../libbe/storage/vcs/base.py", line 914, in libbe.storage.vcs.base.VCSTestCase.Class._u_rel_path Failed example: vcs._u_rel_path("./a", ".") Exception raised: Traceback (most recent call last): File "/usr/lib/python2.5/doctest.py", line 1228, in __run compileflags, 1) in test.globs File "<doctest libbe.storage.vcs.base.VCSTestCase.Class._u_rel_path[4]>", line 1, in <module> vcs._u_rel_path("./a", ".") File ".../libbe/storage/vcs/base.py", line 921, in _u_rel_path path = os.path.abspath(path) File "/usr/lib/python2.5/posixpath.py", line 403, in abspath path = join(os.getcwd(), path) OSError: [Errno 2] No such file or directory ... FAILED (failures=1)
Diffstat (limited to 'libbe')
-rw-r--r--libbe/storage/vcs/hg.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/libbe/storage/vcs/hg.py b/libbe/storage/vcs/hg.py
index b280ff2..11494a9 100644
--- a/libbe/storage/vcs/hg.py
+++ b/libbe/storage/vcs/hg.py
@@ -70,7 +70,9 @@ class Hg(base.VCS):
stdout = sys.stdout
tmp_stdout = StringIO.StringIO()
sys.stdout = tmp_stdout
+ cwd = os.getcwd()
mercurial.dispatch.dispatch(fullargs)
+ os.chdir(cwd)
sys.stdout = stdout
return tmp_stdout.getvalue().rstrip('\n')