diff options
author | Victor Boivie <victor.boivie@sonyericsson.com> | 2011-04-19 10:32:52 +0200 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2011-07-20 07:13:48 -0700 |
commit | 08c880db1882743900ce1ed82b5026566b64d1f5 (patch) | |
tree | f4b225c3aea7bb2808d995695e884d7b265bfeea /subcmds/sync.py | |
parent | a101f1c1670c9992c28980a7028dc6c60028af69 (diff) | |
download | git-repo-08c880db1882743900ce1ed82b5026566b64d1f5.tar.gz |
Smart tag support
This is an evolution of 'smart-sync' that adds a new option, -t,
that allows you to specify a tag/label to use instead of the
"latest good build" on the current manifest branch which -s does.
Signed-off-by: Victor Boivie <victor.boivie@sonyericsson.com>
Change-Id: I8c20fd91104a6aafa0271d4d33f6c4850aade17e
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index d941ea07..4689ac8b 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -72,7 +72,8 @@ revision is temporarily needed. | |||
72 | 72 | ||
73 | The -s/--smart-sync option can be used to sync to a known good | 73 | The -s/--smart-sync option can be used to sync to a known good |
74 | build as specified by the manifest-server element in the current | 74 | build as specified by the manifest-server element in the current |
75 | manifest. | 75 | manifest. The -t/--smart-tag option is similar and allows you to |
76 | specify a custom tag/label. | ||
76 | 77 | ||
77 | The -f/--force-broken option can be used to proceed with syncing | 78 | The -f/--force-broken option can be used to proceed with syncing |
78 | other projects if a project sync fails. | 79 | other projects if a project sync fails. |
@@ -130,6 +131,9 @@ later is required to fix a server side protocol bug. | |||
130 | p.add_option('-s', '--smart-sync', | 131 | p.add_option('-s', '--smart-sync', |
131 | dest='smart_sync', action='store_true', | 132 | dest='smart_sync', action='store_true', |
132 | help='smart sync using manifest from a known good build') | 133 | help='smart sync using manifest from a known good build') |
134 | p.add_option('-t', '--smart-tag', | ||
135 | dest='smart_tag', action='store', | ||
136 | help='smart sync using manifest from a known tag') | ||
133 | 137 | ||
134 | g = p.add_option_group('repo Version options') | 138 | g = p.add_option_group('repo Version options') |
135 | g.add_option('--no-repo-verify', | 139 | g.add_option('--no-repo-verify', |
@@ -315,27 +319,31 @@ uncommitted changes are present' % project.relpath | |||
315 | print >>sys.stderr, 'error: cannot combine -n and -l' | 319 | print >>sys.stderr, 'error: cannot combine -n and -l' |
316 | sys.exit(1) | 320 | sys.exit(1) |
317 | 321 | ||
318 | if opt.smart_sync: | 322 | if opt.smart_sync or opt.smart_tag: |
319 | if not self.manifest.manifest_server: | 323 | if not self.manifest.manifest_server: |
320 | print >>sys.stderr, \ | 324 | print >>sys.stderr, \ |
321 | 'error: cannot smart sync: no manifest server defined in manifest' | 325 | 'error: cannot smart sync: no manifest server defined in manifest' |
322 | sys.exit(1) | 326 | sys.exit(1) |
323 | try: | 327 | try: |
324 | server = xmlrpclib.Server(self.manifest.manifest_server) | 328 | server = xmlrpclib.Server(self.manifest.manifest_server) |
325 | p = self.manifest.manifestProject | 329 | if opt.smart_sync: |
326 | b = p.GetBranch(p.CurrentBranch) | 330 | p = self.manifest.manifestProject |
327 | branch = b.merge | 331 | b = p.GetBranch(p.CurrentBranch) |
328 | if branch.startswith(R_HEADS): | 332 | branch = b.merge |
329 | branch = branch[len(R_HEADS):] | 333 | if branch.startswith(R_HEADS): |
330 | 334 | branch = branch[len(R_HEADS):] | |
331 | env = os.environ.copy() | 335 | |
332 | if (env.has_key('TARGET_PRODUCT') and | 336 | env = os.environ.copy() |
333 | env.has_key('TARGET_BUILD_VARIANT')): | 337 | if (env.has_key('TARGET_PRODUCT') and |
334 | target = '%s-%s' % (env['TARGET_PRODUCT'], | 338 | env.has_key('TARGET_BUILD_VARIANT')): |
335 | env['TARGET_BUILD_VARIANT']) | 339 | target = '%s-%s' % (env['TARGET_PRODUCT'], |
336 | [success, manifest_str] = server.GetApprovedManifest(branch, target) | 340 | env['TARGET_BUILD_VARIANT']) |
341 | [success, manifest_str] = server.GetApprovedManifest(branch, target) | ||
342 | else: | ||
343 | [success, manifest_str] = server.GetApprovedManifest(branch) | ||
337 | else: | 344 | else: |
338 | [success, manifest_str] = server.GetApprovedManifest(branch) | 345 | assert(opt.smart_tag) |
346 | [success, manifest_str] = server.GetManifest(opt.smart_tag) | ||
339 | 347 | ||
340 | if success: | 348 | if success: |
341 | manifest_name = "smart_sync_override.xml" | 349 | manifest_name = "smart_sync_override.xml" |