source: trunk/CVSROOT/timestamps.pl @ 15014

Revision 15014, 746 bytes checked in by ghudson, 24 years ago (diff)
Add timestamp-munging script for order-preserving imports.
  • Property svn:executable set to *
Line 
1#!/usr/athena/bin/perl
2
3# timestamps: Prepare for a "cvs import -d" by resetting the mod times
4# in the current directory tree such that all files are ordered
5# properly relative to each other but are all between the current time
6# and N seconds in the past, where N is the number of files in the
7# tree.  This way, source files don't appear spuriously out of date
8# with respect to each other, but checkouts by date do not break
9# appreciably.
10
11use File::Find;
12
13sub wanted {
14    return if (! -f $_);
15    $mtime = (lstat)[9];
16    push @{$files{$mtime}}, $File::Find::name;
17}
18
19find(\&wanted, '.');
20
21$newmtime = time - scalar keys(%files);
22foreach $mtime (sort(keys(%files))) {
23    $newmtime++;
24    utime $newmtime, $newmtime, @{$files{$mtime}};
25}
Note: See TracBrowser for help on using the repository browser.