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