Skip to content

Instantly share code, notes, and snippets.

@felipecwb
Created January 5, 2016 21:00
Show Gist options
  • Save felipecwb/1fd2bf4776d17ff6f338 to your computer and use it in GitHub Desktop.
Save felipecwb/1fd2bf4776d17ff6f338 to your computer and use it in GitHub Desktop.
Hack to list the task and commits in branch for analysis.
#!/bin/sh
tags=()
while read line; do
tags+=($line);
done <<< "$(git tag | sort -V | tail -n2)";
tag1=${1:-${tags[0]}}
tag2=${2:-${tags[1]}}
echo -e "Youtrack Tasks involved between $tag1 and $tag2:\n"
tasks=()
while read line; do
tasks+=($line)
done <<< "$(git log ${tag1}..${tag2} \
--oneline \
--decorate \
| awk '/origin\/[A-Z]{3}-[0-9]{2,5}/{
if (match($0, /([A-Z]{3}-[0-9]{2,5})/, task))
print task[1];
}' \
| sort \
| uniq)"
for task in "${tasks[@]}"; do
branch=$(git branch -r \
| grep -v HEAD \
| grep "${task}" \
| sed 's/\( \|* \)//')
echo -e "+ Task: $task\tBranch: $branch"
git --no-pager \
log ${tag1}..${tag2} \
--source \
--no-merges \
--reverse \
--decorate=short \
--date=iso \
--format='%d %Cred%h %C(bold blue)<%an> %Cgreen%cd %Creset%s' \
| awk "{
if (match(\$0, /\(.+?${branch//\//\\/}.+?\) (.*)/, rest)) {
print rest[1];
}
}"
echo -e "\n"
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment