diff options
-rwxr-xr-x | main.py | 7 | ||||
-rw-r--r-- | manifest_xml.py | 12 | ||||
-rw-r--r-- | subcmds/cherry_pick.py | 1 | ||||
-rw-r--r-- | subcmds/forall.py | 13 | ||||
-rw-r--r-- | subcmds/sync.py | 21 |
5 files changed, 42 insertions, 12 deletions
@@ -45,6 +45,7 @@ from command import MirrorSafeCommand | |||
45 | from subcmds.version import Version | 45 | from subcmds.version import Version |
46 | from editor import Editor | 46 | from editor import Editor |
47 | from error import DownloadError | 47 | from error import DownloadError |
48 | from error import InvalidProjectGroupsError | ||
48 | from error import ManifestInvalidRevisionError | 49 | from error import ManifestInvalidRevisionError |
49 | from error import ManifestParseError | 50 | from error import ManifestParseError |
50 | from error import NoManifestException | 51 | from error import NoManifestException |
@@ -173,6 +174,12 @@ class _Repo(object): | |||
173 | else: | 174 | else: |
174 | print('error: no project in current directory', file=sys.stderr) | 175 | print('error: no project in current directory', file=sys.stderr) |
175 | result = 1 | 176 | result = 1 |
177 | except InvalidProjectGroupsError as e: | ||
178 | if e.name: | ||
179 | print('error: project group must be enabled for project %s' % e.name, file=sys.stderr) | ||
180 | else: | ||
181 | print('error: project group must be enabled for the project in the current directory', file=sys.stderr) | ||
182 | result = 1 | ||
176 | finally: | 183 | finally: |
177 | elapsed = time.time() - start | 184 | elapsed = time.time() - start |
178 | hours, remainder = divmod(elapsed, 3600) | 185 | hours, remainder = divmod(elapsed, 3600) |
diff --git a/manifest_xml.py b/manifest_xml.py index cfbd9efa..130e17c2 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -253,11 +253,13 @@ class XmlManifest(object): | |||
253 | else: | 253 | else: |
254 | value = p.work_git.rev_parse(HEAD + '^0') | 254 | value = p.work_git.rev_parse(HEAD + '^0') |
255 | e.setAttribute('revision', value) | 255 | e.setAttribute('revision', value) |
256 | if peg_rev_upstream and value != p.revisionExpr: | 256 | if peg_rev_upstream: |
257 | # Only save the origin if the origin is not a sha1, and the default | 257 | if p.upstream: |
258 | # isn't our value, and the if the default doesn't already have that | 258 | e.setAttribute('upstream', p.upstream) |
259 | # covered. | 259 | elif value != p.revisionExpr: |
260 | e.setAttribute('upstream', p.revisionExpr) | 260 | # Only save the origin if the origin is not a sha1, and the default |
261 | # isn't our value | ||
262 | e.setAttribute('upstream', p.revisionExpr) | ||
261 | else: | 263 | else: |
262 | revision = self.remotes[remoteName].revision or d.revisionExpr | 264 | revision = self.remotes[remoteName].revision or d.revisionExpr |
263 | if not revision or revision != p.revisionExpr: | 265 | if not revision or revision != p.revisionExpr: |
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py index 520e4c32..1f7dffdc 100644 --- a/subcmds/cherry_pick.py +++ b/subcmds/cherry_pick.py | |||
@@ -76,6 +76,7 @@ change id will be added. | |||
76 | capture_stdout = True, | 76 | capture_stdout = True, |
77 | capture_stderr = True) | 77 | capture_stderr = True) |
78 | p.stdin.write(new_msg) | 78 | p.stdin.write(new_msg) |
79 | p.stdin.close() | ||
79 | if p.Wait() != 0: | 80 | if p.Wait() != 0: |
80 | print("error: Failed to update commit message", file=sys.stderr) | 81 | print("error: Failed to update commit message", file=sys.stderr) |
81 | sys.exit(1) | 82 | sys.exit(1) |
diff --git a/subcmds/forall.py b/subcmds/forall.py index ebc8beca..b93cd6d0 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
@@ -151,11 +151,15 @@ without iterating through the remaining projects. | |||
151 | attributes that we need. | 151 | attributes that we need. |
152 | 152 | ||
153 | """ | 153 | """ |
154 | if not self.manifest.IsMirror: | ||
155 | lrev = project.GetRevisionId() | ||
156 | else: | ||
157 | lrev = None | ||
154 | return { | 158 | return { |
155 | 'name': project.name, | 159 | 'name': project.name, |
156 | 'relpath': project.relpath, | 160 | 'relpath': project.relpath, |
157 | 'remote_name': project.remote.name, | 161 | 'remote_name': project.remote.name, |
158 | 'lrev': project.GetRevisionId(), | 162 | 'lrev': lrev, |
159 | 'rrev': project.revisionExpr, | 163 | 'rrev': project.revisionExpr, |
160 | 'annotations': dict((a.name, a.value) for a in project.annotations), | 164 | 'annotations': dict((a.name, a.value) for a in project.annotations), |
161 | 'gitdir': project.gitdir, | 165 | 'gitdir': project.gitdir, |
@@ -201,6 +205,13 @@ without iterating through the remaining projects. | |||
201 | mirror = self.manifest.IsMirror | 205 | mirror = self.manifest.IsMirror |
202 | rc = 0 | 206 | rc = 0 |
203 | 207 | ||
208 | smart_sync_manifest_name = "smart_sync_override.xml" | ||
209 | smart_sync_manifest_path = os.path.join( | ||
210 | self.manifest.manifestProject.worktree, smart_sync_manifest_name) | ||
211 | |||
212 | if os.path.isfile(smart_sync_manifest_path): | ||
213 | self.manifest.Override(smart_sync_manifest_path) | ||
214 | |||
204 | if not opt.regex: | 215 | if not opt.regex: |
205 | projects = self.GetProjects(args) | 216 | projects = self.GetProjects(args) |
206 | else: | 217 | else: |
diff --git a/subcmds/sync.py b/subcmds/sync.py index b4546c15..ec333ae7 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -517,6 +517,9 @@ later is required to fix a server side protocol bug. | |||
517 | self.manifest.Override(opt.manifest_name) | 517 | self.manifest.Override(opt.manifest_name) |
518 | 518 | ||
519 | manifest_name = opt.manifest_name | 519 | manifest_name = opt.manifest_name |
520 | smart_sync_manifest_name = "smart_sync_override.xml" | ||
521 | smart_sync_manifest_path = os.path.join( | ||
522 | self.manifest.manifestProject.worktree, smart_sync_manifest_name) | ||
520 | 523 | ||
521 | if opt.smart_sync or opt.smart_tag: | 524 | if opt.smart_sync or opt.smart_tag: |
522 | if not self.manifest.manifest_server: | 525 | if not self.manifest.manifest_server: |
@@ -583,17 +586,16 @@ later is required to fix a server side protocol bug. | |||
583 | [success, manifest_str] = server.GetManifest(opt.smart_tag) | 586 | [success, manifest_str] = server.GetManifest(opt.smart_tag) |
584 | 587 | ||
585 | if success: | 588 | if success: |
586 | manifest_name = "smart_sync_override.xml" | 589 | manifest_name = smart_sync_manifest_name |
587 | manifest_path = os.path.join(self.manifest.manifestProject.worktree, | ||
588 | manifest_name) | ||
589 | try: | 590 | try: |
590 | f = open(manifest_path, 'w') | 591 | f = open(smart_sync_manifest_path, 'w') |
591 | try: | 592 | try: |
592 | f.write(manifest_str) | 593 | f.write(manifest_str) |
593 | finally: | 594 | finally: |
594 | f.close() | 595 | f.close() |
595 | except IOError: | 596 | except IOError as e: |
596 | print('error: cannot write manifest to %s' % manifest_path, | 597 | print('error: cannot write manifest to %s:\n%s' |
598 | % (smart_sync_manifest_path, e), | ||
597 | file=sys.stderr) | 599 | file=sys.stderr) |
598 | sys.exit(1) | 600 | sys.exit(1) |
599 | self._ReloadManifest(manifest_name) | 601 | self._ReloadManifest(manifest_name) |
@@ -610,6 +612,13 @@ later is required to fix a server side protocol bug. | |||
610 | % (self.manifest.manifest_server, e.errcode, e.errmsg), | 612 | % (self.manifest.manifest_server, e.errcode, e.errmsg), |
611 | file=sys.stderr) | 613 | file=sys.stderr) |
612 | sys.exit(1) | 614 | sys.exit(1) |
615 | else: # Not smart sync or smart tag mode | ||
616 | if os.path.isfile(smart_sync_manifest_path): | ||
617 | try: | ||
618 | os.remove(smart_sync_manifest_path) | ||
619 | except OSError as e: | ||
620 | print('error: failed to remove existing smart sync override manifest: %s' % | ||
621 | e, file=sys.stderr) | ||
613 | 622 | ||
614 | rp = self.manifest.repoProject | 623 | rp = self.manifest.repoProject |
615 | rp.PreSync() | 624 | rp.PreSync() |