aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2023-12-21 00:06:18 +0000
committerSeongJae Park <sj@kernel.org>2023-12-21 00:06:18 +0000
commit2fe946f9623b6d4a925c3756a522f59508665765 (patch)
tree10c1ff78f78eb6764f803a0825d2dd099d579c62
parent9ef6f86a5cc37b4b97b6d8e42f028835b8aa958a (diff)
downloaddamon-hack-2fe946f9623b6d4a925c3756a522f59508665765.tar.gz
rebase_damon_next_on_mm_unstable: Find new mainline base automatically
Signed-off-by: SeongJae Park <sj@kernel.org>
-rwxr-xr-xrebase_damon_next_on_mm_unstable.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/rebase_damon_next_on_mm_unstable.sh b/rebase_damon_next_on_mm_unstable.sh
index 13a0ead..70c8de9 100755
--- a/rebase_damon_next_on_mm_unstable.sh
+++ b/rebase_damon_next_on_mm_unstable.sh
@@ -2,17 +2,15 @@
set -e
-if [ $# -ne 1 ] && [ $# -ne 2 ]
+if [ $# -gt 1 ]
then
- echo "Usage: $0 <mainline base> [old mm-unstable]"
+ echo "Usage: $0 [old mm-unstable]"
exit 1
fi
-mainline_base=$1
-
-if [ $# -eq 2 ]
+if [ $# -eq 1 ]
then
- old_mm_unstable=$2
+ old_mm_unstable=$1
else
guess=$(git rev-parse akpm.korg.mm/mm-unstable)
if git log damon/next --pretty=%H | grep "$guess" --max-count 1
@@ -42,14 +40,16 @@ then
exit 0
fi
+new_mainline_base=$(git describe "$new_mm_unstable" --match "v*" --abbrev=0)
+
cp "$bindir/unmerged_commits.sh" ./
merged_commits=$(./unmerged_commits.sh --merged --human_readable \
- "$old_mm_unstable..damon/next" "$mainline_base..$new_mm_unstable")
+ "$old_mm_unstable..damon/next" "$new_mainline_base..$new_mm_unstable")
git branch -M damon/next damon/next.old
git checkout akpm.korg.mm/mm-unstable -b damon/next.new
commits_to_pick=$(./unmerged_commits.sh "$old_mm_unstable..damon/next.old" \
- "$mainline_base..$new_mm_unstable")
+ "$new_mainline_base..$new_mm_unstable")
if ! git cherry-pick --allow-empty $commits_to_pick
then
echo "Cherry-pick failed."