changeset 20088:7cbb79bddee7

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.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 12 Nov 2013 16:23:52 +0900
parents cf3b8285af00
children 2d0ab571b822
files mercurial/localrepo.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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