| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright 2008 Google Inc. All Rights Reserved. | 3 # Copyright 2008 Google Inc. All Rights Reserved. |
| 4 # | 4 # |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
| 7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
| 8 # | 8 # |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 # | 10 # |
| (...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 raise Error("required argument missing; see 'gclient help config'") | 1507 raise Error("required argument missing; see 'gclient help config'") |
| 1508 if os.path.exists(options.config_filename): | 1508 if os.path.exists(options.config_filename): |
| 1509 raise Error("%s file already exists in the current directory" % | 1509 raise Error("%s file already exists in the current directory" % |
| 1510 options.config_filename) | 1510 options.config_filename) |
| 1511 client = GClient('.', options) | 1511 client = GClient('.', options) |
| 1512 if options.spec: | 1512 if options.spec: |
| 1513 client.SetConfig(options.spec) | 1513 client.SetConfig(options.spec) |
| 1514 else: | 1514 else: |
| 1515 # TODO(darin): it would be nice to be able to specify an alternate relpath | 1515 # TODO(darin): it would be nice to be able to specify an alternate relpath |
| 1516 # for the given URL. | 1516 # for the given URL. |
| 1517 base_url = args[0] | 1517 base_url = args[0].rstrip('/') |
| 1518 name = args[0].split("/")[-1] | 1518 name = base_url.split("/")[-1] |
| 1519 safesync_url = "" | 1519 safesync_url = "" |
| 1520 if len(args) > 1: | 1520 if len(args) > 1: |
| 1521 safesync_url = args[1] | 1521 safesync_url = args[1] |
| 1522 client.SetDefaultConfig(name, base_url, safesync_url) | 1522 client.SetDefaultConfig(name, base_url, safesync_url) |
| 1523 client.SaveConfig() | 1523 client.SaveConfig() |
| 1524 | 1524 |
| 1525 | 1525 |
| 1526 def DoHelp(options, args): | 1526 def DoHelp(options, args): |
| 1527 """Handle the help subcommand giving help for another subcommand. | 1527 """Handle the help subcommand giving help for another subcommand. |
| 1528 | 1528 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 | 1736 |
| 1737 if "__main__" == __name__: | 1737 if "__main__" == __name__: |
| 1738 try: | 1738 try: |
| 1739 result = Main(sys.argv) | 1739 result = Main(sys.argv) |
| 1740 except Error, e: | 1740 except Error, e: |
| 1741 print >> sys.stderr, "Error: %s" % str(e) | 1741 print >> sys.stderr, "Error: %s" % str(e) |
| 1742 result = 1 | 1742 result = 1 |
| 1743 sys.exit(result) | 1743 sys.exit(result) |
| 1744 | 1744 |
| 1745 # vim: ts=2:sw=2:tw=80:et: | 1745 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |