Git-Svn commit?

Folks,

I'm now using the git mirror, but I'm not sure how to commit changes
via git, if at all possible. So far, I'm diffing & applying it on an
RW svn tree and committing, but that makes me test twice and it's
error prone.

I read the manual regarding git-svn setup and all it has is the
connection to svn to keep svn's linearity, but nothing on commit
strategy.

With git, I normally issue a pull request, but in LLVM, this won't
work. Is there a FAQ/doc/manual on how to do that or what are the best
practices when working with git?

Renato Golin <rengolin@systemcall.org> writes:

I'm now using the git mirror, but I'm not sure how to commit changes
via git, if at all possible. So far, I'm diffing & applying it on an
RW svn tree and committing, but that makes me test twice and it's
error prone.

git svn dcommit

[snip]

Basically, once you are set up with git-svn (see
<http://llvm.org/docs/GettingStarted.html#for-developers-to-work-with-git-svn&gt;\),
all you have to do is `git svn dcommit`.

My workflow when it comes time to commit is basically:

1. checkout master and pull from origin.
2. rebase stuff to be committed onto master.
3. `git svn dcommit --dry-run` to see what is going to be committed.
4. `git svn dcommit --interactive` to doublecheck that the right stuff
is being committed as you send it off.

steps 3 and 4 can become just `git svn dcommit`, but once I had
git-svn get confused (I have no clue why) and try to re-commit other
commits that were already checked in, so I've decided to play it safe.
Actually, I think that 1 and 2 might be automatically handled by
git-svn, but I prefer to be a bit more explicit about it.

This probably deserves to be mentioned on a "Workflows" document,
listing a sampling of the different development workflows that people
use when developing LLVM. I've been wanting to write a document like
that for a while now, and this thread might be just the impetus I need
(if you're interested in this please say so).

-- Sean Silva

Basically, once you are set up with git-svn (see
<Getting Started with the LLVM System — LLVM 18.0.0git documentation),
all you have to do is `git svn dcommit`.

Oh, the docs do mention "dcommit" en passant, but nothing explicit.

1. checkout master and pull from origin.
2. rebase stuff to be committed onto master.

Can you commit directly from branches? Or do you have to merge to
master to commit?

3. `git svn dcommit --dry-run` to see what is going to be committed.
4. `git svn dcommit --interactive` to doublecheck that the right stuff
is being committed as you send it off.

I agree on being explicit. I generally prefer to write small shell
scripts that will stop on unwanted situation than hope for git/svn to
be safe. From experience, neither is completely trustworthy, though I,
too, can't blame the tools without blaming myself. :wink:

This probably deserves to be mentioned on a "Workflows" document,
listing a sampling of the different development workflows that people
use when developing LLVM. I've been wanting to write a document like
that for a while now, and this thread might be just the impetus I need
(if you're interested in this please say so).

If you're up to writing the docs, I'd be happy to serve as the Guinea
pig to test it.

1. checkout master and pull from origin.
2. rebase stuff to be committed onto master.

Can you commit directly from branches? Or do you have to merge to
master to commit?

I believe that what git-svn does is commit everything in your branch
that isn't in mainline (i.e. `origin/master..HEAD`). I don't think it
really pays any attention to branches (besides moving them after
committing).

I believe that what git-svn does is commit everything in your branch
that isn't in mainline (i.e. `origin/master..HEAD`). I don't think it
really pays any attention to branches (besides moving them after
committing).

As if it was an SVN tree, makes sense.

Ok. I'll try to get to that today or tomorrow and CC you on the review thread.

Thanks!

I'm not sure if this was clear from my description, but it will still
commit each commit in `origin/master..HEAD` individually.

-- Sean Silva

Not explicitly, but I assumed so. Good thing git has a powerful
squash/merge/reword interface.

This is probably another topic that it's worth mention in the docs explicitly.

Sorry for the massive delay on this... did this thread at least fix
your immediate problem? It may be a while until I can get to writing a
"workflows" page.

-- Sean Silva

Hi Sean,

Don't worry, I'm not in a hurry right now and I think this thread does
solve the problem (haven't tested yet).

I think I'll change the current page slightly just to make it more clear...

thanks,
--renato

Ok, please do.

-- Sean Silva

r171642, via dcommit. :wink:

cheers,
--renato