Wednesday, January 12, 2011

historical mozilla-central git repository

A number of people use git to work with the mozilla hg tree. In the past I've wanted the entire history as a git repo so I converted the old CVS repository to git and put it up on people.mozilla.org.

You can set it up as follows:

git clone http://people.mozilla.org/~jmuizelaar/mozilla-cvs-history.git
git clone git://bluishcoder.co.nz/git/mozilla-central.git

cd mozilla-central/.git/objects/pack
# set up symbol links to cvs-history pack files
ln -s ../../../../mozilla-cvs-history/.git/objects/pack/pack-5b5d604ab48cf7bc2a6b4495292fa8700a987c5f.pack .
ln -s ../../../../mozilla-cvs-history/.git/objects/pack/pack-5b5d604ab48cf7bc2a6b4495292fa8700a987c5f.idx .
cd ../../

# add a graft from the last revision in the mozilla-central repo
# to the first revision in the cvs-history
echo 2514a423aca5d1273a842918589e44038d046a51 3229d5d8b7f8376cfb7936e7be810635a14a486b > info/grafts

Now you have a git repository containing all of the history. You can update the mozilla-central repository as you normally would. The conversion isn't perfect, but it's been good enough to have working blame back into cvs time.

6 comments:

  1. I still wish we could get cvs history to hg.
    Fortunately there is at least http://mxr-test.konigsberg.mozilla.org/

    ReplyDelete
  2. Instead of symlinks, you can use alternates:
    echo /path/to/mozilla-cvs-history/.git/objects >> .git/objects/info/alternates

    ReplyDelete
  3. FWIW, replacing git:// w/ http:// worked for the 2nd URL - needed due to firewall rules at this location.

    Took 2 hours to do the clone though.

    ReplyDelete
  4. I had some trouble getting this to work with the SHAs shown here. Did something change? Using 465265d0d473d107b76e74d969199eaf2cdc8750 for the start of mozilla-central/ and 59462c3c9a59e296bb333fab4c848f205e7ea21f for its parent in mozilla-cvs-history made things work for me. BTW, the comment above your grafts echo is the reverse of what (I think) you meant.

    This is what I get for git show (sans diffs) for those two SHAs:

    commit 59462c3c9a59e296bb333fab4c848f205e7ea21f
    Author: crowder%fiverocks.com
    Date: Thu Mar 22 17:06:02 2007 +0000

    Bug 373794: backing out due to trunk closure, apologies.

    commit 465265d0d473d107b76e74d969199eaf2cdc8750
    Author: hg@mozilla.com
    Date: Thu Mar 22 10:30:00 2007 -0700

    Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag


    Full steps:

    # Clone mozilla-cvs-history and mozilla-central repositories
    git clone http://people.mozilla.org/~jmuizelaar/mozilla-cvs-history.git
    git clone git://github.com/doublec/mozilla-central.git

    # Tell mozilla-central about mozilla-cvs-history
    echo /path/to/mozilla-cvs-history/.git/objects >> mozilla-central/.git/objects/info/alternates

    # Connect mozilla-central's initial commit to its parent in mozilla-cvs-history
    echo 465265d0d473d107b76e74d969199eaf2cdc8750 59462c3c9a59e296bb333fab4c848f205e7ea21f >> mozilla-central/.git/info/grafts

    ReplyDelete
  5. If other people got here via Google the historical CVS repo appears to be on Github now:
    https://github.com/jrmuizel/mozilla-cvs-history

    thanks Jeff for making this happen.

    ReplyDelete