view tests/test-symlinks @ 2076:d007df6daf8e

Create an atomic opener that does not automatically rename on close The revlog.checkinlinesize() uses an atomic opener to replace the index file after converting it from inline to traditional .i and .d files. If this operation is interrupted, the atomic file class can overwrite a valid file with a partially written one. This patch introduces an atomic opener that does not automatically replace the destination file with the tempfile. This way an interrupted checkinlinesize() call turns into a noop.
author mason@suse.com
date Tue, 04 Apr 2006 16:38:44 -0400
parents 6c61646fee5e
children fd77b7ee4aac
line wrap: on
line source

#!/bin/sh
#Test bug regarding symlinks that showed up in hg 0.7
#Author: Matthew Elder <sseses@gmail.com>

#make and initialize repo
hg init test; cd test;

#make a file and a symlink
touch foo; ln -s foo bar;

#import with addremove -- symlink walking should _not_ screwup.
hg addremove

#commit -- the symlink should _not_ appear added to dir state
hg commit -m 'initial'

#add a new file so hg will let me commit again
touch bomb

#again, symlink should _not_ show up on dir state
hg addremove

#Assert screamed here before, should go by without consequence
hg commit -m 'is there a bug?'

cd .. ; rm -rf test
hg init test; cd test;

mkdir dir
touch a.c dir/a.o dir/b.o
# test what happens if we want to trick hg
hg commit -A -m 0
echo "relglob:*.o" > .hgignore
rm a.c
rm dir/a.o
rm dir/b.o
mkdir dir/a.o
ln -sf nonexist dir/b.o
mkfifo a.c
# it should show a.c, dir/a.o and dir/b.o deleted
hg status
hg status a.c