src/hg-ssh
changeset 70 abb9ed8972e0
parent 69 e31646deafc8
child 71 1120f78f81da
equal deleted inserted replaced
69:e31646deafc8 70:abb9ed8972e0
    32 from mercurial import demandimport; demandimport.enable()
    32 from mercurial import demandimport; demandimport.enable()
    33 
    33 
    34 from mercurial import dispatch
    34 from mercurial import dispatch
    35 
    35 
    36 import sys, os
    36 import sys, os
    37 from mercurialserver import ruleset
    37 from mercurialserver import ruleset, paths
    38 
    38 
    39 def fail(message):
    39 def fail(message):
    40     #logfile.write("Fail: %s\n" % message)
    40     #logfile.write("Fail: %s\n" % message)
    41     sys.stderr.write(message + "\n")
    41     sys.stderr.write(message + "\n")
    42     sys.exit(-1)
    42     sys.exit(-1)
    71         % sys.argv)
    71         % sys.argv)
    72 
    72 
    73 remote_user = sys.argv[1]
    73 remote_user = sys.argv[1]
    74 os.environ['REMOTE_USER'] = remote_user
    74 os.environ['REMOTE_USER'] = remote_user
    75 
    75 
       
    76 os.environ['HG_ACCESS_RULES_PATH'] = (
       
    77     paths.getEtcPath() + "/access.conf" + ":" + 
       
    78     os.getcwd() + "/hgadmin/access.conf")
       
    79 
    76 rules = ruleset.rules_from_env()
    80 rules = ruleset.rules_from_env()
    77 rules.set(user = getpath(remote_user))
    81 rules.set(user = getpath(remote_user))
    78 rules.set(branch = None, file = None)
    82 rules.set(branch = None, file = None)
    79 try_cmd(rules, os.environ.get('SSH_ORIGINAL_COMMAND', '?'))
    83 try_cmd(rules, os.environ.get('SSH_ORIGINAL_COMMAND', '?'))