lock: rename remaining e.locker to e.lockinfo

Summary: There are some leftovers uncaught by tests.

Reviewed By: singhsrb

Differential Revision: D9301679

fbshipit-source-id: 0178266a8f442a3d38288a21219af498ab9e3faa
This commit is contained in:
Jun Wu 2018-08-13 14:55:47 -07:00 committed by Facebook Github Bot
parent 2682422a3e
commit bfdb697078
4 changed files with 18 additions and 16 deletions

View File

@ -378,15 +378,15 @@ def cloudsync(ui, repo, checkbackedup=None, cloudrefs=None, **opts):
srcrepo = shareutil.getsrcrepo(repo)
lock = lockmod.lock(srcrepo.vfs, _backuplockname, 0)
except error.LockHeld as e:
if e.errno == errno.ETIMEDOUT and e.locker.isrunning():
if e.errno == errno.ETIMEDOUT and e.lockinfo.isrunning():
etimemsg = ""
etime = commitcloudutil.getprocessetime(e.locker)
etime = commitcloudutil.getprocessetime(e.lockinfo)
if etime:
etimemsg = _(", running for %d min %d sec") % divmod(etime, 60)
highlightstatus(
ui,
_("background cloud sync is already in progress (pid %s on %s%s)\n")
% (e.locker.uniqueid, e.locker.namespace, etimemsg),
% (e.lockinfo.uniqueid, e.lockinfo.namespace, etimemsg),
)
ui.flush()
@ -817,14 +817,14 @@ def backuplockcheck(ui, repo):
try:
lockmod.trylock(ui, repo.vfs, _backuplockname, 0, 0)
except error.LockHeld as e:
if e.locker.isrunning():
locker = e.locker
etime = commitcloudutil.getprocessetime(locker)
if e.lockinfo.isrunning():
lockinfo = e.lockinfo
etime = commitcloudutil.getprocessetime(lockinfo)
if etime:
minutes, seconds = divmod(etime, 60)
etimemsg = _(" (pid %s on %s, running for %d min %d sec)") % (
locker.uniqueid,
locker.namespace,
lockinfo.uniqueid,
lockinfo.namespace,
minutes,
seconds,
)

View File

@ -261,13 +261,13 @@ def backupdisable(ui, repo, **opts):
with lockmod.trylock(ui, repo.vfs, _backuplockname, 0, 0):
pass
except error.LockHeld as e:
if e.locker.isrunning():
if e.lockinfo.isrunning():
ui.warn(
_(
"warning: disable does not affect the running backup process\n"
"kill the process (pid %s on %s) gracefully if needed\n"
)
% (e.locker.uniqueid, e.locker.namespace)
% (e.lockinfo.uniqueid, e.lockinfo.namespace)
)
return 0

View File

@ -319,7 +319,9 @@ class journalstorage(object):
try:
l = lock.lock(vfs, "namejournal.lock", 0, desc=desc)
except error.LockHeld as inst:
self.ui.warn(_("waiting for lock on %s held by %r\n") % (desc, inst.locker))
self.ui.warn(
_("waiting for lock on %s held by %r\n") % (desc, inst.lockinfo)
)
# default to 600 seconds timeout
l = lock.lock(
vfs, "namejournal.lock", self.ui.configint("ui", "timeout"), desc=desc

View File

@ -165,11 +165,11 @@ def callcatch(ui, func):
# Mercurial-specific first, followed by built-in and library exceptions
except error.LockHeld as inst:
if inst.errno == errno.ETIMEDOUT:
reason = _("timed out waiting for lock held by %r") % inst.locker
reason = _("timed out waiting for lock held by %r") % inst.lockinfo
else:
reason = _("lock held by %r") % inst.locker
reason = _("lock held by %r") % inst.lockinfo
ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason))
if not inst.locker:
if not inst.lockinfo:
ui.warn(_("(lock might be very busy)\n"))
except error.LockUnavailable as inst:
ui.warn(
@ -1213,8 +1213,8 @@ def _locksub(repo, lock, envvar, cmd, environ=None, *args, **kwargs):
)
if environ is None:
environ = {}
with lock.inherit() as locker:
environ[envvar] = locker
with lock.inherit() as lockname:
environ[envvar] = lockname
return repo.ui.system(cmd, environ=environ, *args, **kwargs)