Patchwork [3,of,3,evolve-ext] errors: add missing imports of mercurial.error

login
register
mail settings
Submitter via Mercurial-devel
Date Oct. 29, 2016, 12:27 a.m.
Message ID <406fdf786dfa126734af.1477700838@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/17222/
State Accepted
Headers show

Comments

via Mercurial-devel - Oct. 29, 2016, 12:27 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1477700706 25200
#      Fri Oct 28 17:25:06 2016 -0700
# Branch stable
# Node ID 406fdf786dfa126734afa38bb1da8050633921b7
# Parent  961b53077cabab1d8ed5e09c3eebd07ae7083ee5
errors: add missing imports of mercurial.error
Yuya Nishihara - Oct. 29, 2016, 2:33 a.m.
On Fri, 28 Oct 2016 17:56:13 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> On Fri, Oct 28, 2016 at 5:52 PM, Pierre-Yves David
> >> diff -r 961b53077cab -r 406fdf786dfa hgext/obsolete.py
> >> --- a/hgext/obsolete.py Fri Oct 28 17:15:57 2016 -0700
> >> +++ b/hgext/obsolete.py Fri Oct 28 17:25:06 2016 -0700
> >> @@ -13,7 +13,7 @@
> >>  were such user.
> >>  """
> >>
> >> -from mercurial import util
> >> +from mercurial import error
> >>
> >>  try:
> >>      from mercurial import obsolete
> >> @@ -24,9 +24,9 @@
> >>  import json
> >>
> >>  from mercurial import cmdutil
> >> -from mercurial import error

This try-except appears to be a dead code. It would never raise ImportError
because of demandimport, and the obsolete module isn't used at all.

Patch

diff -r 961b53077cab -r 406fdf786dfa hgext/obsolete.py
--- a/hgext/obsolete.py	Fri Oct 28 17:15:57 2016 -0700
+++ b/hgext/obsolete.py	Fri Oct 28 17:25:06 2016 -0700
@@ -13,7 +13,7 @@ 
 were such user.
 """
 
-from mercurial import util
+from mercurial import error
 
 try:
     from mercurial import obsolete
@@ -24,9 +24,9 @@ 
 import json
 
 from mercurial import cmdutil
-from mercurial import error
 from mercurial.i18n import _
 from mercurial.node import bin, nullid
+from mercurial import util
 
 
 #####################################################################
diff -r 961b53077cab -r 406fdf786dfa hgext/pushexperiment.py
--- a/hgext/pushexperiment.py	Fri Oct 28 17:15:57 2016 -0700
+++ b/hgext/pushexperiment.py	Fri Oct 28 17:25:06 2016 -0700
@@ -12,6 +12,7 @@ 
 from StringIO import StringIO
 
 from mercurial.i18n import _
+from mercurial import error
 from mercurial import extensions
 from mercurial import wireproto
 from mercurial import obsolete
diff -r 961b53077cab -r 406fdf786dfa hgext/simple4server.py
--- a/hgext/simple4server.py	Fri Oct 28 17:15:57 2016 -0700
+++ b/hgext/simple4server.py	Fri Oct 28 17:25:06 2016 -0700
@@ -15,6 +15,7 @@ 
 
 import hashlib
 import struct
+from mercurial import error
 from mercurial import util
 from mercurial import wireproto
 from mercurial import extensions