tests: unify test-share
authorMatt Mackall <mpm@selenic.com>
Sun, 26 Sep 2010 13:44:49 -0500
changeset 12487 9792013e2f53
parent 12486 95b4af4eaa06
child 12488 73ad7274ccfa
tests: unify test-share
tests/test-share
tests/test-share.out
tests/test-share.t
--- a/tests/test-share	Sun Sep 26 13:44:49 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]"      >> $HGRCPATH
-echo "share = "          >> $HGRCPATH
-
-echo % prepare repo1
-hg init repo1
-cd repo1
-echo a > a
-hg commit -A -m'init'
-
-echo % share it
-cd ..
-hg share repo1 repo2
-
-echo % contents of repo2/.hg
-cd repo2
-[ -d .hg/store ] \
-  && echo "fail: .hg/store should not exist" \
-  || echo "pass: .hg/store does not exist"
-# Some sed versions appends newline, some don't, and some just fails
-(cat .hg/sharedpath; echo) | head -n1 | "$TESTDIR/filtertmp.py"
-
-echo % commit in shared clone
-echo a >> a
-hg commit -m'change in shared clone'
-
-echo % check original
-cd ../repo1
-hg log
-hg update
-cat a             # should be two lines of "a"
-
-echo % commit in original
-echo b > b
-hg commit -A -m'another file'
-
-echo % check in shared clone
-cd ../repo2
-hg log
-hg update
-cat b             # should exist with one "b"
-
-echo % hg serve shared clone
-hg serve -n test -p $HGPORT -d --pid-file=hg.pid
-cat hg.pid >> $DAEMON_PIDS
-
-"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-file/'
--- a/tests/test-share.out	Sun Sep 26 13:44:49 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-% prepare repo1
-adding a
-% share it
-updating working directory
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% contents of repo2/.hg
-pass: .hg/store does not exist
-$HGTMP/test-share/repo1/.hg
-% commit in shared clone
-% check original
-changeset:   1:8af4dc49db9e
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     change in shared clone
-
-changeset:   0:d3873e73d99e
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     init
-
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-a
-a
-% commit in original
-adding b
-% check in shared clone
-changeset:   2:c2e0ac586386
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     another file
-
-changeset:   1:8af4dc49db9e
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     change in shared clone
-
-changeset:   0:d3873e73d99e
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     init
-
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-b
-% hg serve shared clone
-200 Script output follows
-
-
--rw-r--r-- 4 a
--rw-r--r-- 2 b
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-share.t	Sun Sep 26 13:44:49 2010 -0500
@@ -0,0 +1,99 @@
+
+  $ echo "[extensions]"      >> $HGRCPATH
+  $ echo "share = "          >> $HGRCPATH
+
+prepare repo1
+
+  $ hg init repo1
+  $ cd repo1
+  $ echo a > a
+  $ hg commit -A -m'init'
+  adding a
+
+share it
+
+  $ cd ..
+  $ hg share repo1 repo2
+  updating working directory
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+share shouldn't have a store dir
+
+  $ cd repo2
+  $ test -d .hg/store
+  [1]
+
+Some sed versions appends newline, some don't, and some just fails
+
+  $ cat .hg/sharedpath; echo
+  */repo1/.hg (glob)
+
+commit in shared clone
+
+  $ echo a >> a
+  $ hg commit -m'change in shared clone'
+
+check original
+
+  $ cd ../repo1
+  $ hg log
+  changeset:   1:8af4dc49db9e
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     change in shared clone
+  
+  changeset:   0:d3873e73d99e
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     init
+  
+  $ hg update
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat a             # should be two lines of "a"
+  a
+  a
+
+commit in original
+
+  $ echo b > b
+  $ hg commit -A -m'another file'
+  adding b
+
+check in shared clone
+
+  $ cd ../repo2
+  $ hg log
+  changeset:   2:c2e0ac586386
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     another file
+  
+  changeset:   1:8af4dc49db9e
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     change in shared clone
+  
+  changeset:   0:d3873e73d99e
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     init
+  
+  $ hg update
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat b             # should exist with one "b"
+  b
+
+hg serve shared clone
+
+  $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid
+  $ cat hg.pid >> $DAEMON_PIDS
+  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-file/'
+  200 Script output follows
+  
+  
+  -rw-r--r-- 4 a
+  -rw-r--r-- 2 b
+  
+