##// END OF EJS Templates
blackbox: don't run permission tests on non-unix systems...
Durham Goode -
r19082:63dda3c3 stable
parent child Browse files
Show More
@@ -1,150 +1,154 b''
1 1 setup
2 2 $ cat > mock.py <<EOF
3 3 > from mercurial import util
4 4 >
5 5 > def makedate():
6 6 > return 0, 0
7 7 > def getuser():
8 8 > return 'bob'
9 9 > # mock the date and user apis so the output is always the same
10 10 > def uisetup(ui):
11 11 > util.makedate = makedate
12 12 > util.getuser = getuser
13 13 > EOF
14 14 $ cat >> $HGRCPATH <<EOF
15 15 > [extensions]
16 16 > blackbox=
17 17 > mock=`pwd`/mock.py
18 18 > mq=
19 19 > EOF
20 20 $ hg init blackboxtest
21 21 $ cd blackboxtest
22 22
23 23 command, exit codes, and duration
24 24
25 25 $ echo a > a
26 26 $ hg add a
27 27 $ hg blackbox
28 28 1970/01/01 00:00:00 bob> add a
29 29 1970/01/01 00:00:00 bob> add exited 0 after * seconds (glob)
30 30
31 31 incoming change tracking
32 32
33 33 create two heads to verify that we only see one change in the log later
34 34 $ hg commit -ma
35 35 $ hg up null
36 36 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
37 37 $ echo b > b
38 38 $ hg commit -Amb
39 39 adding b
40 40 created new head
41 41
42 42 clone, commit, pull
43 43 $ hg clone . ../blackboxtest2
44 44 updating to branch default
45 45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 46 $ echo c > c
47 47 $ hg commit -Amc
48 48 adding c
49 49 $ cd ../blackboxtest2
50 50 $ hg pull
51 51 pulling from $TESTTMP/blackboxtest (glob)
52 52 searching for changes
53 53 adding changesets
54 54 adding manifests
55 55 adding file changes
56 56 added 1 changesets with 1 changes to 1 files
57 57 (run 'hg update' to get a working copy)
58 58 $ hg blackbox -l 3
59 59 1970/01/01 00:00:00 bob> pull
60 60 1970/01/01 00:00:00 bob> 1 incoming changes - new heads: d02f48003e62
61 61 1970/01/01 00:00:00 bob> pull exited None after * seconds (glob)
62 62
63 63 we must not cause a failure if we cannot write to the log
64 64
65 65 $ hg rollback
66 66 repository tip rolled back to revision 1 (undo pull)
67
68 #if unix-permissions
67 69 $ chmod 000 .hg/blackbox.log
68 70 $ hg --debug incoming
69 71 warning: cannot write to blackbox.log: Permission denied
70 72 comparing with $TESTTMP/blackboxtest (glob)
71 73 query 1; heads
72 74 searching for changes
73 75 all local heads known remotely
74 76 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
75 77 tag: tip
76 78 phase: draft
77 79 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
78 80 parent: -1:0000000000000000000000000000000000000000
79 81 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
80 82 user: test
81 83 date: Thu Jan 01 00:00:00 1970 +0000
82 84 files+: c
83 85 extra: branch=default
84 86 description:
85 87 c
86 88
87 89
90 #endif
88 91 $ hg pull
89 92 pulling from $TESTTMP/blackboxtest (glob)
90 93 searching for changes
91 94 adding changesets
92 95 adding manifests
93 96 adding file changes
94 97 added 1 changesets with 1 changes to 1 files
95 98 (run 'hg update' to get a working copy)
96 99
97 100 a failure reading from the log is fine
98
101 #if unix-permissions
99 102 $ hg blackbox -l 3
100 103 abort: Permission denied: $TESTTMP/blackboxtest2/.hg/blackbox.log
101 104 [255]
102 105
103 106 $ chmod 600 .hg/blackbox.log
107 #endif
104 108
105 109 backup bundles get logged
106 110
107 111 $ touch d
108 112 $ hg commit -Amd
109 113 adding d
110 114 created new head
111 115 $ hg strip tip
112 116 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
113 117 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
114 118 $ hg blackbox -l 3
115 119 1970/01/01 00:00:00 bob> strip tip
116 120 1970/01/01 00:00:00 bob> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
117 121 1970/01/01 00:00:00 bob> strip exited 0 after * seconds (glob)
118 122
119 123 extension and python hooks - use the eol extension for a pythonhook
120 124
121 125 $ echo '[extensions]' >> .hg/hgrc
122 126 $ echo 'eol=' >> .hg/hgrc
123 127 $ echo '[hooks]' >> .hg/hgrc
124 128 $ echo 'update = echo hooked' >> .hg/hgrc
125 129 $ hg update
126 130 hooked
127 131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
128 132 $ hg blackbox -l 4
129 133 1970/01/01 00:00:00 bob> update
130 134 1970/01/01 00:00:00 bob> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
131 135 1970/01/01 00:00:00 bob> exthook-update: echo hooked finished in * seconds (glob)
132 136 1970/01/01 00:00:00 bob> update exited False after * seconds (glob)
133 137
134 138 log rotation
135 139
136 140 $ echo '[blackbox]' >> .hg/hgrc
137 141 $ echo 'maxsize = 20 b' >> .hg/hgrc
138 142 $ echo 'maxfiles = 3' >> .hg/hgrc
139 143 $ hg status
140 144 $ hg status
141 145 $ hg status
142 146 $ hg tip -q
143 147 2:d02f48003e62
144 148 $ ls .hg/blackbox.log*
145 149 .hg/blackbox.log
146 150 .hg/blackbox.log.1
147 151 .hg/blackbox.log.2
148 152
149 153 cleanup
150 154 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now