From f97808758174b9ef12036212dda140d507d55b76 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 1 Mar 2017 08:39:43 -0500 Subject: [PATCH] make tag history importer more robust If we get a validation error, report it and skip the version. Change-Id: Id2117405d10efaaa74cf23faa8720e9f66c5eb00 Signed-off-by: Doug Hellmann --- tools/tag_history_from_git.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/tag_history_from_git.py b/tools/tag_history_from_git.py index 330161b269..74ba2e5a54 100755 --- a/tools/tag_history_from_git.py +++ b/tools/tag_history_from_git.py @@ -130,10 +130,18 @@ for series, milestones in sorted(series_data.items()): f.write('team: %s\n' % args.project) f.write('release-type: %s\n' % args.release_type) f.write('releases:\n') - milestones_sorted = \ - sorted(milestones.items(), - key=lambda x: canonical_version(x[0], args.release_type)) - for milestone, milestone_data in milestones_sorted: + milestones_sorted = [] + for milestone, milestone_data in milestones.items(): + try: + milestones_sorted.append( + (canonical_version(milestone, args.release_type), + milestone, + milestone_data) + ) + except ValueError as err: + print('Ignoring %r: %s' % (milestone, err)) + milestones_sorted.sort() + for _, milestone, milestone_data in milestones_sorted: f.write(' - version: %s\n' % milestone) f.write(' projects:\n') for repo_short_name, sha in milestone_data: