<p>Got a bluescreen in windows while cloning a mercurial repository.</p>

<p>After reboot, I now get this message for almost all hg commands:</p>

<pre>
c:\src\>hg commit
waiting for lock on repository c:\src\McVrsServer held by '\x00\x00\x00\x00\x00\
x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
interrupted!
</pre>

<p>Google is no help.</p>

<p>Any tips?</p>

[{'answer_id': 12879, 'author': 'jm.', 'author_id': 814, 'author_profile': 'https://Stackoverflow.com/users/814', 'pm_score': 10, 'selected': True, 'text': '<p>When "waiting for lock on repository", delete the repository file: <code>.hg/wlock</code> (or it may be in <code><code>.hg/store/lock</code></code>)</p>\n\n<p>When  deleting the lock file, you must make sure nothing else is accessing the repository. (If the lock is a string of zeros or blank, this is almost certainly true).</p>\n'}, {'answer_id': 13357, 'author': 'markpasc', 'author_id': 1472, 'author_profile': 'https://Stackoverflow.com/users/1472', 'pm_score': 2, 'selected': False, 'text': "<p>If the locked repo was the original, I can't imagine it was <em>modifying</em> it to clone it, so it was only preventing you from changing it in the middle and messing up the clone. It should be fine after removing the lock.</p>\n\n<p>The new cloned copy (if it was a local clone) could be in any sort of malformed state, though, so you should throw it out and start it over. (If it was a remote clone, I would hope it failed and already threw out the incomplete copy.)</p>\n"}, {'answer_id': 2960524, 'author': 'Tiago Matos', 'author_id': 356772, 'author_profile': 'https://Stackoverflow.com/users/356772', 'pm_score': 8, 'selected': False, 'text': '<p>When <code>waiting for lock on working directory</code>, delete <code>.hg/wlock</code>.</p>\n'}, {'answer_id': 7981259, 'author': 'Brad O', 'author_id': 1025721, 'author_profile': 'https://Stackoverflow.com/users/1025721', 'pm_score': 4, 'selected': False, 'text': "<p>I am very familiar with Mercurial's locking code (as of 1.9.1). The above advice is good, but I'd add that:</p>\n\n<ol>\n<li>I've seen this in the wild, but rarely, and only on Windows machines.</li>\n<li>Deleting lock files is the easiest fix, BUT you have to make sure nothing else is accessing the repository. (If the lock is a string of zeros, this is almost certainly true).</li>\n</ol>\n\n<p>(For the curious: I haven't yet been able to catch the cause of this problem, but suspect it's either an older version of Mercurial accessing the repository or a problem in Python's socket.gethostname() call on certain versions of Windows.)</p>\n"}, {'answer_id': 11445420, 'author': 'matt wilkie', 'author_id': 14420, 'author_profile': 'https://Stackoverflow.com/users/14420', 'pm_score': 1, 'selected': False, 'text': '<p>If it only happens on mapped drives it might be bug <a href="https://bitbucket.org/tortoisehg/thg/issue/889/cant-commit-file-over-network-share" rel="nofollow">https://bitbucket.org/tortoisehg/thg/issue/889/cant-commit-file-over-network-share</a>. Using UNC path instead of drive letter seems to sidestep the issue.</p>\n'}, {'answer_id': 16423091, 'author': 'Ian Kemp', 'author_id': 70345, 'author_profile': 'https://Stackoverflow.com/users/70345', 'pm_score': 4, 'selected': False, 'text': '<p>Coworker had this exact problem today, after a BSoD while trying to push. He had to:</p>\n\n<ul>\n<li>delete the file <code>.hg/store/lock</code> (as per <a href="https://stackoverflow.com/a/12879/70345">the accepted answer</a>)</li>\n<li>delete the file <code>.hg/store/phaseroots</code> (as per <a href="https://bitbucket.org/tortoisehg/thg/issue/2366/valueerror-need-more-than-1-value-to#comment-2867642" rel="noreferrer">this TortoiseHG bug report</a>)</li>\n</ul>\n\n<p>Then his repo worked again.</p>\n\n<p><strong>EDIT:</strong> As per @Marmoute\'s comment - when dealing with lock-related issues, using <code>hg debuglock</code> is a safer alternative to blindly deleting the <code>.hg/store/lock</code> file.</p>\n'}, {'answer_id': 25089553, 'author': 'Krazy Glew', 'author_id': 1051115, 'author_profile': 'https://Stackoverflow.com/users/1051115', 'pm_score': 3, 'selected': False, 'text': '<p>I do not expect this to be a winning answer, but it is a fairly unusual situation.\nMentioning in case someone other than me runs into it.</p>\n\n<p>Today I got the "waiting for lock on repository" on an hg push command.</p>\n\n<p>When I killed the hung hg command I could see no .hg/store/lock</p>\n\n<p>When I looked for .hg/store/lock while the command was hung, it existed. But the lockfile was deleted when the hg command was killed.</p>\n\n<p>When I went to the target of the push, and executed hg pull, no problem.</p>\n\n<p>Eventually I realized that the process ID on the hg push was lock waiting message was changing each time. It turns out that the "hg push" was hanging waiting for a lock held by itself (or possibly a subprocess, I did not investigate further).</p>\n\n<p>It turns out that the two workspaces, let\'s call them A and B, had .hg trees shared by symlink:</p>\n\n<pre><code>A/.hg --symlinked-to--&gt; B/.hg\n</code></pre>\n\n<p>This is NOT a good thing to do with Mercurial.  Mercurial does not understand the concept of two workspaces sharing the same repository. I do understand, however, how somebody coming to Mercurial from another VCS might want this  (Perforce does, although not a DVCS; the Bazaar DVCS reportedly can do so). I am surprised that a symlinked REP-ROOT/.hg works at all, although it seems to except for this push.</p>\n'}, {'answer_id': 27111373, 'author': 'JWWalker', 'author_id': 309425, 'author_profile': 'https://Stackoverflow.com/users/309425', 'pm_score': 2, 'selected': False, 'text': '<p>I encountered this problem on Mac OS X 10.7.5 and Mercurial 2.6.2 when trying to push.  After upgrading to Mercurial 3.2.1, I got "no changes found" instead of "waiting for lock on repository".  I found out that somehow the default path had gotten set to point to the same repository, so it\'s not too surprising that Mercurial would get confused.</p>\n'}, {'answer_id': 29005897, 'author': 'Ivan Dulov', 'author_id': 3543982, 'author_profile': 'https://Stackoverflow.com/users/3543982', 'pm_score': 3, 'selected': False, 'text': '<p>I had the same problem on Win 7. \nThe solution was to remove following files: </p>\n\n<ol>\n<li>.hg/store/phaseroots</li>\n<li>.hg/wlock</li>\n</ol>\n\n<p>As for .hg/store/lock  - there was no such file.</p>\n'}, {'answer_id': 41527661, 'author': 'Thomas Sharpless', 'author_id': 1789624, 'author_profile': 'https://Stackoverflow.com/users/1789624', 'pm_score': 6, 'selected': False, 'text': '<p>I had this problem with no detectable lock files.  I found the solution here: <a href="http://schooner.uwaterloo.ca/twiki/bin/view/MAG/HgLockError" rel="noreferrer">http://schooner.uwaterloo.ca/twiki/bin/view/MAG/HgLockError</a></p>\n\n<p>Here is a transcript from Tortoise Hg Workbench console</p>\n\n<pre><code>% hg debuglocks\nlock:  user None, process 7168, host HPv32 (114213199s)\nwlock: free\n[command returned code 1 Sat Jan 07 18:00:18 2017]\n% hg debuglocks --force-lock\n[command completed successfully Sat Jan 07 18:03:15 2017]\ncmdserver: Process crashed\nPaniniDev% hg debuglocks\n% hg debuglocks\nlock:  free\nwlock: free\n[command completed successfully Sat Jan 07 18:03:30 2017]\n</code></pre>\n\n<p>After this the aborted pull ran sucessfully.</p>\n\n<p>The lock had been set more than 2 years ago, by a process on a machine that is no longer on the LAN.  Shame on the hg developers for a) not documenting locks adequately; b) not timestamping them for automatic removal when they get stale.</p>\n'}, {'answer_id': 51491278, 'author': 'user10125940', 'author_id': 10125940, 'author_profile': 'https://Stackoverflow.com/users/10125940', 'pm_score': 3, 'selected': False, 'text': "<p>I had the same problem. Got the following message when I tried to commit:</p>\n\n<pre><code>waiting for lock on working directory of &lt;MyProject&gt; held by '...'\n</code></pre>\n\n<p><code>hg debuglock</code> showed this:</p>\n\n<pre><code>lock:  free\nwlock:  (66722s)\n</code></pre>\n\n<p>So I did the following command, and that fixed the problem for me:</p>\n\n<pre><code>hg debuglocks -W\n</code></pre>\n\n<p>Using Win7 and TortoiseHg 4.8.7.</p>\n"}]
['https://Stackoverflow.com/questions/12865', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/814/']