Back In Time

A common problem with CVS is that it doesn’t preserve file modification timestamps.  For normal source control, preserving or relying on these timestamps is neither needed nor recommended.  But there are plenty of cases where this is a legitimate requirement, such as storing non-source files used directly by customers.  Rough partial workarounds are possible in CVS (such as “import -d” and Entries file hacking), but these are incomplete, kludgy, and problematic.

So, a simple solution I used today is to generate a script that can put back the original timestamps:

find . -printf ‘touch -c -t %TY%Tm%Td%TH%TM “%p”\n’

I checked the generated script into CVS alongside the files so it can be re-run and updated as needed.

Share This:
  • Print
  • Digg
  • StumbleUpon
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Google Buzz
  • RSS

One thought on “Back In Time

  1. Derek Post author

    Based on a question I received, I should clarify one thing…

    If you have a lot of old files (particularly ones that may not be changed again for awhile), and preserving timestamps is important for those, then “import -d” is the way to go. But CVS controls the timestamps of subsequent checkins, and the only way around that is to put the timestamps back with a “touch” script. This becomes an issue when receiving updates to third-party files, or when trying to re-create a history of prior (pre-CVS) changes.

    Some additional (obvious but limited) work-arounds are using additional modules so you can import again, and simply not going as far back when re-creating history.

Comments are closed.