Comment 0 for bug 317731

Revision history for this message
Bryce Harrington (bryce) wrote : bzr diff while in middle of a bzr commit gives an ugly error message

[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`.)