Toshio Kuratomi <a.badger(a)gmail.com> wrote:
> When I do serious work against an upstream CVS repository, I
> mirror the CVS repo to git, and do all of my work in git, committing
> changes on private git branches. Then, I can easily rebase each of
> those branches (sort of like cvs update), to synchronize with newer
> upstream changes on the parent branch.[*] When I want to commit to
> cvs, it's easy to automate using git-cvsexportcommit. While this MO is
> not as comfortable as working in a git-only environment, it does help
> give you a feel for what it'd be like, and *I* certainly appreciate it.
> Of course, this can't help for tag/release-related operations, but it's
> a good start for the rest.
That sounds better. Where does all this get setup? On the user's
machine or the server?
The only part that's done on the server is to maintain the git repo
in sync with the master CVS repository. For my usage, I keep two
checked-out repos for each such project: the cvs one and the git one.
I never change anything in the CVS one manually. That's only for the
automated commit-from-git-to-cvs process. Other than that, there's almost
no set-up required. I use a tiny bash function to encapsulate the details
of "apply this git change-set to the corresponding CVS working directory".
That just runs git-cvsexportcommit with options that apply the patch
and ensure that there was no fuzz. git-cvsexportcommit has an option
to perform the commit, but I don't use that -- prefer to verify, first.
git-cvsexportcommit's output includes the "cvs commit -F .msg file1
file2 ..." command that'd be required to commit the affected files,
using the same message you used in the git commit.
I still don't know if you'll get many
developers to try it since you still have to keep both the git and cvs
tree so they can make tag and make build.
We won't know until we try, will we? :-)
git can't push tags back to cvs?
That's not part of git-cvsexportcommit's charter.
However, the cvs-to-git mirroring operation does preserve tags.
> Even with this slightly-contorted routine, I've appreciated
> git: for example, while using conventional diff, patch, and cvs,
> it's easy to forget to "cvs add" a new file that was added by a patch.
> It's also easy to forget to apply "chmod a+x..." to a script just
> by a patch. But in git, that doesn't happen as much, because the tools
> do more of the work for you. And git-cvsexportcommit takes care of the
> details of making sure everything in a git change set makes it back
> into a cvs "commit".
Git does that when you apply a patch?
Yes. In the scenario I described above, it does, since git generates
the patch and applies it, too. The format of classical "diff" output
does not (and cannot) contain the information required for git tools to
perform the extra checks.
Or only when you apply a patch
that was generated via git? (I tried git apply foo.patch but that
didn't seem to have the behaviour you mention.)
Right. That's an inherent limitation in the standard format.
FYI, once you've committed a change in git, you can get the latest
change set in patch format like this:
git-format-patch --stdout --signoff HEAD~1 > patch
or the latest N change sets:
git-format-patch --stdout --signoff HEAD~N > patch
Then, you can later apply that series of change sets via git-am, e.g.
Applying patches that way preserves file permissions, author name
and email, dates, etc.