##// END OF EJS Templates
tests: hide the name of the branch cache file
Alexis S. L. Carvalho -
r6160:3ee3bc5d default
parent child Browse files
Show More
@@ -1,90 +1,90 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # test that new files created in .hg inherit the permissions from .hg/store
3 # test that new files created in .hg inherit the permissions from .hg/store
4
4
5 "$TESTDIR/hghave" unix-permissions || exit 80
5 "$TESTDIR/hghave" unix-permissions || exit 80
6
6
7 mkdir dir
7 mkdir dir
8 # just in case somebody has a strange $TMPDIR
8 # just in case somebody has a strange $TMPDIR
9 chmod g-s dir
9 chmod g-s dir
10 cd dir
10 cd dir
11
11
12 cat >printmodes.py <<EOF
12 cat >printmodes.py <<EOF
13 import os, sys
13 import os, sys
14
14
15 allnames = []
15 allnames = []
16 isdir = {}
16 isdir = {}
17 for root, dirs, files in os.walk(sys.argv[1]):
17 for root, dirs, files in os.walk(sys.argv[1]):
18 for d in dirs:
18 for d in dirs:
19 name = os.path.join(root, d)
19 name = os.path.join(root, d)
20 isdir[name] = 1
20 isdir[name] = 1
21 allnames.append(name)
21 allnames.append(name)
22 for f in files:
22 for f in files:
23 name = os.path.join(root, f)
23 name = os.path.join(root, f)
24 allnames.append(name)
24 allnames.append(name)
25 allnames.sort()
25 allnames.sort()
26 for name in allnames:
26 for name in allnames:
27 suffix = name in isdir and '/' or ''
27 suffix = name in isdir and '/' or ''
28 print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
28 print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
29 EOF
29 EOF
30
30
31 cat >mode.py <<EOF
31 cat >mode.py <<EOF
32 import sys
32 import sys
33 import os
33 import os
34 print '%05o' % os.lstat(sys.argv[1]).st_mode
34 print '%05o' % os.lstat(sys.argv[1]).st_mode
35 EOF
35 EOF
36
36
37 umask 077
37 umask 077
38
38
39 hg init repo
39 hg init repo
40 cd repo
40 cd repo
41
41
42 chmod 0770 .hg/store
42 chmod 0770 .hg/store
43
43
44 echo '% before commit'
44 echo '% before commit'
45 echo '% store can be written by the group, other files cannot'
45 echo '% store can be written by the group, other files cannot'
46 echo '% store is setgid'
46 echo '% store is setgid'
47 python ../printmodes.py .
47 python ../printmodes.py .
48
48
49 mkdir dir
49 mkdir dir
50 touch foo dir/bar
50 touch foo dir/bar
51 hg ci -qAm 'add files'
51 hg ci -qAm 'add files'
52
52
53 echo
53 echo
54 echo '% after commit'
54 echo '% after commit'
55 echo '% working dir files can only be written by the owner'
55 echo '% working dir files can only be written by the owner'
56 echo '% files created in .hg can be written by the group'
56 echo '% files created in .hg can be written by the group'
57 echo '% (in particular, store/**, dirstate, branch.cache, undo files)'
57 echo '% (in particular, store/**, dirstate, branch cache file, undo files)'
58 echo '% new directories are setgid'
58 echo '% new directories are setgid'
59 python ../printmodes.py .
59 python ../printmodes.py .
60
60
61 umask 007
61 umask 007
62 hg init ../push
62 hg init ../push
63 echo
63 echo
64 echo '% before push'
64 echo '% before push'
65 echo '% group can write everything'
65 echo '% group can write everything'
66 python ../printmodes.py ../push
66 python ../printmodes.py ../push
67
67
68 umask 077
68 umask 077
69 hg -q push ../push
69 hg -q push ../push
70 echo
70 echo
71 echo '% after push'
71 echo '% after push'
72 echo '% group can still write everything'
72 echo '% group can still write everything'
73 python ../printmodes.py ../push
73 python ../printmodes.py ../push
74
74
75 # Test that we don't lose the setgid bit when we call chmod.
75 # Test that we don't lose the setgid bit when we call chmod.
76 # Not all systems support setgid directories (e.g. HFS+), so
76 # Not all systems support setgid directories (e.g. HFS+), so
77 # just check that directories have the same mode.
77 # just check that directories have the same mode.
78 cd ..
78 cd ..
79 hg init setgid
79 hg init setgid
80 cd setgid
80 cd setgid
81 chmod g+s .hg/store 2> /dev/null
81 chmod g+s .hg/store 2> /dev/null
82 mkdir dir
82 mkdir dir
83 touch dir/file
83 touch dir/file
84 hg ci -qAm 'add dir/file'
84 hg ci -qAm 'add dir/file'
85 storemode=`python ../mode.py .hg/store`
85 storemode=`python ../mode.py .hg/store`
86 dirmode=`python ../mode.py .hg/store/data/dir`
86 dirmode=`python ../mode.py .hg/store/data/dir`
87 if [ "$storemode" != "$dirmode" ]; then
87 if [ "$storemode" != "$dirmode" ]; then
88 echo "$storemode != $dirmode"
88 echo "$storemode != $dirmode"
89 fi
89 fi
90
90
@@ -1,54 +1,54 b''
1 % before commit
1 % before commit
2 % store can be written by the group, other files cannot
2 % store can be written by the group, other files cannot
3 % store is setgid
3 % store is setgid
4 00700 ./.hg/
4 00700 ./.hg/
5 00600 ./.hg/00changelog.i
5 00600 ./.hg/00changelog.i
6 00600 ./.hg/requires
6 00600 ./.hg/requires
7 00770 ./.hg/store/
7 00770 ./.hg/store/
8
8
9 % after commit
9 % after commit
10 % working dir files can only be written by the owner
10 % working dir files can only be written by the owner
11 % files created in .hg can be written by the group
11 % files created in .hg can be written by the group
12 % (in particular, store/**, dirstate, branch.cache, undo files)
12 % (in particular, store/**, dirstate, branch cache file, undo files)
13 % new directories are setgid
13 % new directories are setgid
14 00700 ./.hg/
14 00700 ./.hg/
15 00600 ./.hg/00changelog.i
15 00600 ./.hg/00changelog.i
16 00660 ./.hg/dirstate
16 00660 ./.hg/dirstate
17 00600 ./.hg/requires
17 00600 ./.hg/requires
18 00770 ./.hg/store/
18 00770 ./.hg/store/
19 00660 ./.hg/store/00changelog.i
19 00660 ./.hg/store/00changelog.i
20 00660 ./.hg/store/00manifest.i
20 00660 ./.hg/store/00manifest.i
21 00770 ./.hg/store/data/
21 00770 ./.hg/store/data/
22 00770 ./.hg/store/data/dir/
22 00770 ./.hg/store/data/dir/
23 00660 ./.hg/store/data/dir/bar.i
23 00660 ./.hg/store/data/dir/bar.i
24 00660 ./.hg/store/data/foo.i
24 00660 ./.hg/store/data/foo.i
25 00660 ./.hg/store/undo
25 00660 ./.hg/store/undo
26 00660 ./.hg/undo.branch
26 00660 ./.hg/undo.branch
27 00660 ./.hg/undo.dirstate
27 00660 ./.hg/undo.dirstate
28 00700 ./dir/
28 00700 ./dir/
29 00600 ./dir/bar
29 00600 ./dir/bar
30 00600 ./foo
30 00600 ./foo
31
31
32 % before push
32 % before push
33 % group can write everything
33 % group can write everything
34 00770 ../push/.hg/
34 00770 ../push/.hg/
35 00660 ../push/.hg/00changelog.i
35 00660 ../push/.hg/00changelog.i
36 00660 ../push/.hg/requires
36 00660 ../push/.hg/requires
37 00770 ../push/.hg/store/
37 00770 ../push/.hg/store/
38
38
39 % after push
39 % after push
40 % group can still write everything
40 % group can still write everything
41 00770 ../push/.hg/
41 00770 ../push/.hg/
42 00660 ../push/.hg/00changelog.i
42 00660 ../push/.hg/00changelog.i
43 00660 ../push/.hg/branch.cache
43 00660 ../push/.hg/branch.cache
44 00660 ../push/.hg/requires
44 00660 ../push/.hg/requires
45 00770 ../push/.hg/store/
45 00770 ../push/.hg/store/
46 00660 ../push/.hg/store/00changelog.i
46 00660 ../push/.hg/store/00changelog.i
47 00660 ../push/.hg/store/00manifest.i
47 00660 ../push/.hg/store/00manifest.i
48 00770 ../push/.hg/store/data/
48 00770 ../push/.hg/store/data/
49 00770 ../push/.hg/store/data/dir/
49 00770 ../push/.hg/store/data/dir/
50 00660 ../push/.hg/store/data/dir/bar.i
50 00660 ../push/.hg/store/data/dir/bar.i
51 00660 ../push/.hg/store/data/foo.i
51 00660 ../push/.hg/store/data/foo.i
52 00660 ../push/.hg/store/undo
52 00660 ../push/.hg/store/undo
53 00660 ../push/.hg/undo.branch
53 00660 ../push/.hg/undo.branch
54 00660 ../push/.hg/undo.dirstate
54 00660 ../push/.hg/undo.dirstate
@@ -1,78 +1,78 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 branches=.hg/branch.cache
3 echo '[extensions]' >> $HGRCPATH
4 echo '[extensions]' >> $HGRCPATH
4 echo 'hgext.mq=' >> $HGRCPATH
5 echo 'hgext.mq=' >> $HGRCPATH
5
6
6 show_branch_cache()
7 show_branch_cache()
7 {
8 {
8 branches=.hg/branch.cache
9 # force cache (re)generation
9 # force cache (re)generation
10 hg log -r does-not-exist 2> /dev/null
10 hg log -r does-not-exist 2> /dev/null
11 hg log -r tip --template 'tip: #rev#\n'
11 hg log -r tip --template 'tip: #rev#\n'
12 if [ -f $branches ]; then
12 if [ -f $branches ]; then
13 sort $branches
13 sort $branches
14 else
14 else
15 echo No $branches
15 echo No branch cache
16 fi
16 fi
17 if [ "$1" = 1 ]; then
17 if [ "$1" = 1 ]; then
18 for b in foo bar; do
18 for b in foo bar; do
19 hg log -r $b --template "branch $b: "'#rev#\n'
19 hg log -r $b --template "branch $b: "'#rev#\n'
20 done
20 done
21 fi
21 fi
22 }
22 }
23
23
24 hg init a
24 hg init a
25 cd a
25 cd a
26 hg qinit -c
26 hg qinit -c
27
27
28 echo '# mq patch on an empty repo'
28 echo '# mq patch on an empty repo'
29 hg qnew p1
29 hg qnew p1
30 show_branch_cache
30 show_branch_cache
31
31
32 echo > pfile
32 echo > pfile
33 hg add pfile
33 hg add pfile
34 hg qrefresh -m 'patch 1'
34 hg qrefresh -m 'patch 1'
35 show_branch_cache
35 show_branch_cache
36
36
37 echo
37 echo
38 echo '# some regular revisions'
38 echo '# some regular revisions'
39 hg qpop
39 hg qpop
40 echo foo > foo
40 echo foo > foo
41 hg add foo
41 hg add foo
42 echo foo > .hg/branch
42 echo foo > .hg/branch
43 hg ci -m 'branch foo' -d '1000000 0'
43 hg ci -m 'branch foo' -d '1000000 0'
44
44
45 echo bar > bar
45 echo bar > bar
46 hg add bar
46 hg add bar
47 echo bar > .hg/branch
47 echo bar > .hg/branch
48 hg ci -m 'branch bar' -d '1000000 0'
48 hg ci -m 'branch bar' -d '1000000 0'
49 show_branch_cache
49 show_branch_cache
50
50
51 echo
51 echo
52 echo '# add some mq patches'
52 echo '# add some mq patches'
53 hg qpush
53 hg qpush
54 show_branch_cache
54 show_branch_cache
55
55
56 hg qnew p2
56 hg qnew p2
57 echo foo > .hg/branch
57 echo foo > .hg/branch
58 echo foo2 >> foo
58 echo foo2 >> foo
59 hg qrefresh -m 'patch 2'
59 hg qrefresh -m 'patch 2'
60 show_branch_cache 1
60 show_branch_cache 1
61
61
62 echo
62 echo
63 echo '# removing the cache'
63 echo '# removing the cache'
64 rm .hg/branch.cache
64 rm $branches
65 show_branch_cache 1
65 show_branch_cache 1
66
66
67 echo
67 echo
68 echo '# importing rev 1 (the cache now ends in one of the patches)'
68 echo '# importing rev 1 (the cache now ends in one of the patches)'
69 hg qimport -r 1 -n p0
69 hg qimport -r 1 -n p0
70 show_branch_cache 1
70 show_branch_cache 1
71 hg log -r qbase --template 'qbase: #rev#\n'
71 hg log -r qbase --template 'qbase: #rev#\n'
72
72
73 echo
73 echo
74 echo '# detect an invalid cache'
74 echo '# detect an invalid cache'
75 hg qpop -a
75 hg qpop -a
76 hg qpush -a
76 hg qpush -a
77 show_branch_cache
77 show_branch_cache
78
78
@@ -1,53 +1,53 b''
1 # mq patch on an empty repo
1 # mq patch on an empty repo
2 tip: 0
2 tip: 0
3 No .hg/branch.cache
3 No branch cache
4 tip: 0
4 tip: 0
5 No .hg/branch.cache
5 No branch cache
6
6
7 # some regular revisions
7 # some regular revisions
8 Patch queue now empty
8 Patch queue now empty
9 tip: 1
9 tip: 1
10 3f910abad313ff802d3a23a7529433872df9b3ae 1
10 3f910abad313ff802d3a23a7529433872df9b3ae 1
11 3f910abad313ff802d3a23a7529433872df9b3ae bar
11 3f910abad313ff802d3a23a7529433872df9b3ae bar
12 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
12 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
13
13
14 # add some mq patches
14 # add some mq patches
15 applying p1
15 applying p1
16 Now at: p1
16 Now at: p1
17 tip: 2
17 tip: 2
18 3f910abad313ff802d3a23a7529433872df9b3ae 1
18 3f910abad313ff802d3a23a7529433872df9b3ae 1
19 3f910abad313ff802d3a23a7529433872df9b3ae bar
19 3f910abad313ff802d3a23a7529433872df9b3ae bar
20 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
20 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
21 tip: 3
21 tip: 3
22 3f910abad313ff802d3a23a7529433872df9b3ae 1
22 3f910abad313ff802d3a23a7529433872df9b3ae 1
23 3f910abad313ff802d3a23a7529433872df9b3ae bar
23 3f910abad313ff802d3a23a7529433872df9b3ae bar
24 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
24 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
25 branch foo: 3
25 branch foo: 3
26 branch bar: 2
26 branch bar: 2
27
27
28 # removing the cache
28 # removing the cache
29 tip: 3
29 tip: 3
30 3f910abad313ff802d3a23a7529433872df9b3ae 1
30 3f910abad313ff802d3a23a7529433872df9b3ae 1
31 3f910abad313ff802d3a23a7529433872df9b3ae bar
31 3f910abad313ff802d3a23a7529433872df9b3ae bar
32 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
32 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
33 branch foo: 3
33 branch foo: 3
34 branch bar: 2
34 branch bar: 2
35
35
36 # importing rev 1 (the cache now ends in one of the patches)
36 # importing rev 1 (the cache now ends in one of the patches)
37 tip: 3
37 tip: 3
38 3f910abad313ff802d3a23a7529433872df9b3ae 1
38 3f910abad313ff802d3a23a7529433872df9b3ae 1
39 3f910abad313ff802d3a23a7529433872df9b3ae bar
39 3f910abad313ff802d3a23a7529433872df9b3ae bar
40 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
40 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
41 branch foo: 3
41 branch foo: 3
42 branch bar: 2
42 branch bar: 2
43 qbase: 1
43 qbase: 1
44
44
45 # detect an invalid cache
45 # detect an invalid cache
46 Patch queue now empty
46 Patch queue now empty
47 applying p0
47 applying p0
48 applying p1
48 applying p1
49 applying p2
49 applying p2
50 Now at: p2
50 Now at: p2
51 tip: 3
51 tip: 3
52 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff 0
52 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff 0
53 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
53 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -1,74 +1,76 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 branchcache=.hg/branch.cache
4
3 hg init t
5 hg init t
4 cd t
6 cd t
5 hg branches
7 hg branches
6
8
7 echo foo > a
9 echo foo > a
8 hg add a
10 hg add a
9 hg ci -m "initial" -d "1000000 0"
11 hg ci -m "initial" -d "1000000 0"
10 hg branch foo
12 hg branch foo
11 hg branch
13 hg branch
12 hg ci -m "add branch name" -d "1000000 0"
14 hg ci -m "add branch name" -d "1000000 0"
13 hg branch bar
15 hg branch bar
14 hg ci -m "change branch name" -d "1000000 0"
16 hg ci -m "change branch name" -d "1000000 0"
15 echo % branch shadowing
17 echo % branch shadowing
16 hg branch default
18 hg branch default
17 hg branch -f default
19 hg branch -f default
18 hg ci -m "clear branch name" -d "1000000 0"
20 hg ci -m "clear branch name" -d "1000000 0"
19
21
20 hg co foo
22 hg co foo
21 hg branch
23 hg branch
22 echo bleah > a
24 echo bleah > a
23 hg ci -m "modify a branch" -d "1000000 0"
25 hg ci -m "modify a branch" -d "1000000 0"
24
26
25 hg merge
27 hg merge
26 hg branch
28 hg branch
27 hg ci -m "merge" -d "1000000 0"
29 hg ci -m "merge" -d "1000000 0"
28 hg log
30 hg log
29
31
30 hg branches
32 hg branches
31 hg branches -q
33 hg branches -q
32
34
33 echo % test for invalid branch cache
35 echo % test for invalid branch cache
34 hg rollback
36 hg rollback
35 cp .hg/branch.cache .hg/bc-invalid
37 cp $branchcache .hg/bc-invalid
36 hg log -r foo
38 hg log -r foo
37 cp .hg/bc-invalid .hg/branch.cache
39 cp .hg/bc-invalid $branchcache
38 hg --debug log -r foo
40 hg --debug log -r foo
39 rm .hg/branch.cache
41 rm $branchcache
40 echo corrupted > .hg/branch.cache
42 echo corrupted > $branchcache
41 hg log -qr foo
43 hg log -qr foo
42 cat .hg/branch.cache
44 cat $branchcache
43
45
44 echo % push should update the branch cache
46 echo % push should update the branch cache
45 hg init ../target
47 hg init ../target
46 echo % pushing just rev 0
48 echo % pushing just rev 0
47 hg push -qr 0 ../target
49 hg push -qr 0 ../target
48 cat ../target/.hg/branch.cache
50 cat ../target/$branchcache
49 echo % pushing everything
51 echo % pushing everything
50 hg push -qf ../target
52 hg push -qf ../target
51 cat ../target/.hg/branch.cache
53 cat ../target/$branchcache
52
54
53 echo % update with no arguments: tipmost revision of the current branch
55 echo % update with no arguments: tipmost revision of the current branch
54 hg up -q -C 0
56 hg up -q -C 0
55 hg up -q
57 hg up -q
56 hg id
58 hg id
57 hg up -q 1
59 hg up -q 1
58 hg up -q
60 hg up -q
59 hg id
61 hg id
60 hg branch foobar
62 hg branch foobar
61 hg up
63 hg up
62
64
63 echo % fastforward merge
65 echo % fastforward merge
64 hg branch ff
66 hg branch ff
65 echo ff > ff
67 echo ff > ff
66 hg ci -Am'fast forward' -d '1000000 0'
68 hg ci -Am'fast forward' -d '1000000 0'
67 hg up foo
69 hg up foo
68 hg merge ff
70 hg merge ff
69 hg branch
71 hg branch
70 hg commit -m'Merge ff into foo' -d '1000000 0'
72 hg commit -m'Merge ff into foo' -d '1000000 0'
71 hg parents
73 hg parents
72 hg manifest
74 hg manifest
73
75
74 exit 0
76 exit 0
General Comments 0
You need to be logged in to leave comments. Login now