comparison mercurial/hgweb/webcommands.py @ 27009:f5faef7e9119

hgweb: unify import style of error classes It will be enforced by the import checker.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 01 Nov 2015 14:43:25 +0900
parents 41957e50e109
children 37fcfe52c68c
comparison
equal deleted inserted replaced
27008:7f19f331ef59 27009:f5faef7e9119
13 from common import paritygen, staticfile, get_contact, ErrorResponse 13 from common import paritygen, staticfile, get_contact, ErrorResponse
14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND 14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
15 from mercurial import graphmod, patch 15 from mercurial import graphmod, patch
16 from mercurial import scmutil 16 from mercurial import scmutil
17 from mercurial.i18n import _ 17 from mercurial.i18n import _
18 from mercurial.error import ParseError, RepoLookupError, Abort
19 from mercurial import revset 18 from mercurial import revset
20 19
21 __all__ = [] 20 __all__ = []
22 commands = {} 21 commands = {}
23 22
223 return MODE_REVISION, ctx 222 return MODE_REVISION, ctx
224 223
225 revdef = 'reverse(%s)' % query 224 revdef = 'reverse(%s)' % query
226 try: 225 try:
227 tree = revset.parse(revdef) 226 tree = revset.parse(revdef)
228 except ParseError: 227 except error.ParseError:
229 # can't parse to a revset tree 228 # can't parse to a revset tree
230 return MODE_KEYWORD, query 229 return MODE_KEYWORD, query
231 230
232 if revset.depth(tree) <= 2: 231 if revset.depth(tree) <= 2:
233 # no revset syntax used 232 # no revset syntax used
247 return MODE_REVSET, revs 246 return MODE_REVSET, revs
248 # ParseError: wrongly placed tokens, wrongs arguments, etc 247 # ParseError: wrongly placed tokens, wrongs arguments, etc
249 # RepoLookupError: no such revision, e.g. in 'revision:' 248 # RepoLookupError: no such revision, e.g. in 'revision:'
250 # Abort: bookmark/tag not exists 249 # Abort: bookmark/tag not exists
251 # LookupError: ambiguous identifier, e.g. in '(bc)' on a large repo 250 # LookupError: ambiguous identifier, e.g. in '(bc)' on a large repo
252 except (ParseError, RepoLookupError, Abort, LookupError): 251 except (error.ParseError, error.RepoLookupError, error.Abort,
252 LookupError):
253 return MODE_KEYWORD, query 253 return MODE_KEYWORD, query
254 254
255 def changelist(**map): 255 def changelist(**map):
256 count = 0 256 count = 0
257 257