annotate tests/test-hg-branch @ 271:d32590df65ef

undo changes from ea0728d8cdc2 (GNU sed doesn't have a -E option)
author Abderrahim Kitouni <a.kitouni@gmail.com>
date Mon, 23 Nov 2009 18:58:40 +0100
parents 8b9fc1b1cc40
children e331d19fd0bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
211
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
1 #!/bin/sh
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
2
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
3 # Fails for some reason, need to investigate
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
4 # "$TESTDIR/hghave" git || exit 80
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
5
259
8b9fc1b1cc40 tests: Fix tests with new repo layout.
Augie Fackler <durin42@gmail.com>
parents: 211
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: 211
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: 211
diff changeset
8
211
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
9 # bail early if the user is already running git-daemon
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
10 echo hi | nc localhost 9418 2>/dev/null && exit 80
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
11
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
12 echo "[extensions]" >> $HGRCPATH
259
8b9fc1b1cc40 tests: Fix tests with new repo layout.
Augie Fackler <durin42@gmail.com>
parents: 211
diff changeset
13 echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
211
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
14 echo 'hgext.graphlog =' >> $HGRCPATH
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
15 echo 'hgext.bookmarks =' >> $HGRCPATH
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
16
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
17 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
18 GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
19 GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
20 GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
21 GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
22 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
23
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
24 count=10
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
25 commit()
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
26 {
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
27 GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
28 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
271
d32590df65ef undo changes from ea0728d8cdc2 (GNU sed doesn't have a -E option)
Abderrahim Kitouni <a.kitouni@gmail.com>
parents: 259
diff changeset
29 git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
211
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
30 count=`expr $count + 1`
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
31 }
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
32 hgcommit()
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
33 {
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
34 HGDATE="2007-01-01 00:00:$count +0000"
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
35 hg commit -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg commit error"
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
36 count=`expr $count + 1`
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
37 }
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
38
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
39 mkdir gitrepo
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
40 cd gitrepo
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
41 git init | python -c "import sys; print sys.stdin.read().replace('$(dirname $(pwd))/', '')"
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
42
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
43 echo alpha > alpha
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
44 git add alpha
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
45 commit -m "add alpha"
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
46
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
47 # dulwich does not presently support local git repos, workaround
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
48 cd ..
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
49 git daemon --base-path="$(pwd)"\
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
50 --listen=localhost\
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
51 --export-all\
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
52 --pid-file=gitdaemon.pid \
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
53 --detach --reuseaddr \
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
54 --enable=receive-pack
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
55
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
56 hg clone git://localhost/gitrepo hgrepo
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
57
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
58 cd hgrepo
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
59 hg mv alpha beta
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
60 hgcommit -m 'rename alpha to beta'
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
61 hg push
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
62
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
63 hg branch gamma
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
64 hgcommit -m 'started branch gamma'
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
65 hg push
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
66
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
67 hg log --graph
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
68
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
69 cd ..
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
70 hg clone git://localhost/gitrepo hgrepo2
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
71 cd hgrepo2
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
72 hg log --graph
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
73
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
74 cd ..
f40d18ff59eb add test for named branches
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
diff changeset
75 kill `cat gitdaemon.pid`