emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using Git to manage your Emacs changes


From: John Wiegley
Subject: Using Git to manage your Emacs changes
Date: Wed, 7 Apr 2010 15:23:13 -0400

If anyone here is like me and can't stand Bzr's interface/lack-of-speed due to 
comfort with Git, there is a *somewhat* more palatable solution:

 1. Install git-bzr (http://github.com/pieter/git-bzr).  Make sure it works by
    testing on some very small project from someplace.

 2. Do a bzr checkout of Emacs.  DO NOT use git-bzr to directly checkout the
    Emacs tree.  It will take days and days and download over 20G of data.

 3. Using git-bzr, point it at your local bzr checkout so it can do a fully 
local
    translation of the Bzr commits to Git commits.  This will take several 
hours,
    but not hog network bandwidth.

 4. When done, you can fetch Bzr changes into your tree with:

      git bzr fetch upstream

 5. Now here's the tricky part.  Move your .git directory from your git-bzr 
checkout
    over into your Bzr working tree.  Yes, we want Bzr and Git to manage the 
same
    tree.  You should be wearing your Depends; this is not for the faint of 
heart.

 6. Create a 'master' branch to queue your Git commits.  You can make topics 
branches
    off the branch, just never modify the upstream branch directly.

       git checkout -b master upstream

 7. Sadly, git-bzr is sufficiently broken that you will not be able to push your
    changes with "git bzr push upstream", as the docs indicate.  Instead, we 
have
    to use "git format-patch" and then turn each patch into a Bzr commit 
manually,
    which get pushed with "bzr push".  Once pushed, "git bzr pull upstream" 
reflects
    that new commit back in Git:

      ./apply.sh upstream     # apply commits using script below; stash if 
needed
      bzr push
      git bzr fetch upstream
      git rebase upstream     # git stash pop afterwards if needed

 8. I expect a blank line after my initial commit description.  If you don't do 
this,
    remove the "| tail +2" from the apply script.  It would seems that using a 
blank
    line is standard in the Git community, but not using it in standard for the 
Emacs
    tree.

I know, it's quite ugly, but using Bazaar has proven even less desirable.

John

#!/bin/bash

git checkout ${1:-upstream}
git format-patch ..master

for i in [0-9]*.patch; do
        echo Applying $i

        patch -p1 < $i

        grep ^Subject: $i | sed 's/^Subject: \[PATCH\] //' > /tmp/msg.$$

        perl -ne 'print if /^$/ .. /^---/;' $i | \
          perl -ne 'print unless /^---/ .. eof()' | \
          tail +2 >> /tmp/msg.$$

        bzr commit -F /tmp/msg.$$

        rm -f /tmp/msg.$$
done

git reset --hard HEAD
git checkout master
rm -f [0-9]*.patch




reply via email to

[Prev in Thread] Current Thread [Next in Thread]