Patchwork D6026: lock: Improve the waiting for lock message which will help newcomers(issue6081)

login
register
mail settings
Submitter phabricator
Date Feb. 28, 2019, 5:09 p.m.
Message ID <787195a973bd8e9a70b62bbbfcb2219e@localhost.localdomain>
Download mbox | patch
Permalink /patch/38968/
State Not Applicable
Headers show

Comments

phabricator - Feb. 28, 2019, 5:09 p.m.
akshjain.jain74 updated this revision to Diff 14273.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6026?vs=14272&id=14273

REVISION DETAIL
  https://phab.mercurial-scm.org/D6026

AFFECTED FILES
  hgext/journal.py
  tests/test-lock-badness.t

CHANGE DETAILS




To: akshjain.jain74, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/tests/test-lock-badness.t b/tests/test-lock-badness.t
--- a/tests/test-lock-badness.t
+++ b/tests/test-lock-badness.t
@@ -15,17 +15,17 @@ 
 
   $ cat > testlock.py << EOF
   > from mercurial import error, registrar
-  > 
+  >
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > 
+  >
   > def acquiretestlock(repo, releaseexc):
   >     def unlock():
   >         if releaseexc:
   >             raise error.Abort(b'expected release exception')
   >     l = repo._lock(repo.vfs, b'testlock', False, unlock, None, b'test lock')
   >     return l
-  > 
+  >
   > @command(b'testlockexc')
   > def testlockexc(ui, repo):
   >     testlock = acquiretestlock(repo, True)
@@ -106,6 +106,12 @@ 
   calling hook pre-update: hghook_pre-update.sleephalf
   waiting for lock on working directory of b held by process '*' on host '*' (glob)
   got lock after * seconds (glob)
+
+  Another Mercurial process seems to be running in this repository, e.g.
+  an editor opened by 'hg commit'. Please make sure all processes
+  are terminated then try again. If it still fails, a Mercurial process
+  may have crashed in this repository earlier:
+  remove the file manually to continue.
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat preup-stderr
   $ cat stdout
@@ -123,6 +129,12 @@ 
   calling hook pre-update: hghook_pre-update.sleephalf
   waiting for lock on working directory of b held by process '*' on host '*' (glob)
   got lock after * seconds (glob)
+
+  Another Mercurial process seems to be running in this repository, e.g.
+  an editor opened by 'hg commit'. Please make sure all processes
+  are terminated then try again. If it still fails, a Mercurial process
+  may have crashed in this repository earlier:
+  remove the file manually to continue.
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat preup-stderr
   $ cat stdout
diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -307,7 +307,11 @@ 
             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))
+                _("waiting for lock on %s held by %r\n" "on host %r\n" """Another Mercurial process seems to be running in this repository, e.g.
+  an editor opened by 'hg commit'. Please make sure all processes
+  are terminated then try again. If it still fails, a Mercurial process
+  may have crashed in this repository earlier:
+  remove the file manually to continue.\n""") % (desc, inst.locker))
             # default to 600 seconds timeout
             l = lock.lock(
                 vfs, 'namejournal.lock',