| 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 # |
| 11 # Unless required by applicable law or agreed to in writing, software | 11 # Unless required by applicable law or agreed to in writing, software |
| 12 # distributed under the License is distributed on an "AS IS" BASIS, | 12 # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 # See the License for the specific language governing permissions and | 14 # See the License for the specific language governing permissions and |
| 15 # limitations under the License. | 15 # limitations under the License. |
| 16 | 16 |
| 17 """A wrapper script to manage a set of client modules in different SCM. | 17 """A wrapper script to manage a set of client modules in different SCM. |
| 18 | 18 |
| 19 This script is intended to be used to help basic management of client | 19 This script is intended to be used to help basic management of client |
| 20 program sources residing in one or more Subversion modules, along with | 20 program sources residing in one or more Subversion modules and Git |
| 21 other modules it depends on, also in Subversion, but possibly on | 21 repositories, along with other modules it depends on, also in Subversion or Git, |
| 22 multiple respositories, making a wrapper system apparently necessary. | 22 but possibly on multiple respositories, making a wrapper system apparently |
| 23 necessary. |
| 23 | 24 |
| 24 Files | 25 Files |
| 25 .gclient : Current client configuration, written by 'config' command. | 26 .gclient : Current client configuration, written by 'config' command. |
| 26 Format is a Python script defining 'solutions', a list whose | 27 Format is a Python script defining 'solutions', a list whose |
| 27 entries each are maps binding the strings "name" and "url" | 28 entries each are maps binding the strings "name" and "url" |
| 28 to strings specifying the name and location of the client | 29 to strings specifying the name and location of the client |
| 29 module, as well as "custom_deps" to a map similar to the DEPS | 30 module, as well as "custom_deps" to a map similar to the DEPS |
| 30 file below. | 31 file below. |
| 31 .gclient_entries : A cache constructed by 'update' command. Format is a | 32 .gclient_entries : A cache constructed by 'update' command. Format is a |
| 32 Python script defining 'entries', a list of the names | 33 Python script defining 'entries', a list of the names |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 import urlparse | 79 import urlparse |
| 79 import urllib | 80 import urllib |
| 80 | 81 |
| 81 import breakpad | 82 import breakpad |
| 82 | 83 |
| 83 import gclient_scm | 84 import gclient_scm |
| 84 import gclient_utils | 85 import gclient_utils |
| 85 | 86 |
| 86 # default help text | 87 # default help text |
| 87 DEFAULT_USAGE_TEXT = ( | 88 DEFAULT_USAGE_TEXT = ( |
| 88 """usage: %prog <subcommand> [options] [--] [svn options/args...] | 89 """usage: %prog <subcommand> [options] [--] [SCM options/args...] |
| 89 a wrapper for managing a set of client modules in svn. | 90 a wrapper for managing a set of svn client modules and/or git repositories. |
| 90 Version """ + __version__ + """ | 91 Version """ + __version__ + """ |
| 91 | 92 |
| 92 subcommands: | 93 subcommands: |
| 93 cleanup | 94 cleanup |
| 94 config | 95 config |
| 95 diff | 96 diff |
| 96 export | 97 export |
| 97 pack | 98 pack |
| 98 revert | 99 revert |
| 99 status | 100 status |
| 100 sync | 101 sync |
| 101 update | 102 update |
| 102 runhooks | 103 runhooks |
| 103 revinfo | 104 revinfo |
| 104 | 105 |
| 105 Options and extra arguments can be passed to invoked svn commands by | 106 Options and extra arguments can be passed to invoked SCM commands by |
| 106 appending them to the command line. Note that if the first such | 107 appending them to the command line. Note that if the first such |
| 107 appended option starts with a dash (-) then the options must be | 108 appended option starts with a dash (-) then the options must be |
| 108 preceded by -- to distinguish them from gclient options. | 109 preceded by -- to distinguish them from gclient options. |
| 109 | 110 |
| 110 For additional help on a subcommand or examples of usage, try | 111 For additional help on a subcommand or examples of usage, try |
| 111 %prog help <subcommand> | 112 %prog help <subcommand> |
| 112 %prog help files | 113 %prog help files |
| 113 """) | 114 """) |
| 114 | 115 |
| 115 GENERIC_UPDATE_USAGE_TEXT = ( | 116 GENERIC_UPDATE_USAGE_TEXT = ( |
| 116 """Perform a checkout/update of the modules specified by the gclient | 117 """Perform a checkout/update of the modules specified by the gclient |
| 117 configuration; see 'help config'. Unless --revision is specified, | 118 configuration; see 'help config'. Unless --revision is specified, |
| 118 then the latest revision of the root solutions is checked out, with | 119 then the latest revision of the root solutions is checked out, with |
| 119 dependent submodule versions updated according to DEPS files. | 120 dependent submodule versions updated according to DEPS files. |
| 120 If --revision is specified, then the given revision is used in place | 121 If --revision is specified, then the given revision is used in place |
| 121 of the latest, either for a single solution or for all solutions. | 122 of the latest, either for a single solution or for all solutions. |
| 122 Unless the --force option is provided, solutions and modules whose | 123 Unless the --force option is provided, solutions and modules whose |
| 123 local revision matches the one to update (i.e., they have not changed | 124 local revision matches the one to update (i.e., they have not changed |
| 124 in the repository) are *not* modified. Unless --nohooks is provided, | 125 in the repository) are *not* modified. Unless --nohooks is provided, |
| 125 the hooks are run. | 126 the hooks are run. |
| 126 This a synonym for 'gclient %(alias)s' | 127 This a synonym for 'gclient %(alias)s' |
| 127 | 128 |
| 128 usage: gclient %(cmd)s [options] [--] [svn update options/args] | 129 usage: gclient %(cmd)s [options] [--] [SCM update options/args] |
| 129 | 130 |
| 130 Valid options: | 131 Valid options: |
| 131 --force : force update even for unchanged modules | 132 --force : force update even for unchanged modules |
| 132 --nohooks : don't run the hooks after the update is complete | 133 --nohooks : don't run the hooks after the update is complete |
| 133 --revision SOLUTION@REV : update given solution to specified revision | 134 --revision SOLUTION@REV : update given solution to specified revision |
| 134 --deps PLATFORM(S) : sync deps for the given platform(s), or 'all' | 135 --deps PLATFORM(S) : sync deps for the given platform(s), or 'all' |
| 135 --verbose : output additional diagnostics | 136 --verbose : output additional diagnostics |
| 136 --head : update to latest revision, instead of last good revi
sion | 137 --head : update to latest revision, instead of last good revi
sion |
| 137 | 138 |
| 138 Examples: | 139 Examples: |
| 139 gclient %(cmd)s | 140 gclient %(cmd)s |
| 140 update files from SVN according to current configuration, | 141 update files from SCM according to current configuration, |
| 141 *for modules which have changed since last update or sync* | 142 *for modules which have changed since last update or sync* |
| 142 gclient %(cmd)s --force | 143 gclient %(cmd)s --force |
| 143 update files from SVN according to current configuration, for | 144 update files from SCM according to current configuration, for |
| 144 all modules (useful for recovering files deleted from local copy) | 145 all modules (useful for recovering files deleted from local copy) |
| 145 gclient %(cmd)s --revision src@31000 | 146 gclient %(cmd)s --revision src@31000 |
| 146 update src directory to r31000 | 147 update src directory to r31000 |
| 147 """) | 148 """) |
| 148 | 149 |
| 149 COMMAND_USAGE_TEXT = { | 150 COMMAND_USAGE_TEXT = { |
| 150 "cleanup": | 151 "cleanup": |
| 151 """Clean up all working copies, using 'svn cleanup' for each module. | 152 """Clean up all working copies, using 'svn cleanup' for each module. |
| 152 Additional options and args may be passed to 'svn cleanup'. | 153 Additional options and args may be passed to 'svn cleanup'. |
| 153 | 154 |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 | 1189 |
| 1189 if "__main__" == __name__: | 1190 if "__main__" == __name__: |
| 1190 try: | 1191 try: |
| 1191 result = Main(sys.argv) | 1192 result = Main(sys.argv) |
| 1192 except gclient_utils.Error, e: | 1193 except gclient_utils.Error, e: |
| 1193 print >> sys.stderr, "Error: %s" % str(e) | 1194 print >> sys.stderr, "Error: %s" % str(e) |
| 1194 result = 1 | 1195 result = 1 |
| 1195 sys.exit(result) | 1196 sys.exit(result) |
| 1196 | 1197 |
| 1197 # vim: ts=2:sw=2:tw=80:et: | 1198 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |