summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/manifest-format.txt21
-rw-r--r--git_command.py4
-rw-r--r--git_config.py4
-rwxr-xr-xmain.py7
-rw-r--r--manifest_xml.py20
-rw-r--r--project.py2
-rw-r--r--subcmds/sync.py12
7 files changed, 48 insertions, 22 deletions
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt
index f499868c..9589352e 100644
--- a/docs/manifest-format.txt
+++ b/docs/manifest-format.txt
@@ -224,15 +224,19 @@ Attribute `name`; the manifest to include, specified relative to
224the manifest repositories root. 224the manifest repositories root.
225 225
226 226
227Local Manifest 227Local Manifests
228============== 228===============
229 229
230Additional remotes and projects may be added through a local 230Additional remotes and projects may be added through local manifest
231manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. 231files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.
232 232
233For example: 233For example:
234 234
235 $ cat .repo/local_manifest.xml 235 $ ls .repo/local_manifests
236 local_manifest.xml
237 another_local_manifest.xml
238
239 $ cat .repo/local_manifests/local_manifest.xml
236 <?xml version="1.0" encoding="UTF-8"?> 240 <?xml version="1.0" encoding="UTF-8"?>
237 <manifest> 241 <manifest>
238 <project path="manifest" 242 <project path="manifest"
@@ -241,6 +245,11 @@ For example:
241 name="platform/manifest" /> 245 name="platform/manifest" />
242 </manifest> 246 </manifest>
243 247
244Users may add projects to the local manifest prior to a `repo sync` 248Users may add projects to the local manifest(s) prior to a `repo sync`
245invocation, instructing repo to automatically download and manage 249invocation, instructing repo to automatically download and manage
246these extra projects. 250these extra projects.
251
252Additional remotes and projects may also be added through a local
253manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method
254is deprecated in favor of using multiple manifest files as mentioned
255above.
diff --git a/git_command.py b/git_command.py
index 39f795ff..e5e28f3c 100644
--- a/git_command.py
+++ b/git_command.py
@@ -88,7 +88,7 @@ class _GitCall(object):
88 ver_str = git.version() 88 ver_str = git.version()
89 if ver_str.startswith('git version '): 89 if ver_str.startswith('git version '):
90 _git_version = tuple( 90 _git_version = tuple(
91 map(lambda x: int(x), 91 map(int,
92 ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3] 92 ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3]
93 )) 93 ))
94 else: 94 else:
@@ -110,7 +110,7 @@ def git_require(min_version, fail=False):
110 if min_version <= git_version: 110 if min_version <= git_version:
111 return True 111 return True
112 if fail: 112 if fail:
113 need = '.'.join(map(lambda x: str(x), min_version)) 113 need = '.'.join(map(str, min_version))
114 print >>sys.stderr, 'fatal: git %s or later required' % need 114 print >>sys.stderr, 'fatal: git %s or later required' % need
115 sys.exit(1) 115 sys.exit(1)
116 return False 116 return False
diff --git a/git_config.py b/git_config.py
index 645c97ab..f60893ee 100644
--- a/git_config.py
+++ b/git_config.py
@@ -537,7 +537,7 @@ class Remote(object):
537 self.url = self._Get('url') 537 self.url = self._Get('url')
538 self.review = self._Get('review') 538 self.review = self._Get('review')
539 self.projectname = self._Get('projectname') 539 self.projectname = self._Get('projectname')
540 self.fetch = map(lambda x: RefSpec.FromString(x), 540 self.fetch = map(RefSpec.FromString,
541 self._Get('fetch', all_keys=True)) 541 self._Get('fetch', all_keys=True))
542 self._review_url = None 542 self._review_url = None
543 543
@@ -657,7 +657,7 @@ class Remote(object):
657 self._Set('url', self.url) 657 self._Set('url', self.url)
658 self._Set('review', self.review) 658 self._Set('review', self.review)
659 self._Set('projectname', self.projectname) 659 self._Set('projectname', self.projectname)
660 self._Set('fetch', map(lambda x: str(x), self.fetch)) 660 self._Set('fetch', map(str, self.fetch))
661 661
662 def _Set(self, key, value): 662 def _Set(self, key, value):
663 key = 'remote.%s.%s' % (self.name, key) 663 key = 'remote.%s.%s' % (self.name, key)
diff --git a/main.py b/main.py
index 14a57618..0c87c38a 100755
--- a/main.py
+++ b/main.py
@@ -195,12 +195,12 @@ def _CheckWrapperVersion(ver, repo_path):
195 sys.exit(1) 195 sys.exit(1)
196 196
197 exp = _CurrentWrapperVersion() 197 exp = _CurrentWrapperVersion()
198 ver = tuple(map(lambda x: int(x), ver.split('.'))) 198 ver = tuple(map(int, ver.split('.')))
199 if len(ver) == 1: 199 if len(ver) == 1:
200 ver = (0, ver[0]) 200 ver = (0, ver[0])
201 201
202 exp_str = '.'.join(map(str, exp))
202 if exp[0] > ver[0] or ver < (0, 4): 203 if exp[0] > ver[0] or ver < (0, 4):
203 exp_str = '.'.join(map(lambda x: str(x), exp))
204 print >>sys.stderr, """ 204 print >>sys.stderr, """
205!!! A new repo command (%5s) is available. !!! 205!!! A new repo command (%5s) is available. !!!
206!!! You must upgrade before you can continue: !!! 206!!! You must upgrade before you can continue: !!!
@@ -210,7 +210,6 @@ def _CheckWrapperVersion(ver, repo_path):
210 sys.exit(1) 210 sys.exit(1)
211 211
212 if exp > ver: 212 if exp > ver:
213 exp_str = '.'.join(map(lambda x: str(x), exp))
214 print >>sys.stderr, """ 213 print >>sys.stderr, """
215... A new repo command (%5s) is available. 214... A new repo command (%5s) is available.
216... You should upgrade soon: 215... You should upgrade soon:
@@ -272,7 +271,7 @@ def _UserAgent():
272 _user_agent = 'git-repo/%s (%s) git/%s Python/%d.%d.%d' % ( 271 _user_agent = 'git-repo/%s (%s) git/%s Python/%d.%d.%d' % (
273 repo_version, 272 repo_version,
274 os_name, 273 os_name,
275 '.'.join(map(lambda d: str(d), git.version_tuple())), 274 '.'.join(map(str, git.version_tuple())),
276 py_version[0], py_version[1], py_version[2]) 275 py_version[0], py_version[1], py_version[2])
277 return _user_agent 276 return _user_agent
278 277
diff --git a/manifest_xml.py b/manifest_xml.py
index cdee87a6..d16f1a98 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -27,6 +27,7 @@ from error import ManifestParseError
27 27
28MANIFEST_FILE_NAME = 'manifest.xml' 28MANIFEST_FILE_NAME = 'manifest.xml'
29LOCAL_MANIFEST_NAME = 'local_manifest.xml' 29LOCAL_MANIFEST_NAME = 'local_manifest.xml'
30LOCAL_MANIFESTS_DIR_NAME = 'local_manifests'
30 31
31urlparse.uses_relative.extend(['ssh', 'git']) 32urlparse.uses_relative.extend(['ssh', 'git'])
32urlparse.uses_netloc.extend(['ssh', 'git']) 33urlparse.uses_netloc.extend(['ssh', 'git'])
@@ -299,8 +300,21 @@ class XmlManifest(object):
299 300
300 local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME) 301 local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME)
301 if os.path.exists(local): 302 if os.path.exists(local):
303 print >>sys.stderr, 'warning: %s is deprecated; put local manifests in %s instead' % \
304 (LOCAL_MANIFEST_NAME, LOCAL_MANIFESTS_DIR_NAME)
302 nodes.append(self._ParseManifestXml(local, self.repodir)) 305 nodes.append(self._ParseManifestXml(local, self.repodir))
303 306
307 local_dir = os.path.abspath(os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME))
308 try:
309 for local_file in os.listdir(local_dir):
310 if local_file.endswith('.xml'):
311 try:
312 nodes.append(self._ParseManifestXml(local_file, self.repodir))
313 except ManifestParseError as e:
314 print >>sys.stderr, '%s' % str(e)
315 except OSError:
316 pass
317
304 self._ParseManifest(nodes) 318 self._ParseManifest(nodes)
305 319
306 if self.IsMirror: 320 if self.IsMirror:
@@ -310,7 +324,11 @@ class XmlManifest(object):
310 self._loaded = True 324 self._loaded = True
311 325
312 def _ParseManifestXml(self, path, include_root): 326 def _ParseManifestXml(self, path, include_root):
313 root = xml.dom.minidom.parse(path) 327 try:
328 root = xml.dom.minidom.parse(path)
329 except (OSError, xml.parsers.expat.ExpatError) as e:
330 raise ManifestParseError("error parsing manifest %s: %s" % (path, e))
331
314 if not root or not root.childNodes: 332 if not root or not root.childNodes:
315 raise ManifestParseError("no root node in %s" % (path,)) 333 raise ManifestParseError("no root node in %s" % (path,))
316 334
diff --git a/project.py b/project.py
index cdb4ecfd..f72b1c8e 100644
--- a/project.py
+++ b/project.py
@@ -1175,7 +1175,7 @@ class Project(object):
1175 cmd = ['fetch', remote.name] 1175 cmd = ['fetch', remote.name]
1176 cmd.append('refs/changes/%2.2d/%d/%d' \ 1176 cmd.append('refs/changes/%2.2d/%d/%d' \
1177 % (change_id % 100, change_id, patch_id)) 1177 % (change_id % 100, change_id, patch_id))
1178 cmd.extend(map(lambda x: str(x), remote.fetch)) 1178 cmd.extend(map(str, remote.fetch))
1179 if GitCommand(self, cmd, bare=True).Wait() != 0: 1179 if GitCommand(self, cmd, bare=True).Wait() != 0:
1180 return None 1180 return None
1181 return DownloadedChange(self, 1181 return DownloadedChange(self,
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 15f69f7b..d6389118 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -173,6 +173,12 @@ later is required to fix a server side protocol bug.
173 p.add_option('--no-clone-bundle', 173 p.add_option('--no-clone-bundle',
174 dest='no_clone_bundle', action='store_true', 174 dest='no_clone_bundle', action='store_true',
175 help='disable use of /clone.bundle on HTTP/HTTPS') 175 help='disable use of /clone.bundle on HTTP/HTTPS')
176 p.add_option('-u', '--manifest-server-username', action='store',
177 dest='manifest_server_username',
178 help='username to authenticate with the manifest server')
179 p.add_option('-p', '--manifest-server-password', action='store',
180 dest='manifest_server_password',
181 help='password to authenticate with the manifest server')
176 if show_smart: 182 if show_smart:
177 p.add_option('-s', '--smart-sync', 183 p.add_option('-s', '--smart-sync',
178 dest='smart_sync', action='store_true', 184 dest='smart_sync', action='store_true',
@@ -180,12 +186,6 @@ later is required to fix a server side protocol bug.
180 p.add_option('-t', '--smart-tag', 186 p.add_option('-t', '--smart-tag',
181 dest='smart_tag', action='store', 187 dest='smart_tag', action='store',
182 help='smart sync using manifest from a known tag') 188 help='smart sync using manifest from a known tag')
183 p.add_option('-u', '--manifest-server-username', action='store',
184 dest='manifest_server_username',
185 help='username to authenticate with the manifest server')
186 p.add_option('-p', '--manifest-server-password', action='store',
187 dest='manifest_server_password',
188 help='password to authenticate with the manifest server')
189 189
190 g = p.add_option_group('repo Version options') 190 g = p.add_option_group('repo Version options')
191 g.add_option('--no-repo-verify', 191 g.add_option('--no-repo-verify',