diff options
-rw-r--r-- | manifest_xml.py | 6 | ||||
-rwxr-xr-x | repo | 4 | ||||
-rw-r--r-- | subcmds/init.py | 39 |
3 files changed, 43 insertions, 6 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 9189eec4..c9e5c405 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -228,7 +228,11 @@ class XmlManifest(object): | |||
228 | @property | 228 | @property |
229 | def manifest_server(self): | 229 | def manifest_server(self): |
230 | self._Load() | 230 | self._Load() |
231 | return self._manifest_server | 231 | |
232 | if self._manifest_server: | ||
233 | return self._manifest_server | ||
234 | |||
235 | return self.manifestProject.config.GetString('repo.manifest-server') | ||
232 | 236 | ||
233 | @property | 237 | @property |
234 | def IsMirror(self): | 238 | def IsMirror(self): |
@@ -28,7 +28,7 @@ if __name__ == '__main__': | |||
28 | del magic | 28 | del magic |
29 | 29 | ||
30 | # increment this whenever we make important changes to this script | 30 | # increment this whenever we make important changes to this script |
31 | VERSION = (1, 13) | 31 | VERSION = (1, 14) |
32 | 32 | ||
33 | # increment this if the MAINTAINER_KEYS block is modified | 33 | # increment this if the MAINTAINER_KEYS block is modified |
34 | KEYRING_VERSION = (1,0) | 34 | KEYRING_VERSION = (1,0) |
@@ -149,7 +149,7 @@ def _Init(args): | |||
149 | """Installs repo by cloning it over the network. | 149 | """Installs repo by cloning it over the network. |
150 | """ | 150 | """ |
151 | opt, args = init_optparse.parse_args(args) | 151 | opt, args = init_optparse.parse_args(args) |
152 | if args or not opt.manifest_url: | 152 | if args: |
153 | init_optparse.print_usage() | 153 | init_optparse.print_usage() |
154 | sys.exit(1) | 154 | sys.exit(1) |
155 | 155 | ||
diff --git a/subcmds/init.py b/subcmds/init.py index 1c23d620..e80d698b 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -23,6 +23,7 @@ from error import ManifestParseError | |||
23 | from project import SyncBuffer | 23 | from project import SyncBuffer |
24 | from git_config import GitConfig | 24 | from git_config import GitConfig |
25 | from git_command import git_require, MIN_GIT_VERSION | 25 | from git_command import git_require, MIN_GIT_VERSION |
26 | from git_config import GitConfig | ||
26 | 27 | ||
27 | class Init(InteractiveCommand, MirrorSafeCommand): | 28 | class Init(InteractiveCommand, MirrorSafeCommand): |
28 | common = True | 29 | common = True |
@@ -36,6 +37,20 @@ The latest repo source code and manifest collection is downloaded | |||
36 | from the server and is installed in the .repo/ directory in the | 37 | from the server and is installed in the .repo/ directory in the |
37 | current working directory. | 38 | current working directory. |
38 | 39 | ||
40 | The optional -u argument can be used to specify a URL to the | ||
41 | manifest project. It is also possible to have a git configuration | ||
42 | section as below to use 'identifier' as argument to -u: | ||
43 | |||
44 | [repo-manifest "identifier"] | ||
45 | url = ... | ||
46 | server = ... | ||
47 | reference = ... | ||
48 | |||
49 | Only the url is required - the others are optional. | ||
50 | |||
51 | If no -u argument is specified, the 'repo-manifest' section named | ||
52 | 'default' will be used if present. | ||
53 | |||
39 | The optional -b argument can be used to select the manifest branch | 54 | The optional -b argument can be used to select the manifest branch |
40 | to checkout and use. If no branch is specified, master is assumed. | 55 | to checkout and use. If no branch is specified, master is assumed. |
41 | 56 | ||
@@ -69,7 +84,7 @@ to update the working directory files. | |||
69 | # Manifest | 84 | # Manifest |
70 | g = p.add_option_group('Manifest options') | 85 | g = p.add_option_group('Manifest options') |
71 | g.add_option('-u', '--manifest-url', | 86 | g.add_option('-u', '--manifest-url', |
72 | dest='manifest_url', | 87 | dest='manifest_url', default='default', |
73 | help='manifest repository location', metavar='URL') | 88 | help='manifest repository location', metavar='URL') |
74 | g.add_option('-b', '--manifest-branch', | 89 | g.add_option('-b', '--manifest-branch', |
75 | dest='manifest_branch', | 90 | dest='manifest_branch', |
@@ -102,10 +117,25 @@ to update the working directory files. | |||
102 | def _SyncManifest(self, opt): | 117 | def _SyncManifest(self, opt): |
103 | m = self.manifest.manifestProject | 118 | m = self.manifest.manifestProject |
104 | is_new = not m.Exists | 119 | is_new = not m.Exists |
120 | manifest_server = None | ||
121 | |||
122 | # The manifest url may point out a manifest section in the config | ||
123 | key = 'repo-manifest.%s.' % opt.manifest_url | ||
124 | if GitConfig.ForUser().GetString(key + 'url'): | ||
125 | opt.manifest_url = GitConfig.ForUser().GetString(key + 'url') | ||
126 | |||
127 | # Also copy other options to the manifest config if not specified already. | ||
128 | if not opt.reference: | ||
129 | opt.reference = GitConfig.ForUser().GetString(key + 'reference') | ||
130 | manifest_server = GitConfig.ForUser().GetString(key + 'server') | ||
105 | 131 | ||
106 | if is_new: | 132 | if is_new: |
107 | if not opt.manifest_url: | 133 | if not opt.manifest_url or opt.manifest_url == 'default': |
108 | print >>sys.stderr, 'fatal: manifest url (-u) is required.' | 134 | print >>sys.stderr, """\ |
135 | fatal: missing manifest url (-u) and no default found. | ||
136 | |||
137 | tip: The global git configuration key 'repo-manifest.default.url' can | ||
138 | be used to specify a default url.""" | ||
109 | sys.exit(1) | 139 | sys.exit(1) |
110 | 140 | ||
111 | if not opt.quiet: | 141 | if not opt.quiet: |
@@ -129,6 +159,9 @@ to update the working directory files. | |||
129 | r.ResetFetch() | 159 | r.ResetFetch() |
130 | r.Save() | 160 | r.Save() |
131 | 161 | ||
162 | if manifest_server: | ||
163 | m.config.SetString('repo.manifest-server', manifest_server) | ||
164 | |||
132 | if opt.reference: | 165 | if opt.reference: |
133 | m.config.SetString('repo.reference', opt.reference) | 166 | m.config.SetString('repo.reference', opt.reference) |
134 | 167 | ||