mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 09:48:05 +03:00
93252b7fd2
Summary: Added passing BatchMode option to SSH call only when puchbackup runs in background. Also fixed dummyssh in skipping options before hostname, added unittest. Reviewed By: quark-zju Differential Revision: D7119123 fbshipit-source-id: 2c8e66fee44cca5b23389cba8e21e3a0b237268e
32 lines
746 B
Python
Executable File
32 lines
746 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
from __future__ import absolute_import
|
|
|
|
import os
|
|
import sys
|
|
|
|
os.chdir(os.getenv('TESTTMP'))
|
|
|
|
# Skipping SSH options
|
|
host_index = 1
|
|
while host_index < len(sys.argv) and sys.argv[host_index].startswith('-'):
|
|
host_index += 1
|
|
|
|
if sys.argv[host_index] != "user@dummy":
|
|
sys.exit(-1)
|
|
|
|
os.environ["SSH_CLIENT"] = "%s 1 2" % os.environ.get('LOCALIP', '127.0.0.1')
|
|
|
|
log = open("dummylog", "ab")
|
|
log.write("Got arguments")
|
|
for i, arg in enumerate(sys.argv[1:]):
|
|
log.write(" %d:%s" % (i + 1, arg))
|
|
log.write("\n")
|
|
log.close()
|
|
hgcmd = sys.argv[host_index + 1]
|
|
if os.name == 'nt':
|
|
# hack to make simple unix single quote quoting work on windows
|
|
hgcmd = hgcmd.replace("'", '"')
|
|
r = os.system(hgcmd)
|
|
sys.exit(bool(r))
|