Show More
@@ -9,7 +9,7 b' from demandload import demandload' | |||
|
9 | 9 | demandload(globals(), "os re sys signal shutil") |
|
10 | 10 | demandload(globals(), "fancyopts ui hg util") |
|
11 | 11 | demandload(globals(), "fnmatch hgweb mdiff random signal time traceback") |
|
12 | demandload(globals(), "errno socket version struct") | |
|
12 | demandload(globals(), "errno socket version struct atexit") | |
|
13 | 13 | |
|
14 | 14 | class UnknownCommand(Exception): |
|
15 | 15 | """Exception raised if command is not in the command table.""" |
@@ -1244,6 +1244,7 b" globalopts = [('v', 'verbose', None, 've" | |||
|
1244 | 1244 | ('', 'traceback', None, 'print traceback on exception'), |
|
1245 | 1245 | ('y', 'noninteractive', None, 'run non-interactively'), |
|
1246 | 1246 | ('', 'version', None, 'output version information and exit'), |
|
1247 | ('', 'time', None, 'time how long the command takes'), | |
|
1247 | 1248 | ] |
|
1248 | 1249 | |
|
1249 | 1250 | norepo = "clone init version help debugindex debugindexdot" |
@@ -1327,6 +1328,20 b' def dispatch(args):' | |||
|
1327 | 1328 | help_(u) |
|
1328 | 1329 | sys.exit(1) |
|
1329 | 1330 | |
|
1331 | if options["time"]: | |
|
1332 | def get_times(): | |
|
1333 | t = os.times() | |
|
1334 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() | |
|
1335 | t = (t[0], t[1], t[2], t[3], time.clock()) | |
|
1336 | return t | |
|
1337 | s = get_times() | |
|
1338 | def print_time(): | |
|
1339 | t = get_times() | |
|
1340 | u = ui.ui() | |
|
1341 | u.warn("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n" % | |
|
1342 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) | |
|
1343 | atexit.register(print_time) | |
|
1344 | ||
|
1330 | 1345 | u = ui.ui(options["verbose"], options["debug"], options["quiet"], |
|
1331 | 1346 | not options["noninteractive"]) |
|
1332 | 1347 |
General Comments 0
You need to be logged in to leave comments.
Login now