Browse files

Problem: inability to quickly tell the status of MRs

Some of the merge requests that were not merged in eagerly
(being too experimental for that being the most common cause)
tend to diverge from the master but there's no easy way to
tell this until attempted.

Solution: provide a script (./scripts/mr-report) to list MRs

It will show if they have conflicts and show the patches with
conflicts. This is not a perfect solution yet (ideally it should
be integrated into issue-tracking module and perhaps appear
in the UI as well, if feasible), but this solves the problem
here and now.
  • Loading branch information...
yrashk committed Jul 8, 2018
1 parent f9fbd9e commit 1ee5217dd3e54f73d8af68c5a7e67047917940c9
Showing with 40 additions and 0 deletions.
  1. +40 −0 scripts/mr-report
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
root=$(git rev-parse --show-toplevel)
currev=$(git rev-parse HEAD)
sit=$(which sit)
if [ -z "${sit}" ]; then
echo "sit not found"
exit 1
sit_path=$(${sit} path)
tmpdir=$(mktemp -d)
tmpdir_out=$(mktemp -d)
items=$(${sit} -r ${sit_path} items -f "merge_requests != null && state == 'open'")
for id in ${items}; do
mrs=$(${sit} -r "${sit_path}" reduce ${id} -q "join(' ', merge_requests)")
git -C ${root} clone "${root}" "${tmpdir}/${id}" >/dev/null 2>/dev/null
ln -s "${root}/.sit/modules/issue-tracking" "${tmpdir}/${id}/.sit/modules/issue-tracking-master"
for mr in ${mrs}; do
git -C "${tmpdir}/${id}" checkout -b master-merge >/dev/null 2>/dev/null
git -C "${tmpdir}/${id}" am -3 $(ls ${root}/.sit/items/${id}/${mr}/git/*.patch) >/dev/null 2>/dev/null
if [ ${success} != 0 ]; then
fails="${fails} current(\e[31m${tmpdir_out}/${id}_${mr}.diff\e[39m)"
git -C "${tmpdir}/${id}" diff --diff-filter=U >"${tmpdir_out}/${id}_${mr}.diff"
git -C "${tmpdir}/${id}" am --abort
git -C "${tmpdir}/${id}" checkout ${currev} >/dev/null 2>/dev/null
git -C "${tmpdir}/${id}" branch -D master-merge >/dev/null 2>/dev/null
echo -e $(sit -r "${sit_path}" reduce ${id} -q "join(' | ', [join('/', [id, '${mr}']), summary, '${fails}'])")
rm -rf "${tmpdir}/${id}"
rm -rf "${tmpdir}"

0 comments on commit 1ee5217

Please sign in to comment.