[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] Moving from Bazaar (bzr) to git
From: |
Geoffrey Thomas |
Subject: |
Re: [RFC] Moving from Bazaar (bzr) to git |
Date: |
Mon, 24 Jun 2013 19:50:39 -0700 |
User-agent: |
Alpine 2.02 (DEB 1266 2009-07-14) |
On Sat, 22 Jun 2013, Paul Menzel wrote:
Hopefully everyone will agree, that git is the most popular one in the
FOSS world (Linux, freedesktop.org, GNOME, KDE, …) and a lot of people
are now familiar with the basic git commands. So using Bazaar is one
more thing to deal with for new contributors before making a
contribution to GRUB. (I know there is git-bzr-ng, but it is still one
more step.)
Talking to Vladimir and Colin in #grub, they did not oppose a migration
to git and Vladimir asked me to bring it up on the list.
Does anyone have experience with such a move and how to do it on
Savannah? Could you please share these? That would be great.
I did a conversion via bzr fast-export | git fast-import a while ago for
my workplace, so that we could internally use git for development (so we
all don't have to learn yet another VCS). Our priorities have shifted so
we haven't hacked on GRUB for a while, but this thread inspired me to dust
off the conversion, and re-attempt setting up a cronjob to do the import.
I believe I now have it working and it should push new commits every hour:
https://github.com/mokafive/grub
I'd be thrilled for GRUB to adopt that history -- let me know if it looks
reasonable. Until there's a move to git, I intend to keep the URL working,
so feel free to clone and format-patch from there. I'll try not to break
history, but if someone points out that something got mis-imported, I'll
fix that, which will involve rewriting history.
I haven't handled branches, because they don't look very active and
honestly I don't yet understand bzr branching. I think handling it is
straightforward, though, so I will figure that out if someone asks.
If you're curious about the details, the scripts I used for the conversion
are at the end of the email; consider them freely usable with no
restrictions. Here are the issues I ran into:
* For some reason, git packs the fast-import very, very poorly, causing
the .git directory to balloon to over a gigabyte (for comparison, the .bzr
directory is 21M). Running `git gc --aggressive` fixes it and drops .git
to more like 20M. Note that Github seems to preserve the packing you send
it, so if you make a new repo on the Github web interface, clones _from_
there will be gargantuan if you don't run the aggressive GC before the
first time you push. I don't seem to need to rerun the GC on incremental
imports, fortunately.
* A couple of commits (like
address@hidden / b38045f in my
import) seem to have an empty author name or email, when fast-exported,
but a valid committer. So I set the author to the committer.
* .bzrignore needs to become .gitignore, so I changed that in each commit
so that checking out older commits works reasonably. bzr has some built-in
defaults that git doesn't, that GRUB makes use of (like *.o), so I added
those. Also, .bzrignore itself was listed in .bzrignore, which strikes me
as odd.
* I couldn't easily figure out how to make filter-branch resume from a
certain point. Fortunately it doesn't take _that_ long to filter the whole
thing, and is consistent. I think you can do this with .git/info/replace,
if you really care, though.
There's nothing Github-specific about the import, so it should upload to
Savannah just fine. I can post the "marks" files, for converting between
bzr and git commit names, if people find them useful.
As probably implied by the fact that I did this, I'm a fan of moving, both
because git is significantly more popular and because I find the UI better
than bzr's (although that may just be familiarity).
--
Geoffrey Thomas
address@hidden
address@hidden grub]$ crontab -l
0 * * * * chronic /home/gthomas/src/grub/import.sh
address@hidden grub]$ cat import.sh
#!/bin/sh
set -e
cd ~/src/grub/bzr
bzr up
cd ~/src/grub/git
bzr fast-export --branch=import --marks=../bzr-marks ../bzr | git fast-import
--import-marks-if-exists=../git-marks --export-marks=../git-marks --quiet
git reset --hard
../filter.sh
git reset --hard
git push github HEAD:upstream
address@hidden grub]$ cat filter.sh
#!/bin/sh
set -e
export default_ignores=$(python -c "from bzrlib import ignores; print
\"\\n\".join(ignores.USER_DEFAULTS)")
git update-ref -m "New upstream" refs/heads/upstream import
git checkout upstream
git reset --hard
dir=$(mktemp -d --tmpdir=${XDG_RUNTIME_DIR:-/tmp} filter-branch.XXXXXX)
git filter-branch -f -d "$dir" --env-filter '
export GIT_AUTHOR_NAME=${GIT_AUTHOR_NAME:-$GIT_COMMITTER_NAME}
export GIT_AUTHOR_EMAIL=${GIT_AUTHOR_EMAIL:-$GIT_COMMITTER_EMAIL}
' --index-filter '
flag=0
if git checkout .bzrignore 2>/dev/null; then
sed "s/^\*\*\///" .bzrignore | grep -v .bzrignore > .gitignore
echo "$default_ignores" >> .gitignore
git rm -qf .bzrignore
git diff .gitignore
git add .gitignore
if git show --pretty=format: --name-only "$GIT_COMMIT" | grep -Fxq
.bzrignore; then
flag=1
fi
fi' --msg-filter '
cat
if [ "$flag" = 1 ]; then
echo
echo "[git importer: converted .bzrignore to .gitignore]"
fi'
- Re: [RFC] Moving from Bazaar (bzr) to git, (continued)
Re: [RFC] Moving from Bazaar (bzr) to git,
Geoffrey Thomas <=