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