aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2019-10-17 01:22:49 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2019-10-17 01:22:49 +0200
commitfdf5eb450f8203fc80a167ba7417e82b01f94ada (patch)
tree20dade2351ff155164bc47606dfd5f274868c8a9
parent6e3d70047978e020d48ef8850135ae3a3d1122f8 (diff)
downloadpw-fdf5eb450f8203fc80a167ba7417e82b01f94ada.tar.gz
pw: auto-derive the merge base in pw-pull if -s not specified
Add similar logic which we had in our old, non-public pw-pull script. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--README8
-rwxr-xr-xpw-pull7
2 files changed, 14 insertions, 1 deletions
diff --git a/README b/README
index 2a7d7fc..25f505d 100644
--- a/README
+++ b/README
@@ -168,6 +168,14 @@ and the scripts would need to be adapted for other subsystems.
Currently the -t option only accepts: bpf, bpf-next
+The -s option is optional and if not specified then pw-pull will determine
+the merge base automatically. In order for this to work, it requires that
+there is a net (for -t bpf) or net-next (for -t bpf-next) remote in the
+repository. To generate the PR, simply do:
+
+ $ pw-pull -t bpf
+ PR: pr-bpf-2019-09-26.patch
+
The resulting file is then edited to describe the changes that the pull-request
contains. It's then sent out same way as other patches through git-send-email:
diff --git a/pw-pull b/pw-pull
index a40b926..b4d47ff 100755
--- a/pw-pull
+++ b/pw-pull
@@ -24,13 +24,18 @@ while true; do
* ) break ;;
esac
done
-[ -z "$since" ] && usage
[ -z "$tree" ] && usage
case $tree in
bpf-next ) remote=(net-next git://git.kernel.org/pub/scm/linux/kernel/git/bpf/$tree.git) ;;
bpf ) remote=(net git://git.kernel.org/pub/scm/linux/kernel/git/bpf/$tree.git) ;;
* ) usage ;;
esac
+if [ -z "$since" ]; then
+ git fetch ${remote[0]}
+ branch=$(git rev-parse --abbrev-ref HEAD)
+ since=$(git merge-base $branch ${remote[0]}/master)
+fi
+[ -z "$since" ] && usage
old=$(git log $since -n 1 --format=%ct)
new=$(git log HEAD -n 1 --format=%ct)