CVS caching/offline commits

Edward Glowacki glowack2@msu.edu
Fri, 28 Sep 2001 16:50:15 -0400


Does CVS allow you to work offline?  Yes, I know you can edit files
without a net connection, you know that's not what I mean... ;)

Here's a scenario I came up with that seems like CVS wouldn't handle
very well.  Imagine using a laptop to work on a file from CVS.
You're out under a tree somewhere in the forest, and you just fixed
a nasty bug, so you want to commit the change.  Except you don't
have net access.  Normally not a problem, just wait to connect when
you get back to town.  But what if you still have a lot of work to
do on the file, fixing some other bugs and making changes.  Is it
possible to cache your "cvs commit" until later, perhaps queueing
up 2 or 3 logical changes that should each be done separately and
sequentially so you get the proper revision tracking and changelog
CVS provides?  I would assume this could be done with a CVS wrapper
of some kind:

commit() {
    if CVS connection fails {
        mkdir CVS.cache
        cp changed_file.ext CVS.cache/changed_file.ext.YYYYMMDDHHMMSS
        echo "CVS commit for changed_file.ext cached"
    }
}

flush_cache() {
    for file in CVS.cache/* {
        cp CVS.cache/changed_file.ext.YYYYMMDDHHMMSS changed_file.ext
        cvs commit changed_file.ext
        rm CVS.cache/changed_file.ext.YYYYMMDDHHMMSS
        echo "CVS commit for changed_file.ext completed, removed from cache"
    }
}

(great psuedocode, eh? ;) )

Granted, for major projects this might be a bit, um, precarious, but for
small setups (like editing personal web pages or something), it would
seem that this might be possible.  Any thoughts?

-- 
Edward Glowacki				glowack2@msu.edu
GLLUG Peon  				http://www.gllug.org
Imagination is the one weapon in the war against reality.
                -- Jules de Gaultier