From 791766dce2615e9926aa423f3dfe21d1e2b5d83b Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Fri, 18 Nov 2022 15:12:38 +0100 Subject: [PATCH] pre_merge.sh: tag last pre-merge commit Change-Id: Iaf7ffada4c7cc77b85547e7b3c64aaa96e80b64b --- increment_version.sh | 19 ------------------- merge_helpers.sh | 20 ++++++++++++++++++++ pre_merge.sh | 7 +++++++ 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/increment_version.sh b/increment_version.sh index c7e9d7fbaf..fd316812ca 100755 --- a/increment_version.sh +++ b/increment_version.sh @@ -43,25 +43,6 @@ fi last_tag=`downstream_latest_tag` -build_gradle="vector-app/build.gradle" - -get_prop() { - local prop="$1" - cat "$build_gradle" | grep "$prop = " | sed "s|$prop = ||" -} -set_prop() { - local prop="$1" - local value="$2" - if grep -q "$prop =" "$build_gradle"; then - local equals="= " - local not_equals="" - else - local equals="" - # Don't touch lines that have an equals in it, but not for this prop - local not_equals="/=/! " - fi - sed -i "$not_equals""s|\($prop $equals\).*|\1$value|g" "$build_gradle" -} # Legacy versioning, based on Element's version codes #calculate_version_code() { diff --git a/merge_helpers.sh b/merge_helpers.sh index 218b691281..818858fa18 100755 --- a/merge_helpers.sh +++ b/merge_helpers.sh @@ -1,5 +1,25 @@ #!/bin/bash +build_gradle="vector-app/build.gradle" + +get_prop() { + local prop="$1" + cat "$build_gradle" | grep "$prop = " | sed "s|$prop = ||" +} +set_prop() { + local prop="$1" + local value="$2" + if grep -q "$prop =" "$build_gradle"; then + local equals="= " + local not_equals="" + else + local equals="" + # Don't touch lines that have an equals in it, but not for this prop + local not_equals="/=/! " + fi + sed -i "$not_equals""s|\($prop $equals\).*|\1$value|g" "$build_gradle" +} + find_last_commit_for_title() { local title="$1" git log --oneline --author=SpiritCroc | grep "$title" | head -n 1 | sed 's| .*||' diff --git a/pre_merge.sh b/pre_merge.sh index 6b08a846b0..e0f3d8ae74 100755 --- a/pre_merge.sh +++ b/pre_merge.sh @@ -8,6 +8,13 @@ source "$mydir/merge_helpers.sh" # Require clean git state require_clean_git +# Tag this version for easier git diff-ing +versionMajor=`get_prop ext.versionMajor` +versionMinor=`get_prop ext.versionMinor` +versionPatch=`get_prop ext.versionPatch` +tag="sc_last_v$versionMajor.$versionMinor.$versionPatch" +git tag "$tag" + # Revert Schildi's upstream string changes git checkout `upstream_common_base` -- "$mydir/library/ui-strings/src/main/res/**/strings.xml" git commit -m "Automatic revert to unchanged upstream strings, pt.1"