def print_loot(self, name, project, z_project, args): # Print a list of out of tree outstanding patches in the given # project. # # name: project name # project: the west.manifest.Project instance in the NCS manifest # z_project: the Project instance in the upstream manifest name_path = _name_and_path(project) # Get the upstream revision of the project. The zephyr project # has to be treated as a special case. if name == 'zephyr': z_rev = self.zephyr_rev else: z_rev = z_project.revision try: nsha = project.sha(project.revision) project.git('cat-file -e ' + nsha) except subprocess.CalledProcessError: log.wrn(f"{name_path}: can't get loot; please run " f'"west update" (need revision {project.revision})') return try: zsha = z_project.sha(z_rev) z_project.git('cat-file -e ' + zsha) except subprocess.CalledProcessError: log.wrn(f"{name_path}: can't get loot; please fetch upstream URL " f'{z_project.url} (need revision {z_project.revision})') return try: analyzer = nwh.RepoAnalyzer(project, z_project, project.revision, z_rev) except nwh.InvalidRepositoryError as ire: log.die(f"{name_path}: {str(ire)}") try: loot = analyzer.downstream_outstanding except nwh.UnknownCommitsError as uce: log.die(f'{name_path}: unknown commits: {str(uce)}') if not loot and log.VERBOSE <= log.VERBOSE_NONE: # Don't print output if there's no loot unless verbose # mode is on. return log.banner(name_path) log.inf(f'NCS commit: {nsha}, upstream commit: {zsha}') log.inf('OOT patches: ' + (f'{len(loot)} total' if loot else 'none') + (', output limited by --file' if args.files else '')) for c in loot: if args.files and not nwh.commit_affects_files(c, args.files): log.dbg(f"skipping {c.oid}; it doesn't affect file filter", level=log.VERBOSE_VERY) continue if args.sha_only: log.inf(str(c.oid)) else: log.inf(f'- {c.oid} {nwh.commit_shortlog(c)}')
def print_loot(self, name, project, z_project, args): # Print a list of out of tree outstanding patches in the given # project. # # name: project name # project: the west.manifest.Project instance in the NCS manifest # z_project: the Project instance in the upstream manifest msg = project.format('{name_and_path} outstanding downstream patches:') # Get the upstream revision of the project. The zephyr project # has to be treated as a special case. if name == 'zephyr': z_rev = self.zephyr_rev msg += ' NOTE: {} *must* be up to date'.format(z_rev) else: z_rev = z_project.revision log.banner(msg) try: nsha = project.sha(project.revision) project.git('cat-file -e ' + nsha) except subprocess.CalledProcessError: log.wrn( "can't get loot; please run \"west update {}\"".format( project.name), '(need revision {})'.format(project.revision)) return try: zsha = z_project.sha(z_project.revision) z_project.git('cat-file -e ' + zsha) except subprocess.CalledProcessError: log.wrn("can't get loot; please fetch upstream URL", z_project.url, '(need revision {})'.format(z_project.revision)) return try: analyzer = nwh.RepoAnalyzer(project, z_project, project.revision, z_rev) except nwh.InvalidRepositoryError as ire: log.die(str(ire)) try: for c in analyzer.downstream_outstanding: if args.files and not nwh.commit_affects_files(c, args.files): log.dbg( 'skipping {}; it does not affect file filter'.format( c.oid), level=log.VERBOSE_VERY) continue if args.sha_only: log.inf(str(c.oid)) else: log.inf('- {} {}'.format(c.oid, nwh.commit_shortlog(c))) except nwh.UnknownCommitsError as uce: log.die('unknown commits:', str(uce))