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
This commit is contained in:
Victor Boivie 2011-04-19 10:32:52 +02:00 committed by Shawn O. Pearce
parent a101f1c167
commit 08c880db18

View File

@ -72,7 +72,8 @@ revision is temporarily needed.
The -s/--smart-sync option can be used to sync to a known good The -s/--smart-sync option can be used to sync to a known good
build as specified by the manifest-server element in the current build as specified by the manifest-server element in the current
manifest. manifest. The -t/--smart-tag option is similar and allows you to
specify a custom tag/label.
The -f/--force-broken option can be used to proceed with syncing The -f/--force-broken option can be used to proceed with syncing
other projects if a project sync fails. other projects if a project sync fails.
@ -130,6 +131,9 @@ later is required to fix a server side protocol bug.
p.add_option('-s', '--smart-sync', p.add_option('-s', '--smart-sync',
dest='smart_sync', action='store_true', dest='smart_sync', action='store_true',
help='smart sync using manifest from a known good build') help='smart sync using manifest from a known good build')
p.add_option('-t', '--smart-tag',
dest='smart_tag', action='store',
help='smart sync using manifest from a known tag')
g = p.add_option_group('repo Version options') g = p.add_option_group('repo Version options')
g.add_option('--no-repo-verify', g.add_option('--no-repo-verify',
@ -315,13 +319,14 @@ uncommitted changes are present' % project.relpath
print >>sys.stderr, 'error: cannot combine -n and -l' print >>sys.stderr, 'error: cannot combine -n and -l'
sys.exit(1) sys.exit(1)
if opt.smart_sync: if opt.smart_sync or opt.smart_tag:
if not self.manifest.manifest_server: if not self.manifest.manifest_server:
print >>sys.stderr, \ print >>sys.stderr, \
'error: cannot smart sync: no manifest server defined in manifest' 'error: cannot smart sync: no manifest server defined in manifest'
sys.exit(1) sys.exit(1)
try: try:
server = xmlrpclib.Server(self.manifest.manifest_server) server = xmlrpclib.Server(self.manifest.manifest_server)
if opt.smart_sync:
p = self.manifest.manifestProject p = self.manifest.manifestProject
b = p.GetBranch(p.CurrentBranch) b = p.GetBranch(p.CurrentBranch)
branch = b.merge branch = b.merge
@ -336,6 +341,9 @@ uncommitted changes are present' % project.relpath
[success, manifest_str] = server.GetApprovedManifest(branch, target) [success, manifest_str] = server.GetApprovedManifest(branch, target)
else: else:
[success, manifest_str] = server.GetApprovedManifest(branch) [success, manifest_str] = server.GetApprovedManifest(branch)
else:
assert(opt.smart_tag)
[success, manifest_str] = server.GetManifest(opt.smart_tag)
if success: if success:
manifest_name = "smart_sync_override.xml" manifest_name = "smart_sync_override.xml"