Skip to content

Instantly share code, notes, and snippets.

@gjergjsheldija
Created July 16, 2012 11:44
Show Gist options
  • Save gjergjsheldija/3122261 to your computer and use it in GitHub Desktop.
Save gjergjsheldija/3122261 to your computer and use it in GitHub Desktop.
create hg changesets
#!/bin/bash
if [ $# -lt 3 ] ; then
cat <<HELP
create-changeset -- creates a tar.gz file with the changed files
USAGE: create-changeset 'repository-path' 'revision-from' 'revision-to'
EXAMPLE: create-changeset /var/www/survey 4 5
HELP
exit 0
fi
mkdir /tmp/project
## changed files
cd $1
for changed_files in `hg log --rev $2:$3 --template '{files}\n'`
do
cp --parents $changed_files /tmp/project
done
## list of removed files
hg log --rev $2:$3 --template '{files_dels}\n' > removed_files.txt
mv removed_files.txt /tmp/project
## changelog
hg log --rev $2:$3 --style changelog > changelog
mv changelog /tmp/project
cd /tmp/project
tar -czf changes.$2-$3.tar.gz *
mv changes.$2-$3.tar.gz $1
rm -rf /tmp/project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment