convert: remove old ElementTree import cruft from darcs
All the `import elementtree` attempts seem to pre-date py2.5, when it was
brought into the standard library, and the manual `cElementTree` fast
implementation import has been unnecessary and deprecated since py3.3.
--- a/contrib/import-checker.py Thu Jun 16 20:44:52 2022 +0200
+++ b/contrib/import-checker.py Wed Jun 15 01:01:02 2022 +0100
@@ -47,6 +47,7 @@
'mercurial.thirdparty.zope',
'mercurial.thirdparty.zope.interface',
'typing',
+ 'xml.etree.ElementTree',
)
# Allow list of symbols that can be directly imported.
--- a/hgext/convert/darcs.py Thu Jun 16 20:44:52 2022 +0200
+++ b/hgext/convert/darcs.py Wed Jun 15 01:01:02 2022 +0100
@@ -8,6 +8,10 @@
import os
import re
import shutil
+from xml.etree.ElementTree import (
+ ElementTree,
+ XMLParser,
+)
from mercurial.i18n import _
from mercurial import (
@@ -20,26 +24,6 @@
NoRepo = common.NoRepo
-# The naming drift of ElementTree is fun!
-
-try:
- import xml.etree.cElementTree.ElementTree as ElementTree
- import xml.etree.cElementTree.XMLParser as XMLParser
-except ImportError:
- try:
- import xml.etree.ElementTree.ElementTree as ElementTree
- import xml.etree.ElementTree.XMLParser as XMLParser
- except ImportError:
- try:
- import elementtree.cElementTree.ElementTree as ElementTree
- import elementtree.cElementTree.XMLParser as XMLParser
- except ImportError:
- try:
- import elementtree.ElementTree.ElementTree as ElementTree
- import elementtree.ElementTree.XMLParser as XMLParser
- except ImportError:
- pass
-
class darcs_source(common.converter_source, common.commandline):
def __init__(self, ui, repotype, path, revs=None):