def rename(old, new=None): if not new: old, new = Git.branch(), old if new in Git.branches(): if not ARGS.force: raise Exception('The branch %s already exists.' % new) Delete.delete(new) Fresh.fresh(new, old) Delete.delete(old)
def _release(pulls, working_branch, next_branch, selector_name): Git.complete_reset() Delete.do_delete([working_branch], print=None) Git.copy_from_remote(base_branch(), working_branch, push=False) pulls.sort(key=operator.attrgetter('number')) if pulls: print('%s: Building release branch for %s:' % ( String.timestamp(), selector_name)) print(' ' + '\n '.join(str(p) for p in pulls)) print() success = [] failure = [] exceptions = [] for pull in pulls: try: print(pull.number, '...', sep='', end='') _pull_request(pull, working_branch) except VcxprojException: failure.append(pull.number) print('VCXPROJ...', end='') except Exception as e: failure.append(pull.number) print('ERROR...', end='') else: success.append(pull.number) if pulls: print() print() Version.version_commit( version_number=None, success=success, failure=failure) commit_id = Git.commit_id() Git.force_checkout(next_branch) Git.git('reset', '--hard', commit_id) Git.git('push', '-f') commits = Open.get_commits() plural = '' if len(commits) == 1 else 's' _print_pulls('Proposed new develop branch %s for pull%s' % (commits, plural), success) _print_pulls('FAILED:', failure) if success or failure: print('---------------------------------------------') print() else: print(String.timestamp(), ': no pulls ready.')