diff options
author | Sasha Levin <sasha.levin@oracle.com> | 2015-11-06 16:13:12 -0500 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2015-11-06 16:13:12 -0500 |
commit | 5cdcaa7eaec6e007ba07f2320e044e7700c47c41 (patch) | |
tree | b2557dfef483fce26bdec7a5f0960c00f139c7b9 | |
parent | 90040b45437ade6cbdecf09a9e3ca754575dff21 (diff) | |
download | stable-tools-5cdcaa7eaec6e007ba07f2320e044e7700c47c41.tar.gz |
Streamline audit-range
Remove annoying long text, make the output prettier, check if the commit
applies to the local branch and print deps if it doesn't.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rwxr-xr-x | stable-audit-range | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/stable-audit-range b/stable-audit-range index bc302ef..5ef75db 100755 --- a/stable-audit-range +++ b/stable-audit-range @@ -2,26 +2,59 @@ . show-missing-iter +function applies { + git cherry-pick $1 &> /dev/null + if [ $? -eq 0 ]; then + echo "+" + git reset --hard HEAD^ &> /dev/null + else + echo "-" + git reset --hard &> /dev/null + fi +} + function handle_stable { others=$(stable find-alts $1) + app=$(applies $1) if [ "$others" != "" ]; then - printf "Commit \"%s\" marked for stable and exists in the following branches:\n" "$(git log -1 --oneline $1)" - for j in $others; do - echo $(git branch -a --contains $j | sed 's/remotes\///g') + printf "[E$app] %s\n" "$(git log -1 --oneline $1)" + subj=$(git log -1 --pretty="%s" $1) + for m in $OTHER_STABLE_TREES; do + if [ $(git log -F --grep "$subj" --format="%H" $m) ]; then + echo " "$m + fi done + + if [ "$app" = "-" ]; then + echo "Possible dependency chain:" + stable deps $1 10 | sed 's/^/ /' + fi + echo "" else - printf "Commit \"%s\" marked for stable but doesn't exist in any other branch\n" "$(git log -1 --oneline $1)" + printf "[M$app] %s\n" "$(git log -1 --oneline $1)" + if [ "$app" = "-" ]; then + echo "Possible dependency chain:" + stable deps $1 10 | sed 's/^/ /' + echo + fi fi - echo "" } function handle_nonstable { others=$(stable find-alts $1) if [ "$others" != "" ]; then - printf "Commit \"%s\" isn't marked for stable but exists in the following branches:\n" "$(git log -1 --oneline $1)" - for j in $others; do - echo $(git branch -a --contains $j | sed 's/remotes\///g') + app=$(applies $1) + printf "[N$app] %s:\n" "$(git log -1 --oneline $1)" + subj=$(git log -1 --pretty="%s" $1) + for m in $OTHER_STABLE_TREES; do + if [ $(git log -F --grep "$subj" --format="%H" $m) ]; then + echo " "$m + fi done + if [ "$app" = "-" ]; then + echo "Possible dependency chain:" + stable deps $1 10 | sed 's/^/ /' + fi echo "" fi } |