arehbein has uploaded this change for review.
src/grd: Add option for cherry-picking
Option '-c|--cherry-pick' will now cherry-pick into
the current branch if passed.
Change-Id: I85b1a2c4915e3da374e4b1201f2e977708fc7c4c
---
M src/grd
1 file changed, 25 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/81/33381/1
diff --git a/src/grd b/src/grd
index b1623ec..4a7e52b 100755
--- a/src/grd
+++ b/src/grd
@@ -69,6 +69,12 @@
except subprocess.CalledProcessError:
exit(1)
+def git_cherry_pick_fetch_head():
+ cmd = ["git", "cherry-pick", "FETCH_HEAD"];
+ try:
+ return subprocess.run(cmd, check=True)
+ except subprocess.CalledProcessError:
+ exit(1)
def git_checkout_fetch_head(patch_id, rev):
cmd = ["git", "checkout", "-B", f"gerrit/{patch_id}_{rev}", "FETCH_HEAD"]
@@ -84,6 +90,9 @@
parser = argparse.ArgumentParser(description=desc)
parser.add_argument("patch_id", type=int,
help="gerrit review ID")
+parser.add_argument("-c", "--cherry-pick", action="store_true",
+ help="cherry-pick into current branch instead of "
+ "fetching into a branch, disabled by default")
parser.add_argument("-r", "--revision", type=int,
help="patchset revision, default is latest")
parser.add_argument("-v", "--verbose", action="store_true")
@@ -97,4 +106,7 @@
rev = get_highest_revision(details)
git_fetch(host, project, args.patch_id, rev)
-git_checkout_fetch_head(args.patch_id, rev)
+if not args.cherry_pick:
+ git_checkout_fetch_head(args.patch_id, rev)
+else:
+ git_cherry_pick_fetch_head()
To view, visit change 33381. To unsubscribe, or for help writing mail filters, visit settings.