Tarball generator for Git commits
While working for GSoC last year I kept track of Bazaar patches I sent in for Arsenal. This year I was using Git and as the need arose to generate a submission tarball for my commits I wrote this small utility script: git-generate-tarball.py.
To invoke the script, change into your Git repository and provide an author name and a file as an argument:
[krkhan@orthanc tor]$ /home/krkhan/Downloads/git-generate-tarball.py "Kamran Riaz Khan
" /home/krkhan/Downloads/tor-gsoc-krkhan.tar.gz
generating tarball for commits between Mon May 23 00:00:00 2011 +0000 and Mon Aug 22 19:00:00 2011 +0000
generating patch for commit 5a801a8c8b71c9551a80913398135809cb10cecd
…
/home/krkhan/Downloads/tor-gsoc-krkhan.tar.gz created
The default starting and ending dates for the commits correspond to the schedule for GSoC 2011. You can specify a starting date for the commits you want to be packaged using the --since
argument:
[krkhan@orthanc arm]$ /home/krkhan/Downloads/git-generate-tarball.py --since="August 1, 2011" "Kamran Riaz Khan
" /home/krkhan/Downloads/arm-gsoc-krkhan.tar.bz2
generating tarball for commits between August 1, 2011 and Mon Aug 22 19:00:00 2011 +0000
generating patch for commit 546ca73259d7863e3efe5e11e09c023c2790a2f6
…
/home/krkhan/Downloads/arm-gsoc-krkhan.tar.bz2 created
Same goes for the --before
argument:
[krkhan@orthanc tor]$ /home/krkhan/Downloads/git-generate-tarball.py --before="August 14, 2011" "Kamran Riaz Khan
" /home/krkhan/Downloads/tor-gsoc-krkhan.tar.gz
generating tarball for commits between Mon May 23 00:00:00 2011 +0000 and August 14, 2011
generating patch for commit 5a801a8c8b71c9551a80913398135809cb10cecd
…
/home/krkhan/Downloads/tor-gsoc-krkhan.tar.gz created
Or a combination of both:
[krkhan@orthanc arm]$ /home/krkhan/Downloads/git-generate-tarball.py --since="August 1, 2011" --before="August 14, 2011" "Kamran Riaz Khan
" /home/krkhan/Downloads/arm-gsoc-krkhan.tar.gz
generating tarball for commits between August 1, 2011 and August 14, 2011
generating patch for commit 546ca73259d7863e3efe5e11e09c023c2790a2f6
…
/home/krkhan/Downloads/arm-gsoc-krkhan.tar.gz created
If you want to leave the dates undefined you can leave the arguments empty. For example, the following command shall process all commits before June 1, 2011:
[krkhan@orthanc arm]$ /home/krkhan/Downloads/git-generate-tarball.py --since= --before="June 1, 2011" "Kamran Riaz Khan
" /home/krkhan/Downloads/arm-gsoc-krkhan.tar.gz
generating tarball for commits before June 1, 2011
generating patch for commit 8b4dc162f75d5129e41f028c7253b7b265c8af76
…
/home/krkhan/Downloads/arm-gsoc-krkhan.tar.gz created
Hope this helps fellow GSoCers.
Tags: Code, Git, Google, GSoC, Open Source, Summer of Code