ugly error message when dirstate lock is already active

Bug #317731 reported by Bryce Harrington
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
High
Unassigned
Breezy
Triaged
Medium
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

Revision history for this message
Bryce Harrington (bryce) wrote :
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 317731] [NEW] bzr diff while in middle of a bzr commit gives an ugly error message

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)
description: updated
Revision history for this message
Martin Pool (mbp) wrote : Re: bzr diff while in middle of a bzr commit gives an ugly error message

This is an aspect of bug 98836

Changed in bzr:
importance: Undecided → High
status: New → Confirmed
Paul Sladen (sladen)
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
Revision history for this message
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)
tags: added: dirstate ui
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: added: confusing-ui
removed: check-for-breezy
affects: bzr → brz
affects: brz → bzr
Changed in brz:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.