def _push(options, out, err): # scan commits for QA issues pipe = scan(options.scan_args) with reporters.FancyReporter(out) as reporter: for result in pipe: reporter.report(result) # fail on errors unless they're ignored if pipe.errors: with reporters.FancyReporter(out) as reporter: out.write(out.bold, out.fg('red'), '\nFAILURES', out.reset) for result in sorted(pipe.errors): reporter.report(result) if not (options.ask and userquery('Push commits anyway?', out, err)): return 1 # push commits upstream git.run('push', *options.push_args, cwd=options.repo.location) return 0
def ask(self, question, responses=None, default_answer=None, limit=3): return userquery(question, self.out, self.err, responses, default_answer, limit)
def ask(self, question, responses=None, default_answer=None, limit=3): return userquery( question, self.out, self.err, responses, default_answer, limit)
skip_regex = re.compile(rf'^{repo.location}/[^/]+/[^/]+/files/.+$') mangler = GentooMangler if options.gentoo_repo else Mangler paths = (pjoin(repo.location, x) for x in changes.paths) git_add_files.extend(mangler(paths, skip_regex=skip_regex)) # stage modified files if git_add_files: git.run('add', *git_add_files, cwd=repo.location) # scan staged changes for QA issues if requested if options.scan: pipe = scan(options.scan_args) with reporters.FancyReporter(out) as reporter: for result in pipe: reporter.report(result) # fail on errors unless they're ignored if pipe.errors: with reporters.FancyReporter(out) as reporter: out.write(out.bold, out.fg('red'), '\nFAILURES', out.reset) for result in sorted(pipe.errors): reporter.report(result) if not (options.ask and userquery('Create commit anyway?', out, err)): return 1 # determine message-related args args = determine_msg_args(options, changes) # create commit git.run('commit', *args, *options.commit_args) return 0