Patchwork [4,of,4] hgweb: unify import style of error classes

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 18, 2015, 3:44 p.m.
Message ID <25fe33dc765795ada295.1447861466@mimosa>
Download mbox | patch
Permalink /patch/11484/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 18, 2015, 3:44 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1446356605 -32400
#      Sun Nov 01 14:43:25 2015 +0900
# Node ID 25fe33dc765795ada295a3f0374c67f157357c13
# Parent  638b99be51a0a36152745893eddfb9e93e70980c
hgweb: unify import style of error classes

It will be enforced by the import checker.
Pierre-Yves David - Nov. 18, 2015, 9:51 p.m.
On 11/18/2015 07:44 AM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1446356605 -32400
> #      Sun Nov 01 14:43:25 2015 +0900
> # Node ID 25fe33dc765795ada295a3f0374c67f157357c13
> # Parent  638b99be51a0a36152745893eddfb9e93e70980c
> hgweb: unify import style of error classes

I've pushed patch 2-4. Patch 4 confuses check commit but this is 
definitly not the patch fault so I decided to ignore it and move forward.

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -15,7 +15,6 @@  from common import HTTP_OK, HTTP_FORBIDD
 from mercurial import graphmod, patch
 from mercurial import scmutil
 from mercurial.i18n import _
-from mercurial.error import ParseError, RepoLookupError, Abort
 from mercurial import revset
 
 __all__ = []
@@ -225,7 +224,7 @@  def _search(web, req, tmpl):
         revdef = 'reverse(%s)' % query
         try:
             tree = revset.parse(revdef)
-        except ParseError:
+        except error.ParseError:
             # can't parse to a revset tree
             return MODE_KEYWORD, query
 
@@ -249,7 +248,8 @@  def _search(web, req, tmpl):
             # RepoLookupError: no such revision, e.g. in 'revision:'
             # Abort: bookmark/tag not exists
             # LookupError: ambiguous identifier, e.g. in '(bc)' on a large repo
-        except (ParseError, RepoLookupError, Abort, LookupError):
+        except (error.ParseError, error.RepoLookupError, error.Abort,
+                LookupError):
             return MODE_KEYWORD, query
 
     def changelist(**map):