author | Martin von Zweigbergk <martinvonz@google.com> |
Wed, 05 Nov 2014 15:35:13 -0800 | |
branch | stable |
changeset 1153 | 4241a5162de7 |
parent 943 | 5b8d9c2ab480 |
permissions | -rwxr-xr-x |
943
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
2 |
|
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
3 |
import sys |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
4 |
import os |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
5 |
|
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
6 |
os.chdir(os.getenv('TESTTMP')) |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
7 |
|
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
8 |
if sys.argv[1] != "user@dummy": |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
9 |
sys.exit(-1) |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
10 |
|
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
11 |
os.environ["SSH_CLIENT"] = "127.0.0.1 1 2" |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
12 |
|
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
13 |
log = open("dummylog", "ab") |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
14 |
log.write("Got arguments") |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
15 |
for i, arg in enumerate(sys.argv[1:]): |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
16 |
log.write(" %d:%s" % (i + 1, arg)) |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
17 |
log.write("\n") |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
18 |
log.close() |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
19 |
hgcmd = sys.argv[2] |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
20 |
if os.name == 'nt': |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
21 |
# hack to make simple unix single quote quoting work on windows |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
22 |
hgcmd = hgcmd.replace("'", '"') |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
23 |
r = os.system(hgcmd) |
5b8d9c2ab480
evolve: test exchange through wireprotocol
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
24 |
sys.exit(bool(r)) |