CVS leapfrog

I don't do this very often, but on occasion I find my self working on functions in a bit of code, but forget to branch the new changes.  Of course every time I do that I find I need to go back and do bug fixes on the "old" code.

Here is how to do a somewhat graceful code leap frog in CVS.

  1. cvs commit file (commit your current working changes prior to any bug fixes)
  2. cvs up -r $rev_of_working_code file
  3. mv file file.bak
  4. cvs up -A file
  5. cp file.bak file
  6. <make bug fixes here>
  7. cvs commit -m "leapfrog from $rev_of_working_code for bug fix" file

Your old code is now at head with the bug fix.  Now you most likely want to go back to what you were working on. Depending on how complex your changes are there are two ways to do this.

Simple method:

  1. cvs up -j $rev_of_head -j $rev_of_code_before_leapfrog file
  2. cvs up -j $rev_of_working_code -j $rev_of_head file  (you will most likely get a few conflicts.  if the conflicts are over whelming then try the next method)
  3. cvs commit file

Slightly more complex method:

  1. cvs up -r $rev_of_code_before_leapfrog file
  2. mv file file.bak
  3. cvs up -A file
  4. cp file.bak file
  5. cvs up -j $rev_of_working_code -j $rev_of_head file 
  6. cvs commit file

Example:

Current version: 1.16
Code that needs bug fix: 1.15

  1. cvs commit Admin.pm (results in 1.16)
  2. cvs up -r 1.15 Admin.pm
  3. mv Admin.pm Admin.pm.bak
  4. cvs up -A Admin.pm
  5. cp Admin.pm.bak Admin.pm
  6. <apply bug fixes>
  7. cvs commit -m "leapfrogging 1.16 for Bug# 1234" Admin.pm (results in 1.17)
  8. cvs up -j 1.17 -j 1.16 Admin.pm
  9. cvs up -j 1.15 -j 1.17 Admin.pm
  10. cvs commit -m "bringing back changes from 1.16 with bug fixes in 1.17" Admin.pm
  11. joy

Categories

,

About this Entry

This page contains a single entry by James published on July 25, 2007 3:32 PM.

BTNX -- Logitech Revolution MX's best friend was the previous entry in this blog.

Creating chained select boxes with Django and Mootools is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 5.04