diff options
author | Dan Pasanen <dan.pasanen@gmail.com> | 2013-09-29 09:02:27 -0500 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-06 16:12:17 -0700 |
commit | c7821d21473eb49e2a7a60b267dc70dab79facbe (patch) | |
tree | 613bbc8ff3c85080531d6790c524252a4780892c /tools/repopick.py | |
parent | 17d69aa797a7ea3c92d0aeeee0334371a1abf0b6 (diff) | |
download | build-c7821d21473eb49e2a7a60b267dc70dab79facbe.zip build-c7821d21473eb49e2a7a60b267dc70dab79facbe.tar.gz build-c7821d21473eb49e2a7a60b267dc70dab79facbe.tar.bz2 |
repopick: skip a cherry pick if its already been merged
* override this behavior with the -f argument
Change-Id: I280b4945344e7483a192d1c9769c42b8fd2a2aef
Diffstat (limited to 'tools/repopick.py')
-rwxr-xr-x | tools/repopick.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/repopick.py b/tools/repopick.py index 8c18ecb..09d85a9 100755 --- a/tools/repopick.py +++ b/tools/repopick.py @@ -62,6 +62,7 @@ parser.add_argument('-a', '--abandon-first', action='store_true', help='before c parser.add_argument('-b', '--auto-branch', action='store_true', help='shortcut to "--start-branch auto --abandon-first --ignore-missing"') parser.add_argument('-q', '--quiet', action='store_true', help='print as little as possible') parser.add_argument('-v', '--verbose', action='store_true', help='print extra information to aid in debug') +parser.add_argument('-f', '--force', action='store_true', help='force cherry pick even if commit has been merged') args = parser.parse_args() if args.start_branch == None and args.abandon_first: parser.error('if --abandon-first is set, you must also give the branch name with --start-branch') @@ -217,10 +218,11 @@ for change in args.change_number: date_fluff = '.000000000' project_name = data['project'] change_number = data['_number'] + status = data['status'] current_revision = data['revisions'][data['current_revision']] patch_number = current_revision['_number'] - fetch_url = current_revision['fetch']['http']['url'] - fetch_ref = current_revision['fetch']['http']['ref'] + fetch_url = current_revision['fetch']['anonymous http']['url'] + fetch_ref = current_revision['fetch']['anonymous http']['ref'] author_name = current_revision['commit']['author']['name'] author_email = current_revision['commit']['author']['email'] author_date = current_revision['commit']['author']['date'].replace(date_fluff, '') @@ -229,6 +231,14 @@ for change in args.change_number: committer_date = current_revision['commit']['committer']['date'].replace(date_fluff, '') subject = current_revision['commit']['subject'] + # Check if commit has already been merged and exit if it has, unless -f is specified + if status == "MERGED": + if args.force: + print("!! Force-picking a merged commit !!\n") + else: + print("Commit already merged. Skipping the cherry pick.\nUse -f to force this pick.") + continue; + # Convert the project name to a project path # - check that the project path exists if project_name in project_name_to_path: |