Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time. Cannot retrieve contributors at this time
executable file 21 lines (14 sloc) 345 Bytes
#!/bin/bash
if [ ! -d ".hg" ]; then
echo "this doesn't look like a mercurial repo"
exit 1
fi
mkdir -p .hg/stash
patch_series=($(ls .hg/stash/*.diff 2>/dev/null))
if [ ! $patch_series ]; then
echo "empty patch queue"
exit 2
fi
last_patch=${patch_series[-1]}
patch -p 1 < $last_patch && rm $last_patch
echo applied $last_patch