diff --git a/hgext/chainsaw.py b/hgext/chainsaw.py --- a/hgext/chainsaw.py +++ b/hgext/chainsaw.py @@ -120,9 +120,10 @@ def update(ui, repo, **opts): 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() diff --git a/tests/test-chainsaw-update.t b/tests/test-chainsaw-update.t --- a/tests/test-chainsaw-update.t +++ b/tests/test-chainsaw-update.t @@ -26,7 +26,6 @@ Simple invocation $ hg init repo $ cd repo $ hg admin::chainsaw-update --rev default --source ../src - breaking locks, if any recovering after interrupted transaction, if any no interrupted transaction available pulling from ../src @@ -51,8 +50,15 @@ from the current hostname (happens a lot wlock: (.*?), process 171814, host invalid.host.test/effffffc \((\d+)s\) (re) [2] - $ hg admin::chainsaw-update --no-purge-ignored --rev default --source ../src -q + $ hg admin::chainsaw-update --no-purge-ignored --rev default --source ../src + had to break store lock + had to break working copy lock + recovering after interrupted transaction, if any no interrupted transaction available + pulling from ../src + updating to revision 'default' + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + chainsaw-update to revision 'default' for repository at '$TESTTMP/repo' done Test file purging capabilities ------------------------------