Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jdavidb (1361)

jdavidb
  (email not shown publicly)
http://voiceofjohn.blogspot.com/

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Tuesday July 15, 2008
04:44 PM

New git - cvs checkout procedure

[ #36919 ]

Previously my mechanism of checking into CVS from git caused problems: I plucked changes off of my work branch and reapplied them to the HEAD of the master branch with git rebase --onto, leaving local changes that I never want to commit back in the local branch. Then I committed, then went back to the master branch and pulled from CVS again where I had to fix things because my ignored CVS directories were telling CVS I had newer versions of files than my master branch actually had. This resulted in files appearing to CVS to be modified when they were not (and the modifications appeared to be reversions of the changes I had just checked in).

My new procedure avoids this, exercises more of git's neat features, and permits me to keep my own individual changes sitting in my repository's master branch forever instead of turning into just one big lump pull from CVS (possibly combined with other unrelated changes).

Branch definitions:

  • master: tracks CVS
  • local: tracks master, incorporates local changes that I never want to commit
  • work: actually I have a dozen work branches with different names. All are more descriptive than "work," but I will use "work" as the name for this example. Each one is a divergence from local at some (hopefully recent) point.

Here's my procedure:

  • Copy my work branch:

    git checkout work
    git checkout -b work-cvs

  • Rewrite the history of the copy so that it is a branch off of master, not a branch off of local. This removes my local changes:

    git rebase --onto master local work-cvs

  • Check my changes into CVS. Helpful code that I use while writing my very long and descriptive commit message:
    • Show changed files:

      g diff --name-status master

    • Show changes:

      git diff master

    • Show log entries:

      git log

  • Here's the new part: merge my branch back into master, which allows me to keep the record of the changes forever as well as not have to pull the changes down from CVS again:

    git checkout master
    git merge work-cvs

  • Delete the cvs branch, as I don't need it any more:

    git branch -d work-cvs

  • Finally, I think I can now pull these changes straight back down into my original work branch and keep working, although I'm not sure that I won't run into issues. Previously I had to remember to delete the work branch when it was committed and make a new one if I wanted to continue a branch with that name, or I got odd results:

    git checkout local
    git merge master
    git checkout work
    git merge local

We'll see how this goes. Seems much, much better than before. Definitely better than tracking CVS directories in some or all of my branches, which I was considering.

I tried using the git-cvs interfaces when I first started this adventure, but after working fine a couple of times for small changes, it choked up on a series of 8 or more patches from git, leaving the CVS repository in an unforgiveably (but not unrecoverably) broken state. The last thing I want to happen while I'm getting to know git is for my git activity to be noticed in this way.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.