Skip to content

Instantly share code, notes, and snippets.

@rsebbe
Created January 18, 2012 19:35
Show Gist options
  • Save rsebbe/1635083 to your computer and use it in GitHub Desktop.
Save rsebbe/1635083 to your computer and use it in GitHub Desktop.
Finds the changeset corresponding to the passed build version (CFBundleVersion)
#!/bin/bash
bn=(`echo $1 | tr '.' ' '`)
revn=${bn[0]}
hsh=${bn[1]}
# convert decimal hash to hexadecimal
hsh=`printf '%3.3x' $hsh`
# check all the hashes that start with the prefix
for rev in `hg log --template "{node}\n" | grep ^$hsh`
do
#echo $rev
nrev=`hg log -r "0::$rev" --template "{node}\n" | wc -l`
if [ "$nrev" -eq "$revn" ]
then
nrev=`hg log -r $rev --template "{rev}"`
echo "Revision found for build number $1: $nrev"
exit 0
fi
done
echo "Revision for build number $1 not found"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment