mercurial/commands.py
changeset 1050 9c09094de48c
parent 1049 160a68cd393f
child 1051 3c918b7ad8da
equal deleted inserted replaced
1049:160a68cd393f 1050:9c09094de48c
  1607         u = ui.ui()
  1607         u = ui.ui()
  1608         u.warn("hg: unknown command '%s'\n" % inst.args[0])
  1608         u.warn("hg: unknown command '%s'\n" % inst.args[0])
  1609         help_(u, 'shortlist')
  1609         help_(u, 'shortlist')
  1610         sys.exit(1)
  1610         sys.exit(1)
  1611 
  1611 
  1612     if options['cwd']:
       
  1613         try:
       
  1614             os.chdir(options['cwd'])
       
  1615         except OSError, inst:
       
  1616             u = ui.ui()
       
  1617             u.warn('abort: %s: %s\n' % (options['cwd'], inst.strerror))
       
  1618             sys.exit(1)
       
  1619 
       
  1620     if options["time"]:
  1612     if options["time"]:
  1621         def get_times():
  1613         def get_times():
  1622             t = os.times()
  1614             t = os.times()
  1623             if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
  1615             if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
  1624                 t = (t[0], t[1], t[2], t[3], time.clock())
  1616                 t = (t[0], t[1], t[2], t[3], time.clock())
  1643                 show_version(u)
  1635                 show_version(u)
  1644                 sys.exit(0)
  1636                 sys.exit(0)
  1645             elif not cmd:
  1637             elif not cmd:
  1646                 help_(u, 'shortlist')
  1638                 help_(u, 'shortlist')
  1647                 sys.exit(0)
  1639                 sys.exit(0)
       
  1640 
       
  1641             if options['cwd']:
       
  1642                 try:
       
  1643                     os.chdir(options['cwd'])
       
  1644                 except OSError, inst:
       
  1645                     u.warn('abort: %s: %s\n' % (options['cwd'], inst.strerror))
       
  1646                     sys.exit(1)
  1648 
  1647 
  1649             if cmd not in norepo.split():
  1648             if cmd not in norepo.split():
  1650                 path = options["repository"] or ""
  1649                 path = options["repository"] or ""
  1651                 repo = hg.repository(ui=u, path=path)
  1650                 repo = hg.repository(ui=u, path=path)
  1652                 d = lambda: func(u, repo, *args, **cmdoptions)
  1651                 d = lambda: func(u, repo, *args, **cmdoptions)