tests/dummyssh
author Laurent Charignon <lcharignon@fb.com>
Thu, 30 Apr 2015 14:47:01 -0700
branchstable
changeset 1308 676d88a82d4a
parent 943 5b8d9c2ab480
permissions -rwxr-xr-x
evolve: improve transaction related code to use the lock module Refactored some of the places where we are using locking in evolve to use the lock module and write less code. This should also fix a couple of bug where tr could be None at release time.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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))