Wednesday, January 11, 2012

Tools: repoclone, reporeset, repohardlink

Updated: January 22nd, 2012

I wrote three simple scripts that may be useful for Android AOSP or CyanogenMod developers.  Download the scripts from github.
  • repoclone
    • Clone entire local repo to another local repo.  VERY QUICK because it uses hardlinks between git pack objects.  This is safe because git clone itself hardlinks these large files if you clone two local git repos.  Note: repoclone can be even more storage efficient if it runs git gc in every git repo prior to cloning.  Future versions will do this.
  • reporeset
    • git reset --hard in every git repo.  You can also use this to fully clean your existing repo back to pristine sources.  First use repo status to check for topic branches and repo abandon if you want to drop your local branches and revert fully to upstream.
  • repohardlink
    • Use this script to safely hardlink git pack objects between two existing repos in order to reclaim some storage space.  For best results, repo sync in both repos prior to using repohardlink.  By default, repohardlink will only attempt to unify git repos that have changed since you used repoclone.  Use --all to unify storage between two existing repos.  Unfortunately, --all is not as storage efficient as repoclone.  Currently repoclone saves you ~2GB additional storage between two parallel CM trees.
Why repoclone?
  • If you have cm7 locally and want a parallel cm9 repo so you can easily build from both, you can use this script to have both repos side-by-side while maximizing storage efficiency.
    • repoclone cm7 cm9
    • cd cm9
    • (Edit your .repo/local_manifest.xml) 
    • repo init -b ics
    • repo sync
Please reply here or write me at if you have any comments or questions.

If this tip was helpful, please consider supporting the Epic CM Team with even a tiny contribution. 

No comments:

Post a Comment