localrepo: import "lock" module as "lockmod" for readability
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 12 Nov 2013 16:23:52 +0900
changeset 20088 7cbb79bddee7
parent 20087 cf3b8285af00
child 20089 2d0ab571b822
localrepo: import "lock" module as "lockmod" for readability Before this patch, "localrepo.py" has many methods defining local variable "lock", even though it imports "lock" module as "lock". This ambiguity decreases readability.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Tue Nov 12 16:23:52 2013 +0900
+++ b/mercurial/localrepo.py	Tue Nov 12 16:23:52 2013 +0900
@@ -8,7 +8,8 @@
 from i18n import _
 import peer, changegroup, subrepo, discovery, pushkey, obsolete, repoview
 import changelog, dirstate, filelog, manifest, context, bookmarks, phases
-import lock, transaction, store, encoding
+import lock as lockmod
+import transaction, store, encoding
 import scmutil, util, extensions, hook, error, revset
 import match as matchmod
 import merge as mergemod
@@ -1001,15 +1002,16 @@
 
     def _lock(self, lockname, wait, releasefn, acquirefn, desc):
         try:
-            l = lock.lock(lockname, 0, releasefn, desc=desc)
+            l = lockmod.lock(lockname, 0, releasefn, desc=desc)
         except error.LockHeld, inst:
             if not wait:
                 raise
             self.ui.warn(_("waiting for lock on %s held by %r\n") %
                          (desc, inst.locker))
             # default to 600 seconds timeout
-            l = lock.lock(lockname, int(self.ui.config("ui", "timeout", "600")),
-                          releasefn, desc=desc)
+            l = lockmod.lock(lockname,
+                             int(self.ui.config("ui", "timeout", "600")),
+                             releasefn, desc=desc)
         if acquirefn:
             acquirefn()
         return l