[PATCH 4 of 5] localrepo: use modern import convention

Gregory Szorc gregory.szorc at gmail.com
Sun Jun 28 14:49:42 CDT 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1435520495 25200
#      Sun Jun 28 12:41:35 2015 -0700
# Node ID 305b6fcf8fe7026984db07dfce459ff4ffb432f4
# Parent  f8efa4e8b9358d8a33d1701a49b5afb5574d12a4
localrepo: use modern import convention

Now that we have established a modern and more readable import
convention using absolute import mode, switch localrepo.py to it.

Note that localrepo.py has significantly more imports than most files.
Results from this file aren't typical.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -3,23 +3,61 @@
 # Copyright 2005-2007 Matt Mackall <mpm at selenic.com>
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
-from node import hex, nullid, short
-from i18n import _
+
+from __future__ import absolute_import
+
+import errno
+import inspect
+import os
+import random
+import time
 import urllib
-import peer, changegroup, subrepo, pushkey, obsolete, repoview
-import changelog, dirstate, filelog, manifest, context, bookmarks, phases
-import lock as lockmod
-import transaction, store, encoding, exchange, bundle2
-import scmutil, util, extensions, hook, error, revset
-import match as matchmod
-import merge as mergemod
-import tags as tagsmod
-from lock import release
-import weakref, errno, os, time, inspect, random
-import branchmap, pathutil
-import namespaces
+import weakref
+
+from .node import (
+    hex,
+    nullid,
+    short,
+)
+from .i18n import _
+
+from . import (
+    bookmarks,
+    branchmap,
+    bundle2,
+    changegroup,
+    changelog,
+    context,
+    dirstate,
+    encoding,
+    error,
+    exchange,
+    extensions,
+    filelog,
+    hook,
+    lock as lockmod,
+    manifest,
+    match as matchmod,
+    merge as mergemod,
+    namespaces,
+    obsolete,
+    pathutil,
+    peer,
+    phases,
+    pushkey,
+    repoview,
+    revset,
+    scmutil,
+    store,
+    subrepo,
+    tags as tagsmod,
+    transaction,
+    util,
+)
+
+release = lockmod.release
 propertycache = util.propertycache
 filecache = scmutil.filecache
 
 class repofilecache(filecache):


More information about the Mercurial-devel mailing list