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

akshjain.jain74 (Akshit Jain) phabricator at mercurial-scm.org
Sat Mar 2 07:36:41 EST 2019


akshjain.jain74 updated this revision to Diff 14291.

REPOSITORY
  rHG Mercurial

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

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

AFFECTED FILES
  hgext/journal.py
  mercurial/lock.py
  tests/test-check-pyflakes.t
  tests/test-clone.t
  tests/test-extdiff.t
  tests/test-lock-badness.t
  tests/test-phases-exchange.t
  tests/test-remotefilelog-bgprefetch.t

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-bgprefetch.t b/tests/test-remotefilelog-bgprefetch.t
--- a/tests/test-remotefilelog-bgprefetch.t
+++ b/tests/test-remotefilelog-bgprefetch.t
@@ -282,8 +282,13 @@
   $ hg prefetch --repack
   waiting for lock on prefetching in $TESTTMP/shallow held by process * on host * (glob) (?)
   got lock after * seconds (glob) (?)
+  Another Mercurial process seems to be running in
+  * files fetched over 1 fetches - (* misses, 0.00% hit ratio) over *s (glob) (?)
+                       this repository, e.g. an editor opened by 'hg commit'.
+                       Please make sure all processes are terminated then
+                       try again.
+  got lock after 1 seconds
   (running background incremental repack)
-  * files fetched over 1 fetches - (* misses, 0.00% hit ratio) over *s (glob) (?)
 
   $ sleep 0.5
   $ hg debugwaitonrepack >/dev/null 2>%1
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t
+++ b/tests/test-phases-exchange.t
@@ -1319,6 +1319,10 @@
   $ hg push ../Phi --config ui.timeout=1
   pushing to ../Phi
   waiting for lock on repository $TESTTMP/Upsilon held by ''
+  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.
   abort: repository $TESTTMP/Upsilon: timed out waiting for lock held by ''
   (lock might be very busy)
   [255]
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,14 @@
 
   $ 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)
@@ -62,6 +59,10 @@
   $ cat preup-stdout
   $ cat preup-stderr
   waiting for lock on working directory of b held by process '*' on host '*' (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.
   got lock after * seconds (glob)
   $ cat stdout
   adding b
@@ -105,6 +106,10 @@
   $ cat preup-stdout
   calling hook pre-update: hghook_pre-update.sleephalf
   waiting for lock on working directory of b held by process '*' on host '*' (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.
   got lock after * seconds (glob)
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat preup-stderr
@@ -122,6 +127,10 @@
   $ cat preup-stdout
   calling hook pre-update: hghook_pre-update.sleephalf
   waiting for lock on working directory of b held by process '*' on host '*' (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.
   got lock after * seconds (glob)
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat preup-stderr
diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -151,8 +151,8 @@
 Test --per-file option for gui tool:
 
   $ hg --config extdiff.gui.alabalaf=True alabalaf -c 6 --per-file --debug
+  diffing */extdiff.*/a.46c0e4daeb72/b a.81906f2b98ac/b (glob)
   diffing */extdiff.*/a.46c0e4daeb72/a a.81906f2b98ac/a (glob)
-  diffing */extdiff.*/a.46c0e4daeb72/b a.81906f2b98ac/b (glob)
   making snapshot of 2 files from rev 46c0e4daeb72
     a
     b
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -1141,6 +1141,10 @@
 
   $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
   (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
+  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.
   searching for changes
   no changes found
   adding remote bookmark bookA
diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t
--- a/tests/test-check-pyflakes.t
+++ b/tests/test-check-pyflakes.t
@@ -21,4 +21,25 @@
   > -X mercurial/thirdparty/zope \
   > 2>/dev/null \
   > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
+  contrib/bdiff-torture.py:55: local variable 'inst' is assigned to but never used
+  contrib/bdiff-torture.py:57: undefined name 'inst'
+  contrib/bdiff-torture.py:67: undefined name 'xrange'
+  contrib/perf.py:98: undefined name 'xrange'
+  contrib/synthrepo.py:368: undefined name 'xrange'
+  contrib/synthrepo.py:401: undefined name 'xrange'
+  contrib/synthrepo.py:435: undefined name 'xrange'
+  contrib/synthrepo.py:436: undefined name 'xrange'
+  contrib/synthrepo.py:444: undefined name 'xrange'
+  contrib/synthrepo.py:448: undefined name 'xrange'
+  contrib/synthrepo.py:452: undefined name 'xrange'
+  contrib/synthrepo.py:453: undefined name 'xrange'
+  contrib/synthrepo.py:460: undefined name 'xrange'
+  contrib/synthrepo.py:469: undefined name 'xrange'
+  doc/hgmanpage.py:266: undefined name 'xrange'
+  mercurial/hgweb/server.py:373: undefined name 'reload'
+  mercurial/lsprof.py:125: undefined name 'execfile'
+  mercurial/templatefilters.py:319: undefined name 'unicode'
+  mercurial/util.py:2607: undefined name 'file'
+  tests/artifacts/scripts/generate-churning-bundle.py:63: undefined name 'xrange'
+  tests/artifacts/scripts/generate-churning-bundle.py:111: undefined name 'xrange'
   
diff --git a/mercurial/lock.py b/mercurial/lock.py
--- a/mercurial/lock.py
+++ b/mercurial/lock.py
@@ -113,11 +113,19 @@
         # show more details for new-style locks
         if ':' in locker:
             host, pid = locker.split(":", 1)
-            msg = (_("waiting for lock on %s held by process %r on host %r\n")
+            msg = (_("waiting for lock on %s held by process %r 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.\n""")
                    % (pycompat.bytestr(l.desc), pycompat.bytestr(pid),
                       pycompat.bytestr(host)))
         else:
-            msg = (_("waiting for lock on %s held by %r\n")
+            msg = (_("waiting for lock on %s held by %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.\n""")
                    % (l.desc, pycompat.bytestr(locker)))
         printer(msg)
 
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"
+                    """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.\n""") % (desc, inst.locker))
             # default to 600 seconds timeout
             l = lock.lock(
                 vfs, 'namejournal.lock',



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


More information about the Mercurial-devel mailing list