Mercurial > hg > config
comparison python/setup_repo.py @ 450:56fa913491a1
python/setup_repo.py
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Sat, 10 Aug 2013 16:22:23 -0700 |
| parents | f39d37973d4b |
| children | 96859ac4d23f |
comparison
equal
deleted
inserted
replaced
| 449:f39d37973d4b | 450:56fa913491a1 |
|---|---|
| 49 - push : protocol for push | 49 - push : protocol for push |
| 50 - remote_path : remote path of hg repository links; otherwise taken from --remote-url, if specified | 50 - remote_path : remote path of hg repository links; otherwise taken from --remote-url, if specified |
| 51 """ | 51 """ |
| 52 | 52 |
| 53 # parse remote URL | 53 # parse remote URL |
| 54 host, netloc, path, query, anchor = urlparse.urlsplit(options.remote_url) | 54 host, netloc, path, query, anchor = urlparse.urlsplit(remote_url) |
| 55 if options.remote_path: | 55 if options.remote_path: |
| 56 remote_host = host | 56 remote_host = host |
| 57 if ':' in remote_path: | 57 if ':' in remote_path: |
| 58 remote_host, remote_path = remote_path.split(':', 1) | 58 remote_host, remote_path = remote_path.split(':', 1) |
| 59 else: | 59 else: |
| 60 remote_path = path | 60 remote_path = path |
| 61 | 61 |
| 62 # setup remote repository | 62 # setup remote repository |
| 63 remote_dir = '%s/%s' % (path, name) | 63 remote_dir = '%s/%s' % (path, name) |
| 64 command = ['ssh', host, "mkdir -p %s && cd %s && hg init" % (remote_dir, remote_dir)] | 64 command = ['ssh', host, "mkdir -p %s && cd %s && hg init" % (remote_dir, remote_dir)] |
| 65 call(command) | 65 print command |
| 66 # call(command) | |
| 66 | 67 |
| 67 | 68 |
| 68 def main(args=sys.argv[1:]): | 69 def main(args=sys.argv[1:]): |
| 69 | 70 |
| 70 # parse command line arguments | 71 # parse command line arguments |
| 98 | 99 |
| 99 # setup remote, if specified | 100 # setup remote, if specified |
| 100 name = os.path.basename(directory) | 101 name = os.path.basename(directory) |
| 101 if options.remote_url: | 102 if options.remote_url: |
| 102 | 103 |
| 104 # setup remote repository | |
| 103 setup_remote(directory, options.remote_url, remote_path=options.remote_path) | 105 setup_remote(directory, options.remote_url, remote_path=options.remote_path) |
| 104 | 106 |
| 105 # push changes | 107 # push changes |
| 106 call(['hg', 'push', '-R', directory]) | 108 call(['hg', 'push', '-R', directory]) |
| 107 | 109 |
