diff --git a/manifest_xml.py b/manifest_xml.py index d944b409..458dfb7d 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -2210,7 +2210,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md toProjects = manifest.paths fromKeys = sorted(fromProjects.keys()) - toKeys = sorted(toProjects.keys()) + toKeys = set(toProjects.keys()) diff = { "added": [], @@ -2221,13 +2221,13 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md } for proj in fromKeys: + fromProj = fromProjects[proj] if proj not in toKeys: - diff["removed"].append(fromProjects[proj]) - elif not fromProjects[proj].Exists: + diff["removed"].append(fromProj) + elif not fromProj.Exists: diff["missing"].append(toProjects[proj]) toKeys.remove(proj) else: - fromProj = fromProjects[proj] toProj = toProjects[proj] try: fromRevId = fromProj.GetCommitRevisionId() @@ -2239,8 +2239,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md diff["changed"].append((fromProj, toProj)) toKeys.remove(proj) - for proj in toKeys: - diff["added"].append(toProjects[proj]) + diff["added"].extend(toProjects[proj] for proj in sorted(toKeys)) return diff