Mercurial > hg
diff hgext/chainsaw.py @ 51431:fe68a2dc0bf2
chainsaw-update: log actual locks breaking
Previously, the command would simply state that it was about
to break locks, not if there was actually some to break.
This version is race-free. It would be also possible to display
the content of the lock before hand (not race-free but informative
in almost all cases).
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Wed, 17 Jan 2024 14:39:06 +0100 |
parents | bc88aa7472de |
children | d36a81d70f25 |
line wrap: on
line diff
--- a/hgext/chainsaw.py Wed Jan 17 14:26:58 2024 +0100 +++ b/hgext/chainsaw.py Wed Jan 17 14:39:06 2024 +0100 @@ -120,9 +120,10 @@ raise error.InputError(_(b'specify a target revision with --rev')) if not source: raise error.InputError(_(b'specify a pull path with --source')) - ui.status(_(b'breaking locks, if any\n')) - repo.svfs.tryunlink(b'lock') - repo.vfs.tryunlink(b'wlock') + if repo.svfs.tryunlink(b'lock'): + ui.status(_(b'had to break store lock\n')) + if repo.vfs.tryunlink(b'wlock'): + ui.status(_(b'had to break working copy lock\n')) ui.status(_(b'recovering after interrupted transaction, if any\n')) repo.recover()