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