Mercurial - hg: wait lock error

Situation

I was committing a changed file, on a server, and got this error message, "waiting for lock on working directory of /server/directory/path held by 'XSym\n0010\na36583026646d78c7869e72b64a65eaf\npylon:3727\n'." After searching the web, someone on stackoverflow suggested to use the command, 'hg debuglocks.' It was useful but the command help did not give an example of how to unlock the repo with it.

Solution

After blindly trying different variations on the command line from reading the mercurial source code, I found the solution. This is a summary of the commands and what they did.

To view the status of locks:

  • hg debuglocks

To remove any locks:

  • hg debuglocks --force-lock

  • hg debuglocks --force-wlock

I am not sure what the difference between force-lock and force-wlock is, but in my case, they removed the three reported lock situations in combination.

Update: Mon, 2017-02-06: If the commands above fail, delete the '.hg/wlock' or '.hg/lock' file, 'Mercurial stuck “waiting for lock”,' http://stackoverflow.com/questions/12865/mercurial-stuck-waiting-for-lock.

 — Main.MarlonAGriffith - 21 Sep 2016

[.twiki-macro .REVINFO]