def Execute(self, opt, args): project_list = self.GetProjects(args) pending = [] reviewers = [] cc = [] branch = None if opt.branch: branch = opt.branch for project in project_list: avail = project.GetUploadableBranches(branch) if avail: pending.append((project, avail)) if pending and (not opt.bypass_hooks): hook = RepoHook('pre-upload', self.manifest.repo_hooks_project, self.manifest.topdir, abort_if_user_denies=True) pending_proj_names = [project.name for (project, avail) in pending] try: hook.Run(opt.allow_all_hooks, project_list=pending_proj_names) except HookError, e: print >> sys.stderr, "ERROR: %s" % str(e) return
def Execute(self, opt, args): project_list = self.GetProjects(args) pending = [] reviewers = [] cc = [] branch = None if opt.branch: branch = opt.branch for project in project_list: if opt.current_branch: cbr = project.CurrentBranch up_branch = project.GetUploadableBranch(cbr) if up_branch: avail = [up_branch] else: avail = None print('ERROR: Current branch (%s) not uploadable. ' 'You may be able to type ' '"git branch --set-upstream-to m/master" to fix ' 'your branch.' % str(cbr), file=sys.stderr) else: avail = project.GetUploadableBranches(branch) if avail: pending.append((project, avail)) if pending and (not opt.bypass_hooks): hook = RepoHook( 'pre-upload', self.manifest.repo_hooks_project, self.manifest.topdir, self.manifest.manifestProject.GetRemote('origin').url, abort_if_user_denies=True) pending_proj_names = [project.name for (project, avail) in pending] pending_worktrees = [ project.worktree for (project, avail) in pending ] try: hook.Run(opt.allow_all_hooks, project_list=pending_proj_names, worktree_list=pending_worktrees) except HookError as e: print("ERROR: %s" % str(e), file=sys.stderr) return if opt.reviewers: reviewers = _SplitEmails(opt.reviewers) if opt.cc: cc = _SplitEmails(opt.cc) people = (reviewers, cc) if not pending: print("no branches ready for upload", file=sys.stderr) elif len(pending) == 1 and len(pending[0][1]) == 1: self._SingleBranch(opt, pending[0][1][0], people) else: self._MultipleBranches(opt, pending, people)
def Execute(self, opt, args): project_list = self.GetProjects(args) pending = [] reviewers = [] cc = [] branch = None if opt.branch: branch = opt.branch for project in project_list: if opt.current_branch: cbr = project.CurrentBranch avail = [project.GetUploadableBranch(cbr)] if cbr else None else: avail = project.GetUploadableBranches(branch) if avail: pending.append((project, avail)) if pending and (not opt.bypass_hooks): hook = RepoHook('pre-upload', self.manifest.repo_hooks_project, self.manifest.topdir, abort_if_user_denies=True) pending_proj_names = [project.name for (project, avail) in pending] try: hook.Run(opt.allow_all_hooks, project_list=pending_proj_names) except HookError as e: print("ERROR: %s" % str(e), file=sys.stderr) return if opt.reviewers: reviewers = _SplitEmails(opt.reviewers) if opt.cc: cc = _SplitEmails(opt.cc) people = (reviewers, cc) no_review = opt.no_review if no_review: print("WARNING: uploading without reviewing") if not pending: print("no branches ready for upload", file=sys.stderr) elif len(pending) == 1 and len(pending[0][1]) == 1: self._SingleBranch(opt, pending[0][1][0], people, no_review) else: self._MultipleBranches(opt, pending, people, no_review)