[PATCH] test-commandserver: use python instead of hg as the executable

Adrian Buehlmann adrian at cadifra.com
Sun Jun 17 04:23:17 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1339924726 -7200
# Node ID 20c4d99cc7e96666de519418df51b6d5b7d9fad2
# Parent  a0f221f45f846aea982355840c614d6fced41edb
test-commandserver: use python instead of hg as the executable

This eliminates the requirement (for this test) to have a hg.exe (on $PATH) when
running on Windows.

diff --git a/tests/test-commandserver.py b/tests/test-commandserver.py
--- a/tests/test-commandserver.py
+++ b/tests/test-commandserver.py
@@ -1,7 +1,10 @@
 import sys, os, struct, subprocess, cStringIO, re, shutil
 
+hgpath = '%s/../hg' % os.environ["TESTDIR"]
+hgcmd = 'python "%s"' % hgpath
+
 def connect(path=None):
-    cmdline = ['hg', 'serve', '--cmdserver', 'pipe']
+    cmdline = ['python', hgpath, 'serve', '--cmdserver', 'pipe']
     if path:
         cmdline += ['-R', path]
 
@@ -169,7 +172,7 @@
     f.write('a\n')
     f.close()
     runcommand(server, ['status'])
-    os.system('hg ci -Am2')
+    os.system(hgcmd + ' ci -Am2')
     runcommand(server, ['tip'])
     runcommand(server, ['status'])
 
@@ -178,12 +181,12 @@
     runcommand(server, ['bookmarks'])
 
     # changes .hg/bookmarks
-    os.system('hg bookmark -i bm1')
-    os.system('hg bookmark -i bm2')
+    os.system(hgcmd + ' bookmark -i bm1')
+    os.system(hgcmd + ' bookmark -i bm2')
     runcommand(server, ['bookmarks'])
 
     # changes .hg/bookmarks.current
-    os.system('hg upd bm1 -q')
+    os.system(hgcmd + ' upd bm1 -q')
     runcommand(server, ['bookmarks'])
 
     runcommand(server, ['bookmarks', 'bm3'])
@@ -196,13 +199,13 @@
 def tagscache(server):
     readchannel(server)
     runcommand(server, ['id', '-t', '-r', '0'])
-    os.system('hg tag -r 0 foo')
+    os.system(hgcmd + ' tag -r 0 foo')
     runcommand(server, ['id', '-t', '-r', '0'])
 
 def setphase(server):
     readchannel(server)
     runcommand(server, ['phase', '-r', '.'])
-    os.system('hg phase -r . -p')
+    os.system(hgcmd + ' phase -r . -p')
     runcommand(server, ['phase', '-r', '.'])
 
 def rollback(server):
@@ -218,9 +221,9 @@
 def branch(server):
     readchannel(server)
     runcommand(server, ['branch'])
-    os.system('hg branch foo')
+    os.system(hgcmd + ' branch foo')
     runcommand(server, ['branch'])
-    os.system('hg branch default')
+    os.system(hgcmd + ' branch default')
 
 def hgignore(server):
     readchannel(server)
@@ -237,7 +240,7 @@
     runcommand(server, ['status', '-i', '-u'])
 
 if __name__ == '__main__':
-    os.system('hg init')
+    os.system(hgcmd + ' init')
 
     check(hellomessage)
     check(unknowncommand)


More information about the Mercurial-devel mailing list