-
-
Save Varunram/e75798deda36ff425f41849810a29fcb to your computer and use it in GitHub Desktop.
github conflicting PRs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assuming you have pull requests as part of your github remote: | |
[remote "origin"] | |
url = https://github.com/bitcoin/bitcoin.git | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
fetch = +refs/pull/*/head:refs/pull/origin/* | |
You can do a plausible looking check for conflicts between pull requests 1, 2, 3, 4 and 5 with: | |
tsts="1 2 3 4 5" | |
for xa in $tsts; do | |
a=pull/origin/$xa | |
if (git reset --hard origin/master && git merge $a -m "merge $a to master") >/dev/null; then | |
for xb in $tsts; do | |
git reset --hard $a >/dev/null | |
if [ "$xa" -ge "$xb" ]; then continue; fi | |
b=pull/origin/$xb | |
if (git format-patch $(git merge-base $a $b)..$b --stdout | git apply --check -) > APPLY_${xa}_${xb} 2>&1; then | |
echo "no conflict between $xa $xb" | |
else | |
echo "merge conflict $xa $xb ?" | |
fi | |
done | |
else | |
echo "conflict with $a and master" | |
fi | |
done > CONFLICT | |
format-patch and apply --check don't touch the working tree, so it's not too inefficient. | |
Graphing: | |
(echo "graph compat {"; cat CONFLICT | sed -n 's/merge conflict \([0-9]*\) \([0-9]*\) .$/ \1 -- \2/p'; echo }) | dot -Tpng > CONFLICT.png | |
(echo "graph compat {"; cat CONFLICT | sed -n 's/no conflict between \([0-9]*\) \([0-9]*\)/ \1 -- \2/p'; echo }) | dot -Tpng > COMPAT.png | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment