3273 t = get_times() |
3273 t = get_times() |
3274 u.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % |
3274 u.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % |
3275 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
3275 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
3276 atexit.register(print_time) |
3276 atexit.register(print_time) |
3277 |
3277 |
|
3278 if options['cwd']: |
|
3279 os.chdir(options['cwd']) |
|
3280 |
|
3281 u.updateopts(options["verbose"], options["debug"], options["quiet"], |
|
3282 not options["noninteractive"], options["traceback"], |
|
3283 parseconfig(options["config"])) |
|
3284 |
|
3285 path = u.expandpath(options["repository"]) or "" |
|
3286 repo = path and hg.repository(u, path=path) or None |
|
3287 if repo and not repo.local(): |
|
3288 raise util.Abort(_("repository '%s' is not local") % path) |
|
3289 |
|
3290 if options['help']: |
|
3291 return help_(u, cmd, options['version']) |
|
3292 elif options['version']: |
|
3293 return version_(u) |
|
3294 elif not cmd: |
|
3295 return help_(u, 'shortlist') |
|
3296 |
|
3297 if cmd not in norepo.split(): |
|
3298 try: |
|
3299 if not repo: |
|
3300 repo = hg.repository(u, path=path) |
|
3301 u = repo.ui |
|
3302 except hg.RepoError: |
|
3303 if cmd not in optionalrepo.split(): |
|
3304 raise |
|
3305 d = lambda: func(u, repo, *args, **cmdoptions) |
|
3306 else: |
|
3307 d = lambda: func(u, *args, **cmdoptions) |
|
3308 |
|
3309 return runcommand(u, options, d) |
|
3310 |
|
3311 def runcommand(u, options, d): |
3278 # enter the debugger before command execution |
3312 # enter the debugger before command execution |
3279 if options['debugger']: |
3313 if options['debugger']: |
3280 pdb.set_trace() |
3314 pdb.set_trace() |
3281 |
3315 |
3282 try: |
3316 try: |
3283 if options['cwd']: |
|
3284 os.chdir(options['cwd']) |
|
3285 |
|
3286 u.updateopts(options["verbose"], options["debug"], options["quiet"], |
|
3287 not options["noninteractive"], options["traceback"], |
|
3288 parseconfig(options["config"])) |
|
3289 |
|
3290 path = u.expandpath(options["repository"]) or "" |
|
3291 repo = path and hg.repository(u, path=path) or None |
|
3292 if repo and not repo.local(): |
|
3293 raise util.Abort(_("repository '%s' is not local") % path) |
|
3294 |
|
3295 if options['help']: |
|
3296 return help_(u, cmd, options['version']) |
|
3297 elif options['version']: |
|
3298 return version_(u) |
|
3299 elif not cmd: |
|
3300 return help_(u, 'shortlist') |
|
3301 |
|
3302 if cmd not in norepo.split(): |
|
3303 try: |
|
3304 if not repo: |
|
3305 repo = hg.repository(u, path=path) |
|
3306 u = repo.ui |
|
3307 except hg.RepoError: |
|
3308 if cmd not in optionalrepo.split(): |
|
3309 raise |
|
3310 d = lambda: func(u, repo, *args, **cmdoptions) |
|
3311 else: |
|
3312 d = lambda: func(u, *args, **cmdoptions) |
|
3313 |
|
3314 try: |
3317 try: |
3315 if options['profile']: |
3318 if options['profile']: |
3316 import hotshot, hotshot.stats |
3319 import hotshot, hotshot.stats |
3317 prof = hotshot.Profile("hg.prof") |
3320 prof = hotshot.Profile("hg.prof") |
3318 try: |
3321 try: |