Show More
@@ -1384,6 +1384,9 b' coreconfigitem(' | |||
|
1384 | 1384 | b'ui', b'timeout.warn', default=0, |
|
1385 | 1385 | ) |
|
1386 | 1386 | coreconfigitem( |
|
1387 | b'ui', b'timestamp-output', default=False, | |
|
1388 | ) | |
|
1389 | coreconfigitem( | |
|
1387 | 1390 | b'ui', b'traceback', default=False, |
|
1388 | 1391 | ) |
|
1389 | 1392 | coreconfigitem( |
@@ -9,6 +9,7 b' from __future__ import absolute_import' | |||
|
9 | 9 | |
|
10 | 10 | import collections |
|
11 | 11 | import contextlib |
|
12 | import datetime | |
|
12 | 13 | import errno |
|
13 | 14 | import getpass |
|
14 | 15 | import inspect |
@@ -242,6 +243,7 b' class ui(object):' | |||
|
242 | 243 | self._terminfoparams = {} |
|
243 | 244 | self._styles = {} |
|
244 | 245 | self._uninterruptible = False |
|
246 | self.showtimestamp = False | |
|
245 | 247 | |
|
246 | 248 | if src: |
|
247 | 249 | self._fout = src._fout |
@@ -561,6 +563,7 b' class ui(object):' | |||
|
561 | 563 | self._reportuntrusted = self.debugflag or self.configbool( |
|
562 | 564 | b"ui", b"report_untrusted" |
|
563 | 565 | ) |
|
566 | self.showtimestamp = self.configbool(b'ui', b'timestamp-output') | |
|
564 | 567 | self.tracebackflag = self.configbool(b'ui', b'traceback') |
|
565 | 568 | self.logblockedtimes = self.configbool(b'ui', b'logblockedtimes') |
|
566 | 569 | |
@@ -1217,7 +1220,20 b' class ui(object):' | |||
|
1217 | 1220 | ) * 1000 |
|
1218 | 1221 | |
|
1219 | 1222 | def _writemsg(self, dest, *args, **opts): |
|
1223 | timestamp = self.showtimestamp and opts.get('type') in { | |
|
1224 | b'debug', | |
|
1225 | b'error', | |
|
1226 | b'note', | |
|
1227 | b'status', | |
|
1228 | b'warning', | |
|
1229 | } | |
|
1230 | if timestamp: | |
|
1231 | args = ( | |
|
1232 | b'[%s] ' % bytes(datetime.datetime.now().isoformat(), 'ASCII'), | |
|
1233 | ) + args | |
|
1220 | 1234 | _writemsgwith(self._write, dest, *args, **opts) |
|
1235 | if timestamp: | |
|
1236 | dest.flush() | |
|
1221 | 1237 | |
|
1222 | 1238 | def _writemsgnobuf(self, dest, *args, **opts): |
|
1223 | 1239 | _writemsgwith(self._writenobuf, dest, *args, **opts) |
@@ -18,7 +18,8 b'' | |||
|
18 | 18 | > @command(b'loop', |
|
19 | 19 | > [(b'', b'total', b'', b'override for total'), |
|
20 | 20 | > (b'', b'nested', False, b'show nested results'), |
|
21 |
> (b'', b'parallel', False, b'show parallel sets of results') |
|
|
21 | > (b'', b'parallel', False, b'show parallel sets of results'), | |
|
22 | > (b'', b'warn', False, b'show warning if step divisible by 3')], | |
|
22 | 23 | > b'hg loop LOOPS', |
|
23 | 24 | > norepo=True) |
|
24 | 25 | > def loop(ui, loops, **opts): |
@@ -32,6 +33,7 b'' | |||
|
32 | 33 | > if opts.get('nested', None): |
|
33 | 34 | > nested = True |
|
34 | 35 | > loops = abs(loops) |
|
36 | > showwarn = opts.get('warn', False) | |
|
35 | 37 | > |
|
36 | 38 | > progress = ui.makeprogress(topiclabel, unit=b'loopnum', total=total) |
|
37 | 39 | > other = ui.makeprogress(b'other', unit=b'othernum', total=total) |
@@ -48,6 +50,8 b'' | |||
|
48 | 50 | > for j in range(nested_steps): |
|
49 | 51 | > nested.update(j, item=b'nested.%d' % j) |
|
50 | 52 | > nested.complete() |
|
53 | > if showwarn and i % 3 == 0: | |
|
54 | > ui.warn(b'reached step %d\n' %i) | |
|
51 | 55 | > progress.complete() |
|
52 | 56 | > |
|
53 | 57 | > topiclabel = b'loop' |
@@ -179,6 +183,42 b" make sure things don't fall over if coun" | |||
|
179 | 183 | loop [ <=> ] 5/4\r (no-eol) (esc) |
|
180 | 184 | \r (no-eol) (esc) |
|
181 | 185 | |
|
186 | test interaction with ui.warn | |
|
187 | ||
|
188 | $ hg loop --warn 6 | |
|
189 | \r (no-eol) (esc) | |
|
190 | loop [ ] 0/6\r (no-eol) (esc) | |
|
191 | \r (no-eol) (esc) | |
|
192 | reached step 0 | |
|
193 | \r (no-eol) (esc) | |
|
194 | loop [=======> ] 1/6\r (no-eol) (esc) | |
|
195 | loop [===============> ] 2/6\r (no-eol) (esc) | |
|
196 | loop [=======================> ] 3/6\r (no-eol) (esc) | |
|
197 | \r (no-eol) (esc) | |
|
198 | reached step 3 | |
|
199 | \r (no-eol) (esc) | |
|
200 | loop [===============================> ] 4/6\r (no-eol) (esc) | |
|
201 | loop [=======================================> ] 5/6\r (no-eol) (esc) | |
|
202 | \r (no-eol) (esc) | |
|
203 | ||
|
204 | test interaction with ui.timestamp-output | |
|
205 | ||
|
206 | $ hg loop --warn --config ui.timestamp-output=true 6 | |
|
207 | \r (no-eol) (esc) | |
|
208 | loop [ ] 0/6\r (no-eol) (esc) | |
|
209 | \r (no-eol) (esc) | |
|
210 | \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] reached step 0 (re) | |
|
211 | \r (no-eol) (esc) | |
|
212 | loop [=======> ] 1/6\r (no-eol) (esc) | |
|
213 | loop [===============> ] 2/6\r (no-eol) (esc) | |
|
214 | loop [=======================> ] 3/6\r (no-eol) (esc) | |
|
215 | \r (no-eol) (esc) | |
|
216 | \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] reached step 3 (re) | |
|
217 | \r (no-eol) (esc) | |
|
218 | loop [===============================> ] 4/6\r (no-eol) (esc) | |
|
219 | loop [=======================================> ] 5/6\r (no-eol) (esc) | |
|
220 | \r (no-eol) (esc) | |
|
221 | ||
|
182 | 222 | test immediate progress completion |
|
183 | 223 | |
|
184 | 224 | $ hg -y loop 0 |
@@ -142,9 +142,9 b' SEC: check for unsafe ssh url' | |||
|
142 | 142 | pulling from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path |
|
143 | 143 | abort: no suitable response from remote hg! |
|
144 | 144 | [255] |
|
145 | $ hg pull 'ssh://fakehost%7Ctouch%20owned/path' | |
|
146 | pulling from ssh://fakehost%7Ctouch%20owned/path | |
|
147 | abort: no suitable response from remote hg! | |
|
145 | $ hg --config ui.timestamp-output=true pull 'ssh://fakehost%7Ctouch%20owned/path' | |
|
146 | \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] pulling from ssh://fakehost%7Ctouch%20owned/path (re) | |
|
147 | \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] abort: no suitable response from remote hg! (re) | |
|
148 | 148 | [255] |
|
149 | 149 | |
|
150 | 150 | $ [ ! -f owned ] || echo 'you got owned' |
General Comments 0
You need to be logged in to leave comments.
Login now