def dump_unknown_commit_help(unknown_commits): msg = """\ Error: can't build mergeup log message. The following commits have unknown areas: {} You can manually specify areas like so: {} Where each AREA is taken from the list: \t{} You can also update AREA_TO_SHORTLOG_RES in {} to permanently associate an area with this type of shortlog. """ unknown_as_list = ['- {} {}'.format(commit_shortsha(c), commit_shortlog(c)) for c in unknown_commits] try_instead = chain((shlex.quote(a) for a in sys.argv), ('--set-area={}:AREA'.format(commit_shortsha(c)) for c in unknown_commits)) print(textwrap.dedent(msg).format('\n'.join(unknown_as_list), ' '.join(try_instead), '\n\t'.join(AREAS), __file__), file=sys.stderr)
def print_notes(start_manifest, end_manifest): # Get 'revision' and 'path' dicts for each project we track in # each pinned manifest, keyed by name. start_data = zmp_project_data(start_manifest) end_data = zmp_project_data(end_manifest) notes_metadata = {} for p in ZMP_PROJECTS: start_rev = start_data[p].revision end_rev = end_data[p].revision # end should have the entire history; start might be gone. path = end_data[p].abspath commits = repo_commits(path, start_rev, end_rev) ncommits = len(commits) if ncommits >= 2: sc, ec = commits[0], commits[-1] changes = '''\ {} patches total: - start commit: {} ("{}"). - end commit: {} ("{}").'''.format(ncommits, commit_shortsha(sc), commit_shortlog(sc), commit_shortsha(ec), commit_shortlog(ec)) elif ncommits == 1: changes = 'One new commit: {} ("{}").'.format( commit_shortsha(commits[0]), commit_shortlog(commits[0])) else: changes = 'No changes.' notes_metadata[p] = { 'path': path, # assume it stays the same 'start_revision': start_rev, 'end_revision': end_rev, 'commits': commits, 'changes': changes, } print('''\ ## West {} ## Zephyr {} ## MCUboot {} ## dm-lwm2m {} '''.format(*[notes_metadata[p]['changes'] for p in ZMP_PROJECTS]))
def upstream_commit_line(self, commit, merge_day=False): '''Get a line about the given upstream commit.''' if merge_day: merged = self.commit_merge_day(commit) return '- {} {}, merged {}'.format(commit_shortsha(commit), commit_shortlog(commit), merged) else: return '- {} {}'.format(commit_shortsha(commit), commit_shortlog(commit))
def upstream_commit_line(self, commit, merge_day=False): '''Get a line about the given upstream commit.''' full_oid = str(commit.oid) link = ('https://github.com/zephyrproject-rtos/zephyr/commit/' + full_oid) if merge_day: merged = self.commit_merge_day(commit) return '- [{}]({}) {}, merged {}'.format(commit_shortsha(commit), link, commit_shortlog(commit), merged) else: return '- [{}]({}) {}'.format(commit_shortsha(commit), link, commit_shortlog(commit))
def postamble(self, analysis, context): outstanding = analysis.downstream_outstanding_patches likely_merged = analysis.downstream_merged_patches ret = [] def addl(line, comment=False): if comment: if line: ret.append('# {}'.format(line)) else: ret.append('#') else: ret.append(line) addl('Outstanding Downstream patches') addl('==============================') addl('') for sl, c in outstanding.items(): addl('- {} {}'.format(commit_shortsha(c), sl)) addl('') if not likely_merged: return ret addl('Likely merged downstream patches:', True) addl('IMPORTANT: You probably need to revert these and re-run!', True) addl(' Make sure to check the above as well; these are', True) addl(" guesses that aren't always right.", True) addl('', True) for sl, commits in likely_merged.items(): addl('- "{}", likely merged as one of:'.format(sl), True) for c in commits: addl('\t- {} {}'.format(commit_shortsha(c), commit_shortlog(c)), True) addl('', True) return ret
def main(start_manifest, end_manifest, zmp, yaml_indent): if zmp is None: zmp = abspath(os.getcwd()) zmp = abspath(zmp) zephyr = join(zmp, 'zephyr') mcuboot = join(zmp, 'mcuboot') lwm2m = join(zmp, 'zephyr-fota-samples', 'dm-lwm2m') hawkbit = join(zmp, 'zephyr-fota-samples', 'dm-hawkbit-mqtt') start = project_revisions(start_manifest) end = project_revisions(end_manifest) zephyr_highlights = repo_mergeup_highlights(zephyr, start['zephyr'], end['zephyr'], yaml_indent) mcuboot_highlights = repo_mergeup_highlights(mcuboot, start['mcuboot'], end['mcuboot'], yaml_indent) lwm2m_commits = repo_commits(lwm2m, start['dm-lwm2m'], end['dm-lwm2m']) hawkbit_commits = repo_commits(hawkbit, start['dm-hawkbit-mqtt'], end['dm-hawkbit-mqtt']) print('#', '=' * 70) print('# Zephyr highlights:') print(zephyr_highlights) print('#', '=' * 70) print('# MCUboot highlights:') print(mcuboot_highlights) print('#', '=' * 70) print('# dm-lwm2m commits:') for c in lwm2m_commits: print('# - {} {}'.format(commit_shortsha(c), commit_shortlog(c))) print('#', '=' * 70) print('# dm-hawkbit-mqtt commits:') for c in hawkbit_commits: print('# - {} {}'.format(commit_shortsha(c), commit_shortlog(c)))