mercurial/commands.py
changeset 526 55af04e26bad
parent 525 337163e4d4b9
child 527 58790c83ce52
equal deleted inserted replaced
525:337163e4d4b9 526:55af04e26bad
   573     if not m:
   573     if not m:
   574         ui.warn("abort: couldn't parse destination %s\n" % dest)
   574         ui.warn("abort: couldn't parse destination %s\n" % dest)
   575         return 1
   575         return 1
   576 
   576 
   577     user, host, port, path = map(m.group, (2, 3, 5, 7))
   577     user, host, port, path = map(m.group, (2, 3, 5, 7))
   578     host = user and ("%s@%s" % (user, host)) or host
   578     uhost = user and ("%s@%s" % (user, host)) or host
   579     port = port and (" -p %s") % port or ""
   579     port = port and (" -p %s") % port or ""
   580     path = path or ""
   580     path = path or ""
   581 
   581 
   582     sport = random.randrange(30000, 60000)
   582     sport = random.randrange(30000, 60000)
   583     cmd = "ssh %s%s -R %d:localhost:%d 'cd %s; hg pull http://localhost:%d/'"
   583     cmd = "ssh %s%s -R %d:localhost:%d 'cd %s; hg pull http://localhost:%d/'"
   584     cmd = cmd % (host, port, sport+1, sport, path, sport+1)
   584     cmd = cmd % (uhost, port, sport+1, sport, path, sport+1)
   585 
   585 
   586     child = os.fork()
   586     child = os.fork()
   587     if not child:
   587     if not child:
   588         sys.stdout = file("/dev/null", "w")
   588         sys.stdout = file("/dev/null", "w")
   589         sys.stderr = sys.stdout
   589         sys.stderr = sys.stdout
   590         hgweb.server(repo.root, "pull", "", "localhost", sport)
   590         hgweb.server(repo.root, "pull", "", "localhost", sport)
   591     else:
   591     else:
       
   592         ui.status("connecting to %s\n" % host)
   592         r = os.system(cmd)
   593         r = os.system(cmd)
   593         os.kill(child, signal.SIGTERM)
   594         os.kill(child, signal.SIGTERM)
   594         return r
   595         return r
   595 
   596 
   596 def rawcommit(ui, repo, *flist, **rc):
   597 def rawcommit(ui, repo, *flist, **rc):