ugly error message when dirstate lock is already active

Bug #317731 reported by Bryce Harrington on 2009-01-16
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar
High
Unassigned

Bug Description

[Problem]
bzr diff gives the following nasty looking error if done while in the middle of a bzr --commit operation:

bzr: ERROR: Could not acquire lock "[Errno 11] Resource temporarily unavailable"
/usr/lib/python2.5/site-packages/bzrlib/lock.py:79: UserWarning: lock on <open file u'/home/bryce/src/Arsenal/arsenal/.bzr/checkout/dirstate', mode 'rb' at 0x860e650> not released
  warn("lock on %r not released" % self.f)

[Discussion]
Frequently when I'm writing my commit message in emacs, I want to refer to the diff so I can remind myself of exactly what I'd done. So, I ctrl-z to background the editor and run 'bzr diff' to see.

I guess I'm used to doing this in other version control systems, but in bzr unfortunately it doesn't seem to work. This error gets printed instead:

bryce@blackwold:~/src/Arsenal/arsenal$ bzr commit
Committing to: /home/bryce/src/Arsenal/arsenal/
modified contrib/new-bugs.py

[1]+ Stopped bzr commit
bryce@blackwold:~/src/Arsenal/arsenal$ bzr diff
bzr: ERROR: Could not acquire lock "[Errno 11] Resource temporarily unavailable"
/usr/lib/python2.5/site-packages/bzrlib/lock.py:79: UserWarning: lock on <open file u'/home/bryce/src/Arsenal/arsenal/.bzr/checkout/dirstate', mode 'rb' at 0x860e650> not released
  warn("lock on %r not released" % self.f)
bryce@blackwold:~/src/Arsenal/arsenal$

Now, I know that I can do `bzr commit --show-diff`, and that's a more than adequate workaround for the problem itself, however the error message is pretty disconcerting if you're new to bzr and don't yet know about the --show-diff option.

Now, it would be ideal if one could safely use bzr diff while a bzr commit was in progress. But maybe that's not feasible for whatever reason. But at least please improve the error message! I would recommend something along the lines of:

  bzr: ERROR: Could not perform diff while repository locked.
          (Are you in the middle of a commit and need to see a diff? Try `bzr commit --show-diff`.)

[Workaround]
Add to your ~/.bazaar/bazaar.conf:

[ALIASES]
commit=commit --show-diff

Bryce Harrington (bryce) wrote :

This is a known bug - I think its a dup.

Anyhow, --show-diff on the commit line will include the diff for you.

-Rob

Bryce Harrington (bryce) on 2009-01-16
description: updated

This is an aspect of bug 98836

Changed in bzr:
importance: Undecided → High
status: New → Confirmed
Paul Sladen (sladen) on 2010-11-09
summary: - bzr diff while in middle of a bzr commit gives an ugly error message
+ bzr diff while in middle of a bzr commit complains about locking
Jelmer Vernooij (jelmer) wrote :

The fact locking happens at all is bug 98836, repurposing this bug to be about the ugly error message.

summary: - bzr diff while in middle of a bzr commit complains about locking
+ bzr diff while in middle of a bzr commit gives an ugly error message
+ about locking
summary: - bzr diff while in middle of a bzr commit gives an ugly error message
- about locking
+ ugly error message when dirstate lock is already active
Jelmer Vernooij (jelmer) on 2011-02-01
tags: added: dirstate ui
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments