Mercurial > evolve
annotate tests/dummyssh @ 1182:15492cea54e9 stable
readme: add a reference to the bugtracker in the contribute section
Idea from Patrick Mezard
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 08 Dec 2014 12:45:32 -0800 |
parents | 5b8d9c2ab480 |
children |
rev | line source |
---|---|
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)) |