[LLVMdev] git-svn dcommit Question

David A. Greene dag at cray.com
Fri Jul 8 10:00:19 PDT 2011


NAKAMURA Takumi <geek4civic at gmail.com> writes:

> Dave, bty, don't you work on your branches, but master?
> I think it would be not "the right git way".
>
> ...Takumi
>
> ps. for me, to commit much commits;
>
> $ git checkout master
> $ git rebase -i mybranch
> (pick up commits interactive on master as cherry)
> $ make -C builddir check-all -j4
> $ git svn dcommit -n

I work on branches.  That was the main question I had: how to handle
merges, etc. between branches.

I finally hit upon a sequence that works for me.  I use git-subtree to
keep a repository of the LLVM/Clang world around.  To commit to LLVM:

(previously I had done git remote add llvm-upstream
https://greened@llvm.org/git/llvm.git)

git subtree split -P llvm -b upstream
git checkout upstream
git svn init https://greened@llvm.org/svn/llvm-project/llvm/trunk
git config svn-remote.svn.fetch ':refs/remotes/llvm-upstream/master'
git config svn-remote.svn.url 'https://greened@llvm.org/svn/llvm-project/llvm/trunk'
git svn fetch
git svn rebase -l
git svn dcommit -dry-run -n

Spits out a bunch of things like:

diff-tree 6ac658fc756cd78d75c58b77e2994830ce50300f~1 6ac658fc756cd78d75c58b77e2994830ce50300f
diff-tree 0f2bb78415654038ad914f3e937c372505320b04~1 0f2bb78415654038ad914f3e937c372505320b04
diff-tree b59e257caa9311048915b0a93c417987177a47f4~1 b59e257caa9311048915b0a93c417987177a47f4
diff-tree e71fe076e5e6cac03dab04bf961961633f3b0f2a~1 e71fe076e5e6cac03dab04bf961961633f3b0f2a
diff-tree 3dd36498cc2d0d12b58664b13b3bfb6b4a42b5d1~1 3dd36498cc2d0d12b58664b13b3bfb6b4a42b5d1
diff-tree 04bf58415302e738394db762408ba5de208c520a~1 04bf58415302e738394db762408ba5de208c520a

Then it's a matter of doing "git diff" on the above to find the next
commit I want to send.  I run "git log" to find the commit just before
all of the above commits (that get rebased).  After that:

git checkout c7a3e2945bf15c99d8267cb2c4434021355fe008
git checkout -b commit  # Split off a branch starting just before the
                        # rebased commits.
git cherry-pick 0f2bb78415654038ad914f3e937c372505320b04  # Next commit
                                                          # to send
git svn dcommit --dry-run -n

Gives one output:

diff-tree 5a6ab4ff0e0be9ba0737984c670ee71d0cccc5d1~1 5a6ab4ff0e0be9ba0737984c670ee71d0cccc5d1 > init.diff

A quick "git diff" and "git log" confirms this is the one I want.  Then
I do:

git svn dcommit

Or, at least I will after the patch gets some review.  :)

So it's a little more involved but seems to let me be a little more
flexible with how I use git.  Maybe I'll write something up for the web
documentation.  Do we have a git usage section somewhere?

Thanks for your help!
                              -Dave



More information about the llvm-dev mailing list