Last active
August 29, 2015 14:07
-
-
Save rdebath/159c0b5af5d881025556 to your computer and use it in GitHub Desktop.
Making CVS break it's rules.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
head 1.12; | |
access; | |
symbols; | |
locks; strict; | |
comment @# @; | |
1.12 | |
date 2011.11.27.13.41.55; author nobody; state Exp; | |
branches; | |
next 1.11; | |
commitid 1004ED23E2362D4481F; | |
1.11 | |
date 2009.11.26.13.41.33; author nobody; state Exp; | |
branches; | |
next 1.10; | |
commitid 1004B0E858D62CDF796; | |
1.10 | |
date 2007.11.26.13.41.11; author nobody; state Exp; | |
branches; | |
next 1.9; | |
commitid 100474ACCF762C7878B; | |
1.9 | |
date 2005.11.25.13.40.49; author nobody; state Exp; | |
branches; | |
next 1.8; | |
commitid 1004387146162BEAE7B; | |
1.8 | |
date 2003.11.25.13.40.27; author nobody; state Exp; | |
branches; | |
next 1.7; | |
1.7 | |
date 2001.11.24.13.40.05; author nobody; state Exp; | |
branches; | |
next 1.6; | |
1.6 | |
date 99.11.24.13.39.43; author nobody; state Exp; | |
branches; | |
next 1.5; | |
1.5 | |
date 97.11.23.13.39.21; author nobody; state Exp; | |
branches; | |
next 1.4; | |
1.4 | |
date 95.11.23.13.38.59; author nobody; state Exp; | |
branches; | |
next 1.3; | |
1.3 | |
date 93.11.22.13.38.37; author nobody; state Exp; | |
branches; | |
next 1.2; | |
1.2 | |
date 91.11.22.13.38.15; author nobody; state Exp; | |
branches; | |
next 1.1; | |
1.1 | |
date 89.11.21.13.37.53; author nobody; state Exp; | |
branches; | |
next ; | |
desc | |
@@ | |
1.12 | |
log | |
@This is a sample commit | |
@ | |
text | |
@The time, sponsered by timewarp associates, is now: Sun Nov 27 13:41:35 GMT 2011 exactly. | |
# This file has an $Id: peekaboo$ tag. | |
@ | |
1.11 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Thu Nov 26 13:41:13 GMT 2009 exactly. | |
@ | |
1.10 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Mon Nov 26 13:40:51 GMT 2007 exactly. | |
@ | |
1.9 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Fri Nov 25 13:40:29 GMT 2005 exactly. | |
@ | |
1.8 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Tue Nov 25 13:40:07 GMT 2003 exactly. | |
@ | |
1.7 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Sat Nov 24 13:39:45 GMT 2001 exactly. | |
@ | |
1.6 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Wed Nov 24 13:39:23 GMT 1999 exactly. | |
@ | |
1.5 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Sun Nov 23 13:39:01 GMT 1997 exactly. | |
@ | |
1.4 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Thu Nov 23 13:38:39 GMT 1995 exactly. | |
@ | |
1.3 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Mon Nov 22 13:38:17 GMT 1993 exactly. | |
@ | |
1.2 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Fri Nov 22 13:37:55 GMT 1991 exactly. | |
@ | |
1.1 | |
log | |
@This is a sample commit | |
@ | |
text | |
@d1 1 | |
a1 1 | |
The time, sponsered by timewarp associates, is now: Tue Nov 21 13:37:33 GMT 1989 exactly. | |
@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# CVS is a PITA (Useful, yes, but no I never did like it that much) | |
# It has obviously been specified by idiots who think THEY are in control. | |
# Make us run under nohup & fakeroot so it looks like we're a daemon. | |
# The 'cat' command allows up to see the output without being directly | |
# connected to the terminal (and so we have no ctty). | |
[ "`id -u`" -ne 0 ] && { | |
nohup fakeroot sh "$0" "$@" 2>&1 </dev/null | cat | |
exit | |
} | |
echo Running ... | |
# Bomb out when CVS whinges | |
set -e | |
# Add the location of a pre'05 version of cvs to the PATH. | |
# This one built from cvs1.12.11 as at Mon Dec 13 17:34:03 2004 +0000 | |
# ./configure --prefix=$HOME/etc/cvs-1.12.11; make ; make install | |
# | |
# This is needed so that old (pre Feb'05) commits do NOT have a commitid. | |
# as CVS mainline insists on inserting them now despite backwards | |
# compatibility. | |
ORIGPATH="$PATH" | |
export PATH="$HOME/etc/cvs-1.12.11/bin:$PATH" | |
# Start back in the eighties, the dates looked very different then. | |
RUNSTART='86-06-22 18:14:46' # --> AE CM CV DF GC LS RM RV SV UV | |
RUNSTART='89-11-20 13:37:33' # 'checkin', cvs checkout... That's one very suspicious time. | |
TZ=UTC | |
DAY=86400 # in seconds | |
# CVS tries very hard to get a 'real' user name, of course this is just | |
# an annoyance because you can make any old login for yourself on a | |
# virtual machine. To make this a little easier here's a dumb trick. | |
# | |
# This login name will only be honoured if you run this script under | |
# both nohup and fakeroot and the user actually exists. (even if it | |
# isn't you) | |
export LOGNAME=nobody | |
# Save stuff here. | |
TESTDIR=/tmp/test.repo | |
# In this part. | |
MODULE=timewarp | |
REPOOPT=-d:local:"$TESTDIR"/$MODULE.repo | |
# export CVSROOT="$TESTDIR"/$MODULE.repo | |
Q= # -Q | |
# We want to control the times given to our children, so fetch the env | |
# vars set by 'faketime'. We can then fast-forward minutes, hours, | |
# days, weeks or years with a simple addition. | |
unset FAKETIME | |
FAKETIME="`faketime \"$RUNSTART\" sh -c 'echo $FAKETIME'`" | |
[ "$FAKETIME" -lt 1 ] || exit 1 | |
LD_PRELOAD="`faketime \"$RUNSTART\" sh -c 'echo $LD_PRELOAD'`" | |
export FAKETIME LD_PRELOAD | |
# Recreate the test arena. | |
rm -rf "$TESTDIR" | |
mkdir "$TESTDIR" | |
# Are we starting after commitids came into existence? | |
LASTYEAR=`date +%Y%m` | |
[ "$LASTYEAR" -ge 200502 ] && export PATH="$ORIGPATH" | |
# Create the Repo, record when it was done. | |
cd "$TESTDIR" | |
cvs $Q $REPOOPT init | |
# Create the 'module' | |
mkdir "$TESTDIR"/$MODULE.repo/$MODULE | |
# This will cover 24 years... | |
for i in 1 2 3 4 5 6 7 8 9 10 11 12 | |
do | |
cd "$TESTDIR" | |
cvs $Q $REPOOPT checkout $MODULE | |
rm -rf "$TESTDIR"'/$MODULE.checkout' | |
mv "$TESTDIR"/$MODULE "$TESTDIR"'/$MODULE.checkout' | |
# Move forward one day. | |
export FAKETIME=$((FAKETIME+DAY)) | |
# Update the file. | |
cd "$TESTDIR"'/$MODULE.checkout' | |
echo "The time, sponsered by timewarp associates, is now: `date` exactly." > README | |
echo '# This file has an $Id: peekaboo$ tag.' >> README | |
# Only 'add' the file first time round the loop. | |
[ "$i" = 1 ] && { | |
cd "$TESTDIR"'/$MODULE.checkout' | |
cvs $Q $REPOOPT add README | |
} | |
# Only checked out for 20 seconds. | |
export FAKETIME=$((FAKETIME+20)) | |
cd "$TESTDIR"'/$MODULE.checkout' | |
cvs $Q $REPOOPT commit -m "This is a sample commit" | |
cd "$TESTDIR" | |
# Warp ahead two years. | |
export FAKETIME=$((FAKETIME+DAY*365*2)) | |
# Commitids first appeared in Febuary 2005 | |
[ "$LASTYEAR" -lt 200502 ] && [ `date +%Y%m` -ge 200502 ] && { | |
# If we were using an old version; switch now. (ie: remove it from PATH) | |
export PATH="$ORIGPATH" | |
} | |
LASTYEAR=`date +%Y%m` | |
done | |
# Now we have the repo ... what do we do with it ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment