[PATCH] tests: unify test-hardlinks-safety

Adrian Buehlmann adrian at cadifra.com
Wed Sep 15 13:44:53 CDT 2010


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1284576074 -7200
# Node ID c7688fb09d1c9241747e733c17638b5d5ebe8a4c
# Parent  8af6309526e78b7ac824ab0f50fb647c396c6568
tests: unify test-hardlinks-safety

diff --git a/tests/test-hardlinks-safety.out b/tests/test-hardlinks-safety.out
deleted file mode 100644
--- a/tests/test-hardlinks-safety.out
+++ /dev/null
@@ -1,29 +0,0 @@
-% no diff if hardlink
-% init
-adding foo to series file
-applying foo
-now at: foo
-adding bar to series file
-applying bar
-now at: bar
-430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
-4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
-%
-foo
-bar
-%%%
-430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
-%
-foo
-patch foo finalized without changeset message
-patch bar finalized without changeset message
-%%%
-4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
-430ed4828a74fa4047bc816a25500f7472ab4bfe bar
-%
-4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
-430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
-%%%
-4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
-%
-4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
diff --git a/tests/test-hardlinks-safety b/tests/test-hardlinks-safety.t
old mode 100755
new mode 100644
rename from tests/test-hardlinks-safety
rename to tests/test-hardlinks-safety.t
--- a/tests/test-hardlinks-safety
+++ b/tests/test-hardlinks-safety.t
@@ -1,82 +1,106 @@
-#!/bin/sh
 
 # some implementations of cp can't create hardlinks
-cat > cp.py <<EOF
-from mercurial import util
-import sys
-util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
-EOF
+  $ cat > cp.py <<EOF
+  > from mercurial import util
+  > import sys
+  > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
+  > EOF
 
-# test hardlinking outside hg
-mkdir x
-echo foo > x/a
+Test hardlinking outside hg:
 
-python cp.py x y
-echo bar >> y/a
-echo % no diff if hardlink
-diff x/a y/a
+  $ mkdir x
+  $ echo foo > x/a
 
-# test mq hardlinking
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
+  $ python cp.py x y
+  $ echo bar >> y/a
 
-echo % init
-hg init a
-cd a
+No diff if hardlink:
 
-hg qimport -n foo - << EOF
-# HG changeset patch
-# Date 1 0
-diff -r 2588a8b53d66 a
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/a	Wed Jul 23 15:54:29 2008 +0200
-@@ -0,0 +1,1 @@
-+a
-EOF
+  $ diff x/a y/a
 
-hg qpush
+Test mq hardlinking:
 
-cd ..
-python cp.py a b
-cd b
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
 
-hg qimport -n bar - << EOF
-# HG changeset patch
-# Date 2 0
-diff -r 2588a8b53d66 a
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/b	Wed Jul 23 15:54:29 2008 +0200
-@@ -0,0 +1,1 @@
-+b
-EOF
+  $ hg init a
+  $ cd a
 
-hg qpush
+  $ hg qimport -n foo - << EOF
+  > # HG changeset patch
+  > # Date 1 0
+  > diff -r 2588a8b53d66 a
+  > --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  > +++ b/a	Wed Jul 23 15:54:29 2008 +0200
+  > @@ -0,0 +1,1 @@
+  > +a
+  > EOF
+  adding foo to series file
 
-cat .hg/patches/status
-echo %
-cat .hg/patches/series
-echo %%%
-cat ../a/.hg/patches/status
-echo %
-cat ../a/.hg/patches/series
+  $ hg qpush
+  applying foo
+  now at: foo
 
-# test tags hardlinking
-hg qdel -r qbase:qtip
+  $ cd ..
+  $ python cp.py a b
+  $ cd b
 
-hg tag -l lfoo
-hg tag foo
+  $ hg qimport -n bar - << EOF
+  > # HG changeset patch
+  > # Date 2 0
+  > diff -r 2588a8b53d66 a
+  > --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  > +++ b/b	Wed Jul 23 15:54:29 2008 +0200
+  > @@ -0,0 +1,1 @@
+  > +b
+  > EOF
+  adding bar to series file
 
-cd ..
-python cp.py b c
-cd c
+  $ hg qpush
+  applying bar
+  now at: bar
 
-hg tag -l -r 0 lbar
-hg tag -r 0 bar
-echo %%%
-cat .hgtags
-echo %
-cat .hg/localtags
-echo %%%
-cat ../b/.hgtags
-echo %
-cat ../b/.hg/localtags
+  $ cat .hg/patches/status
+  430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
+  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
+
+  $ cat .hg/patches/series
+  foo
+  bar
+
+  $ cat ../a/.hg/patches/status
+  430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
+
+  $ cat ../a/.hg/patches/series
+  foo
+
+Test tags hardlinking:
+
+  $ hg qdel -r qbase:qtip
+  patch foo finalized without changeset message
+  patch bar finalized without changeset message
+
+  $ hg tag -l lfoo
+  $ hg tag foo
+
+  $ cd ..
+  $ python cp.py b c
+  $ cd c
+
+  $ hg tag -l -r 0 lbar
+  $ hg tag -r 0 bar
+
+  $ cat .hgtags
+  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
+  430ed4828a74fa4047bc816a25500f7472ab4bfe bar
+
+  $ cat .hg/localtags
+  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
+  430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
+
+  $ cat ../b/.hgtags
+  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
+
+  $ cat ../b/.hg/localtags
+  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
+


More information about the Mercurial-devel mailing list