def file_info_bugzilla(self, paths): components = defaultdict(set) for p, m in self._get_files_info(paths).items(): components[m.get('BUG_COMPONENT')].add(p) for component, files in sorted(components.items(), key=lambda x: (x is None, x)): print('%s :: %s' % (component.product, component.component) if component else 'UNKNOWN') for f in sorted(files): print(' %s' % f)
def file_info_bugzilla(self, paths): components = defaultdict(set) try: for p, m in self._get_files_info(paths).items(): components[m.get('BUG_COMPONENT')].add(p) except InvalidPathException as e: print(e.message) return 1 for component, files in sorted(components.items(), key=lambda x: (x is None, x)): print('%s :: %s' % (component.product, component.component) if component else 'UNKNOWN') for f in sorted(files): print(' %s' % f)
def file_info_bugzilla(self, paths, rev=None): """Show Bugzilla component for a set of files. Given a requested set of files (which can be specified using wildcards), print the Bugzilla component for each file. """ components = defaultdict(set) try: for p, m in self._get_files_info(paths, rev=rev).items(): components[m.get('BUG_COMPONENT')].add(p) except InvalidPathException as e: print(e.message) return 1 for component, files in sorted(components.items(), key=lambda x: (x is None, x)): print('%s :: %s' % (component.product, component.component) if component else 'UNKNOWN') for f in sorted(files): print(' %s' % f)
def file_info_bugzilla(self, paths, rev=None, fmt=None): """Show Bugzilla component for a set of files. Given a requested set of files (which can be specified using wildcards), print the Bugzilla component for each file. """ components = defaultdict(set) try: for p, m in self._get_files_info(paths, rev=rev).items(): components[m.get('BUG_COMPONENT')].add(p) except InvalidPathException as e: print(e.message) return 1 if fmt == 'json': data = {} for component, files in components.items(): if not component: continue for f in files: data[f] = [component.product, component.component] json.dump(data, sys.stdout, sort_keys=True, indent=2) return elif fmt == 'plain': data = sorted(components.items(), key=lambda x: (x is None, x)) for component, files in data: if component: s = '%s :: %s' % (component.product, component.component) else: s = 'UNKNOWN' print(s) for f in sorted(files): print(' %s' % f) else: print('unhandled output format: %s' % fmt) return 1
def file_info_bugzilla(self, paths, rev=None, fmt=None): """Show Bugzilla component for a set of files. Given a requested set of files (which can be specified using wildcards), print the Bugzilla component for each file. """ components = defaultdict(set) try: for p, m in self._get_files_info(paths, rev=rev).items(): components[m.get("BUG_COMPONENT")].add(p) except InvalidPathException as e: print(e.message) return 1 if fmt == "json": data = {} for component, files in components.items(): if not component: continue for f in files: data[f] = [component.product, component.component] json.dump(data, sys.stdout, sort_keys=True, indent=2) return elif fmt == "plain": comp_to_file = sorted(( "UNKNOWN" if component is None else "%s :: %s" % (component.product, component.component), sorted(files), ) for component, files in components.items()) for component, files in comp_to_file: print(component) for f in files: print(" %s" % f) else: print("unhandled output format: %s" % fmt) return 1