##// END OF EJS Templates
Switch push over to the new scheme...
Matt Mackall -
r640:b48b91d3 default
parent child Browse files
Show More
@@ -758,35 +758,11 b' def pull(ui, repo, source="default", **o'
758 758 def push(ui, repo, dest="default-push"):
759 759 """push changes to the specified destination"""
760 760 dest = ui.expandpath(dest)
761
762 if not dest.startswith("ssh://"):
763 ui.warn("abort: can only push to ssh:// destinations currently\n")
764 return 1
765
766 m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', dest)
767 if not m:
768 ui.warn("abort: couldn't parse destination %s\n" % dest)
769 return 1
770
771 user, host, port, path = map(m.group, (2, 3, 5, 7))
772 uhost = user and ("%s@%s" % (user, host)) or host
773 port = port and (" -p %s") % port or ""
774 path = path or ""
761 ui.status('pushing to %s\n' % (dest))
775 762
776 sport = random.randrange(30000, 60000)
777 cmd = "ssh %s%s -R %d:localhost:%d 'cd %s; hg pull http://localhost:%d/'"
778 cmd = cmd % (uhost, port, sport+1, sport, path, sport+1)
779
780 child = os.fork()
781 if not child:
782 sys.stdout = file("/dev/null", "w")
783 sys.stderr = sys.stdout
784 hgweb.server(repo.root, "pull", "", "localhost", sport)
785 else:
786 ui.status("connecting to %s\n" % host)
787 r = os.system(cmd)
788 os.kill(child, signal.SIGTERM)
789 return r
763 other = hg.repository(ui, dest)
764 r = repo.push(other)
765 return r
790 766
791 767 def rawcommit(ui, repo, *flist, **rc):
792 768 "raw commit interface"
General Comments 0
You need to be logged in to leave comments. Login now