annotate tests/test-file-removal @ 259:8b9fc1b1cc40

tests: Fix tests with new repo layout. Also make all tests bail early if dulwich is not available.
author Augie Fackler <durin42@gmail.com>
date Sun, 25 Oct 2009 10:52:50 -0500
parents 1593538448b1
children e331d19fd0bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 #!/bin/sh
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 # Fails for some reason, need to investigate
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 # "$TESTDIR/hghave" git || exit 80
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5
259
8b9fc1b1cc40 tests: Fix tests with new repo layout.
Augie Fackler <durin42@gmail.com>
parents: 202
diff changeset
6 # bail if the user does not have dulwich
8b9fc1b1cc40 tests: Fix tests with new repo layout.
Augie Fackler <durin42@gmail.com>
parents: 202
diff changeset
7 python -c 'import dulwich, dulwich.repo' || exit 80
8b9fc1b1cc40 tests: Fix tests with new repo layout.
Augie Fackler <durin42@gmail.com>
parents: 202
diff changeset
8
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9 # bail early if the user is already running git-daemon
130
8241f16a114e tests: suppress netcat's error messages.
Dmitriy Taychenachev <dimichxp@gmail.com>
parents: 117
diff changeset
10 echo hi | nc localhost 9418 2>/dev/null && exit 80
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 echo "[extensions]" >> $HGRCPATH
259
8b9fc1b1cc40 tests: Fix tests with new repo layout.
Augie Fackler <durin42@gmail.com>
parents: 202
diff changeset
13 echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 echo 'hgext.graphlog =' >> $HGRCPATH
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15 echo 'hgext.bookmarks =' >> $HGRCPATH
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18 GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 count=10
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 commit()
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 {
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30 count=`expr $count + 1`
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 }
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 mkdir gitrepo
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34 cd gitrepo
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35 git init | python -c "import sys; print sys.stdin.read().replace('$(dirname $(pwd))/', '')"
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36 echo alpha > alpha
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37 git add alpha
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38 commit -m 'add alpha'
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 echo beta > beta
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40 git add beta
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
41 commit -m 'add beta'
50
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
42 mkdir foo
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
43 echo blah > foo/bar
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
44 git add foo
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
45 commit -m 'add foo'
20
9a93e8b0ec64 Add failing test for file removals.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
46 git rm alpha
9a93e8b0ec64 Add failing test for file removals.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
47 commit -m 'remove alpha'
50
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
48 git rm foo/bar
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
49 commit -m 'remove foo/bar'
27
dc12a36a8d2b Updated test expectations.
Augie Fackler <durin42@gmail.com>
parents: 20
diff changeset
50 echo % final manifest in git is just beta
dc12a36a8d2b Updated test expectations.
Augie Fackler <durin42@gmail.com>
parents: 20
diff changeset
51 git ls-files
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
52
202
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
53 cd ..
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
54 mkdir gitrepo2
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
55 cd gitrepo2
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
56 git init | python -c "import sys; print sys.stdin.read().replace('$(dirname $(pwd))/', '')"
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
57
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
58 # dulwich does not presently support local git repos, workaround
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
59 cd ..
31
48a639cceea6 git-daemon is really git daemon now.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
60 git daemon --base-path="$(pwd)"\
117
93980820bba1 tests: Work around a bug in certain git versions on OS X.
Augie Fackler <durin42@gmail.com>
parents: 50
diff changeset
61 --listen=localhost\
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62 --export-all\
202
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
63 --pid-file=gitdaemon.pid \
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
64 --detach --reuseaddr \
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
65 --enable=receive-pack
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
66
185
1224d118ac92 Update tests
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 130
diff changeset
67 hg clone git://localhost/gitrepo hgrepo
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
68 cd hgrepo
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69 hg log --graph
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70
50
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
71 echo
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
72 echo % make sure alpha is not in this manifest
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
73 hg manifest -r 3
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
74
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
75 echo
d274092e3b24 Hacky implementation of file removals.
Augie Fackler <durin42@gmail.com>
parents: 31
diff changeset
76 echo % make sure that only beta is in the manifest
20
9a93e8b0ec64 Add failing test for file removals.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
77 hg manifest
9a93e8b0ec64 Add failing test for file removals.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
78
202
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
79 hg gclear
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
80 hg push git://localhost/gitrepo2
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
81
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
82 cd ../gitrepo2
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
83 git log
1593538448b1 update tests to also push to git (not only clone)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 185
diff changeset
84
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
85 cd ..
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
86 kill `cat gitdaemon.pid`