comparison mercurial/dispatch.py @ 11675:f92f8921a5cc stable

dispatch: give better error message when cwd doesn't exist (issue2293) Previous behavior wasn't very helpful: $ hg st foo abort: No such file or directory Now we tell more about what failed: abort: error getting current working directory: No such file or directory
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 24 Jul 2010 00:38:08 +0200
parents 76454cbc11e4
children e4357c214bf1
comparison
equal deleted inserted replaced
11674:c29012a73518 11675:f92f8921a5cc
364 cwd = _earlygetopt(['--cwd'], args) 364 cwd = _earlygetopt(['--cwd'], args)
365 if cwd: 365 if cwd:
366 os.chdir(cwd[-1]) 366 os.chdir(cwd[-1])
367 367
368 # read the local repository .hgrc into a local ui object 368 # read the local repository .hgrc into a local ui object
369 path = cmdutil.findrepo(os.getcwd()) or "" 369 try:
370 wd = os.getcwd()
371 except OSError, e:
372 raise util.Abort(_("error getting current working directory: %s") %
373 e.strerror)
374 path = cmdutil.findrepo(wd) or ""
370 if not path: 375 if not path:
371 lui = ui 376 lui = ui
372 else: 377 else:
373 try: 378 try:
374 lui = ui.copy() 379 lui = ui.copy()