##// END OF EJS Templates
tests: Adapt test-basic.t expected output for rhg...
Simon Sapin -
r49164:51f26c80 default
parent child Browse files
Show More
@@ -1,262 +1,258 b''
1 TODO: fix rhg bugs that make this test fail when status is enabled
2 $ unset RHG_STATUS
3
4
5 Create a repository:
1 Create a repository:
6
2
7 #if no-extraextensions
3 #if no-extraextensions
8 $ hg config
4 $ hg config
9 chgserver.idletimeout=60
5 chgserver.idletimeout=60
10 devel.all-warnings=true
6 devel.all-warnings=true
11 devel.default-date=0 0
7 devel.default-date=0 0
12 extensions.fsmonitor= (fsmonitor !)
8 extensions.fsmonitor= (fsmonitor !)
13 format.exp-rc-dirstate-v2=1 (dirstate-v2 !)
9 format.exp-rc-dirstate-v2=1 (dirstate-v2 !)
14 largefiles.usercache=$TESTTMP/.cache/largefiles
10 largefiles.usercache=$TESTTMP/.cache/largefiles
15 lfs.usercache=$TESTTMP/.cache/lfs
11 lfs.usercache=$TESTTMP/.cache/lfs
16 ui.slash=True
12 ui.slash=True
17 ui.interactive=False
13 ui.interactive=False
18 ui.detailed-exit-code=True
14 ui.detailed-exit-code=True
19 ui.merge=internal:merge
15 ui.merge=internal:merge
20 ui.mergemarkers=detailed
16 ui.mergemarkers=detailed
21 ui.promptecho=True
17 ui.promptecho=True
22 ui.ssh=* (glob)
18 ui.ssh=* (glob)
23 ui.timeout.warn=15
19 ui.timeout.warn=15
24 web.address=localhost
20 web.address=localhost
25 web\.ipv6=(?:True|False) (re)
21 web\.ipv6=(?:True|False) (re)
26 web.server-header=testing stub value
22 web.server-header=testing stub value
27 #endif
23 #endif
28
24
29 $ hg init t
25 $ hg init t
30 $ cd t
26 $ cd t
31
27
32 Prepare a changeset:
28 Prepare a changeset:
33
29
34 $ echo a > a
30 $ echo a > a
35 $ hg add a
31 $ hg add a
36
32
37 $ hg status
33 $ hg status
38 A a
34 A a
39
35
40 Writes to stdio succeed and fail appropriately
36 Writes to stdio succeed and fail appropriately
41
37
42 #if devfull
38 #if devfull
43 $ hg status 2>/dev/full
39 $ hg status 2>/dev/full
44 A a
40 A a
45
41
46 $ hg status >/dev/full
42 $ hg status >/dev/full
47 abort: No space left on device
43 abort: No space left on device* (glob)
48 [255]
44 [255]
49 #endif
45 #endif
50
46
51 #if devfull
47 #if devfull
52 $ hg status >/dev/full 2>&1
48 $ hg status >/dev/full 2>&1
53 [255]
49 [255]
54
50
55 $ hg status ENOENT 2>/dev/full
51 $ hg status ENOENT 2>/dev/full
56 [255]
52 [255]
57 #endif
53 #endif
58
54
59 On Python 3, stdio may be None:
55 On Python 3, stdio may be None:
60
56
61 $ hg debuguiprompt --config ui.interactive=true 0<&-
57 $ hg debuguiprompt --config ui.interactive=true 0<&-
62 abort: Bad file descriptor (no-rhg !)
58 abort: Bad file descriptor (no-rhg !)
63 abort: response expected (rhg !)
59 abort: response expected (rhg !)
64 [255]
60 [255]
65 $ hg version -q 0<&-
61 $ hg version -q 0<&-
66 Mercurial Distributed SCM * (glob)
62 Mercurial Distributed SCM * (glob)
67
63
68 #if py3 no-rhg
64 #if py3 no-rhg
69 $ hg version -q 1>&-
65 $ hg version -q 1>&-
70 abort: Bad file descriptor
66 abort: Bad file descriptor
71 [255]
67 [255]
72 #else
68 #else
73 $ hg version -q 1>&-
69 $ hg version -q 1>&-
74 #endif
70 #endif
75 $ hg unknown -q 1>&-
71 $ hg unknown -q 1>&-
76 hg: unknown command 'unknown'
72 hg: unknown command 'unknown'
77 (did you mean debugknown?)
73 (did you mean debugknown?)
78 [10]
74 [10]
79
75
80 $ hg version -q 2>&-
76 $ hg version -q 2>&-
81 Mercurial Distributed SCM * (glob)
77 Mercurial Distributed SCM * (glob)
82 $ hg unknown -q 2>&-
78 $ hg unknown -q 2>&-
83 [10]
79 [10]
84
80
85 $ hg commit -m test
81 $ hg commit -m test
86
82
87 This command is ancient:
83 This command is ancient:
88
84
89 $ hg history
85 $ hg history
90 changeset: 0:acb14030fe0a
86 changeset: 0:acb14030fe0a
91 tag: tip
87 tag: tip
92 user: test
88 user: test
93 date: Thu Jan 01 00:00:00 1970 +0000
89 date: Thu Jan 01 00:00:00 1970 +0000
94 summary: test
90 summary: test
95
91
96
92
97 Verify that updating to revision 0 via commands.update() works properly
93 Verify that updating to revision 0 via commands.update() works properly
98
94
99 $ cat <<EOF > update_to_rev0.py
95 $ cat <<EOF > update_to_rev0.py
100 > from mercurial import commands, hg, ui as uimod
96 > from mercurial import commands, hg, ui as uimod
101 > myui = uimod.ui.load()
97 > myui = uimod.ui.load()
102 > repo = hg.repository(myui, path=b'.')
98 > repo = hg.repository(myui, path=b'.')
103 > commands.update(myui, repo, rev=b"0")
99 > commands.update(myui, repo, rev=b"0")
104 > EOF
100 > EOF
105 $ hg up null
101 $ hg up null
106 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
102 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
107 $ "$PYTHON" ./update_to_rev0.py
103 $ "$PYTHON" ./update_to_rev0.py
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
104 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 $ hg identify -n
105 $ hg identify -n
110 0
106 0
111
107
112
108
113 Poke around at hashes:
109 Poke around at hashes:
114
110
115 $ hg manifest --debug
111 $ hg manifest --debug
116 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a
112 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a
117
113
118 $ hg cat a
114 $ hg cat a
119 a
115 a
120
116
121 Verify should succeed:
117 Verify should succeed:
122
118
123 $ hg verify
119 $ hg verify
124 checking changesets
120 checking changesets
125 checking manifests
121 checking manifests
126 crosschecking files in changesets and manifests
122 crosschecking files in changesets and manifests
127 checking files
123 checking files
128 checked 1 changesets with 1 changes to 1 files
124 checked 1 changesets with 1 changes to 1 files
129
125
130 Repository root:
126 Repository root:
131
127
132 $ hg root
128 $ hg root
133 $TESTTMP/t
129 $TESTTMP/t
134 $ hg log -l1 -T '{reporoot}\n'
130 $ hg log -l1 -T '{reporoot}\n'
135 $TESTTMP/t
131 $TESTTMP/t
136 $ hg root -Tjson | sed 's|\\\\|\\|g'
132 $ hg root -Tjson | sed 's|\\\\|\\|g'
137 [
133 [
138 {
134 {
139 "hgpath": "$TESTTMP/t/.hg",
135 "hgpath": "$TESTTMP/t/.hg",
140 "reporoot": "$TESTTMP/t",
136 "reporoot": "$TESTTMP/t",
141 "storepath": "$TESTTMP/t/.hg/store"
137 "storepath": "$TESTTMP/t/.hg/store"
142 }
138 }
143 ]
139 ]
144
140
145 At the end...
141 At the end...
146
142
147 $ cd ..
143 $ cd ..
148
144
149 Status message redirection:
145 Status message redirection:
150
146
151 $ hg init empty
147 $ hg init empty
152
148
153 status messages are sent to stdout by default:
149 status messages are sent to stdout by default:
154
150
155 $ hg outgoing -R t empty -Tjson 2>/dev/null
151 $ hg outgoing -R t empty -Tjson 2>/dev/null
156 comparing with empty
152 comparing with empty
157 searching for changes
153 searching for changes
158 [
154 [
159 {
155 {
160 "bookmarks": [],
156 "bookmarks": [],
161 "branch": "default",
157 "branch": "default",
162 "date": [0, 0],
158 "date": [0, 0],
163 "desc": "test",
159 "desc": "test",
164 "node": "acb14030fe0a21b60322c440ad2d20cf7685a376",
160 "node": "acb14030fe0a21b60322c440ad2d20cf7685a376",
165 "parents": ["0000000000000000000000000000000000000000"],
161 "parents": ["0000000000000000000000000000000000000000"],
166 "phase": "draft",
162 "phase": "draft",
167 "rev": 0,
163 "rev": 0,
168 "tags": ["tip"],
164 "tags": ["tip"],
169 "user": "test"
165 "user": "test"
170 }
166 }
171 ]
167 ]
172
168
173 which can be configured to send to stderr, so the output wouldn't be
169 which can be configured to send to stderr, so the output wouldn't be
174 interleaved:
170 interleaved:
175
171
176 $ cat <<'EOF' >> "$HGRCPATH"
172 $ cat <<'EOF' >> "$HGRCPATH"
177 > [ui]
173 > [ui]
178 > message-output = stderr
174 > message-output = stderr
179 > EOF
175 > EOF
180 $ hg outgoing -R t empty -Tjson 2>/dev/null
176 $ hg outgoing -R t empty -Tjson 2>/dev/null
181 [
177 [
182 {
178 {
183 "bookmarks": [],
179 "bookmarks": [],
184 "branch": "default",
180 "branch": "default",
185 "date": [0, 0],
181 "date": [0, 0],
186 "desc": "test",
182 "desc": "test",
187 "node": "acb14030fe0a21b60322c440ad2d20cf7685a376",
183 "node": "acb14030fe0a21b60322c440ad2d20cf7685a376",
188 "parents": ["0000000000000000000000000000000000000000"],
184 "parents": ["0000000000000000000000000000000000000000"],
189 "phase": "draft",
185 "phase": "draft",
190 "rev": 0,
186 "rev": 0,
191 "tags": ["tip"],
187 "tags": ["tip"],
192 "user": "test"
188 "user": "test"
193 }
189 }
194 ]
190 ]
195 $ hg outgoing -R t empty -Tjson >/dev/null
191 $ hg outgoing -R t empty -Tjson >/dev/null
196 comparing with empty
192 comparing with empty
197 searching for changes
193 searching for changes
198
194
199 this option should be turned off by HGPLAIN= since it may break scripting use:
195 this option should be turned off by HGPLAIN= since it may break scripting use:
200
196
201 $ HGPLAIN= hg outgoing -R t empty -Tjson 2>/dev/null
197 $ HGPLAIN= hg outgoing -R t empty -Tjson 2>/dev/null
202 comparing with empty
198 comparing with empty
203 searching for changes
199 searching for changes
204 [
200 [
205 {
201 {
206 "bookmarks": [],
202 "bookmarks": [],
207 "branch": "default",
203 "branch": "default",
208 "date": [0, 0],
204 "date": [0, 0],
209 "desc": "test",
205 "desc": "test",
210 "node": "acb14030fe0a21b60322c440ad2d20cf7685a376",
206 "node": "acb14030fe0a21b60322c440ad2d20cf7685a376",
211 "parents": ["0000000000000000000000000000000000000000"],
207 "parents": ["0000000000000000000000000000000000000000"],
212 "phase": "draft",
208 "phase": "draft",
213 "rev": 0,
209 "rev": 0,
214 "tags": ["tip"],
210 "tags": ["tip"],
215 "user": "test"
211 "user": "test"
216 }
212 }
217 ]
213 ]
218
214
219 but still overridden by --config:
215 but still overridden by --config:
220
216
221 $ HGPLAIN= hg outgoing -R t empty -Tjson --config ui.message-output=stderr \
217 $ HGPLAIN= hg outgoing -R t empty -Tjson --config ui.message-output=stderr \
222 > 2>/dev/null
218 > 2>/dev/null
223 [
219 [
224 {
220 {
225 "bookmarks": [],
221 "bookmarks": [],
226 "branch": "default",
222 "branch": "default",
227 "date": [0, 0],
223 "date": [0, 0],
228 "desc": "test",
224 "desc": "test",
229 "node": "acb14030fe0a21b60322c440ad2d20cf7685a376",
225 "node": "acb14030fe0a21b60322c440ad2d20cf7685a376",
230 "parents": ["0000000000000000000000000000000000000000"],
226 "parents": ["0000000000000000000000000000000000000000"],
231 "phase": "draft",
227 "phase": "draft",
232 "rev": 0,
228 "rev": 0,
233 "tags": ["tip"],
229 "tags": ["tip"],
234 "user": "test"
230 "user": "test"
235 }
231 }
236 ]
232 ]
237
233
238 Invalid ui.message-output option:
234 Invalid ui.message-output option:
239
235
240 $ hg log -R t --config ui.message-output=bad
236 $ hg log -R t --config ui.message-output=bad
241 abort: invalid ui.message-output destination: bad
237 abort: invalid ui.message-output destination: bad
242 [255]
238 [255]
243
239
244 Underlying message streams should be updated when ui.fout/ferr are set:
240 Underlying message streams should be updated when ui.fout/ferr are set:
245
241
246 $ cat <<'EOF' > capui.py
242 $ cat <<'EOF' > capui.py
247 > from mercurial import pycompat, registrar
243 > from mercurial import pycompat, registrar
248 > cmdtable = {}
244 > cmdtable = {}
249 > command = registrar.command(cmdtable)
245 > command = registrar.command(cmdtable)
250 > @command(b'capui', norepo=True)
246 > @command(b'capui', norepo=True)
251 > def capui(ui):
247 > def capui(ui):
252 > out = ui.fout
248 > out = ui.fout
253 > ui.fout = pycompat.bytesio()
249 > ui.fout = pycompat.bytesio()
254 > ui.status(b'status\n')
250 > ui.status(b'status\n')
255 > ui.ferr = pycompat.bytesio()
251 > ui.ferr = pycompat.bytesio()
256 > ui.warn(b'warn\n')
252 > ui.warn(b'warn\n')
257 > out.write(b'stdout: %s' % ui.fout.getvalue())
253 > out.write(b'stdout: %s' % ui.fout.getvalue())
258 > out.write(b'stderr: %s' % ui.ferr.getvalue())
254 > out.write(b'stderr: %s' % ui.ferr.getvalue())
259 > EOF
255 > EOF
260 $ hg --config extensions.capui=capui.py --config ui.message-output=stdio capui
256 $ hg --config extensions.capui=capui.py --config ui.message-output=stdio capui
261 stdout: status
257 stdout: status
262 stderr: warn
258 stderr: warn
General Comments 0
You need to be logged in to leave comments. Login now