Creation of bundle from checkout fails

Bug #111666 reported by David Clymer
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Aaron Bentley

Bug Description

david@zepto:~/tmp/bzr.bugfix/bzrlib$ bzr bundle-revisions -r last:1
Plugin "Bzrtools" is not up to date with installed Bazaar version 0.16.0candidate2.
 There should be a newer version of Bzrtools available, e.g. 0.16.
Using saved location: /home/david/tmp/bzr.bugfix/
bzr: ERROR: bzrlib.errors.ReadOnlyError: A write attempt was made in a read only transaction on LockableFiles(lock, file:///home/david/tmp/bzr.bugfix/.bzr/repository/)

Traceback (most recent call last):
  File "/home/david/dev/version_control/bzr/bzrlib/commands.py", line 718, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/david/dev/version_control/bzr/bzrlib/commands.py", line 679, in run_bzr
    ret = run(*run_argv)
  File "/home/david/dev/version_control/bzr/bzrlib/commands.py", line 375, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/david/dev/version_control/bzr/bzrlib/bundle/commands.py", line 157, in run
    base_branch.last_revision())
  File "/home/david/dev/version_control/bzr/bzrlib/repository.py", line 364, in fetch
    return inter.fetch(revision_id=revision_id, pb=pb)
  File "/home/david/dev/version_control/bzr/bzrlib/decorators.py", line 163, in write_locked
    self.lock_write()
  File "/home/david/dev/version_control/bzr/bzrlib/inter.py", line 100, in lock_write
    self._double_lock(self.source.lock_read, self.target.lock_write)
  File "/home/david/dev/version_control/bzr/bzrlib/inter.py", line 63, in _double_lock
    lock_target()
  File "/home/david/dev/version_control/bzr/bzrlib/repository.py", line 252, in lock_write
    return self.control_files.lock_write(token=token)
  File "/home/david/dev/version_control/bzr/bzrlib/lockable_files.py", line 253, in lock_write
    raise errors.ReadOnlyError(self)
ReadOnlyError: A write attempt was made in a read only transaction on LockableFiles(lock, file:///home/david/tmp/bzr.bugfix/.bzr/repository/)

bzr 0.16.0candidate2 on python 2.4.4.final.0 (linux2)
arguments: ['/home/david/bin/bzr', 'bundle-revisions', '-r', 'last:1']

** please send this report to <email address hidden>

Revision history for this message
John A Meinel (jameinel) wrote :

This sounds like "bzr bundle" is trying to download the remote revisions and install them locally.

However, I also think your "-r last:1" isn't doing what you think it is.

What you want to do is:

bzr bundle -r -2..-1

Or

bzr bundle -r last:2..last:1

Doing "bzr bundle -r last:1" is the same as doing "bzr bundle -r -1" which is saying "give me the bundle from source to my last revision". When source isn't supplied it has a few possible defaults.

Changed in bzr:
importance: Undecided → Medium
status: Unconfirmed → Needs Info
Revision history for this message
David Clymer (vezult) wrote :

I'm certain that it is doing what I think it is, though it is possible that it is not what you think it should properly be doing.

This is corresponds to my intuition regarding the command, that is, making a bundle of the revision or range of revisions that I specify, assuming that when I specify a revision I am refering to the changes between that revision and the one that preceeds it. For example, doing a "bzr log -r last:1" shows me the log of the last revision, and doing "bzr bundle -r last:1" in the parent of my checkout branch (it works there), gives me a bundle containing the changes represented by the last revision. It may not be perfectly logical, but it's what I expected.

Revision history for this message
David Clymer (vezult) wrote :

cmd_bundle_revisions() calls target_branch.repository.fetch(). Looking in bzrlib/repository.py, it seems all fetch methods either raise ErrorUnimplemented, or have a write lock decorator. One of the arguments given to *.fetch() in this case is the output of a function which requires a read lock, because it retrieves revision history. Is it possible that the read lock is not being released in time for the fetch decorator to obtain its write lock?

Revision history for this message
David Clymer (vezult) wrote :

Um...oops: the error raised by non @needs_write_lock .fetch()es is NotImplementedError. Not whatever silly name I said.

Revision history for this message
David Clymer (vezult) wrote :

To repoduce the bug:

david@zepto:~/tmp$ ls
bug-48623.patch bzr.test
david@zepto:~/tmp$ mkdir test
david@zepto:~/tmp$ cd test
david@zepto:~/tmp/test$ mkdir branch
david@zepto:~/tmp/test$ cd branch
david@zepto:~/tmp/test/branch$ bzr init
david@zepto:~/tmp/test/branch$ touch foo bar baz
david@zepto:~/tmp/test/branch$ bzr add .
added bar
added baz
added foo
david@zepto:~/tmp/test/branch$ bzr commit -m 'initial commit'
added bar
added baz
added foo
Committed revision 1.
david@zepto:~/tmp/test/branch$ cd ..
david@zepto:~/tmp/test$ bzr checkout branch co
david@zepto:~/tmp/test$ cd co
david@zepto:~/tmp/test/co$ bzr bundle -r last:1
submit branch!
bzr: ERROR: No base branch known or specified.
david@zepto:~/tmp/test/co$ bzr bundle -r last:1 .
bzr: ERROR: bzrlib.errors.ReadOnlyError: A write attempt was made in a read only transaction on LockableFiles(lock, file:///home/david/tmp/test/co/.bzr/repository/)

Traceback (most recent call last):
  File "/home/david/dev/version_control/bzr/bzrlib/commands.py", line 718, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/david/dev/version_control/bzr/bzrlib/commands.py", line 679, in run_bzr
    ret = run(*run_argv)
  File "/home/david/dev/version_control/bzr/bzrlib/commands.py", line 375, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/david/dev/version_control/bzr/bzrlib/bundle/commands.py", line 159, in run
    lr)
  File "/home/david/dev/version_control/bzr/bzrlib/repository.py", line 364, in fetch
    return inter.fetch(revision_id=revision_id, pb=pb)
  File "/home/david/dev/version_control/bzr/bzrlib/decorators.py", line 163, in write_locked
    self.lock_write()
  File "/home/david/dev/version_control/bzr/bzrlib/inter.py", line 100, in lock_write
    self._double_lock(self.source.lock_read, self.target.lock_write)
  File "/home/david/dev/version_control/bzr/bzrlib/inter.py", line 63, in _double_lock
    lock_target()
  File "/home/david/dev/version_control/bzr/bzrlib/repository.py", line 252, in lock_write
    return self.control_files.lock_write(token=token)
  File "/home/david/dev/version_control/bzr/bzrlib/lockable_files.py", line 253, in lock_write
    raise errors.ReadOnlyError(self)
ReadOnlyError: A write attempt was made in a read only transaction on LockableFiles(lock, file:///home/david/tmp/test/co/.bzr/repository/)

bzr 0.16.0candidate2 on python 2.4.4.final.0 (linux2)
arguments: ['/home/david/bin/bzr', '--no-plugins', 'bundle', '-r', 'last:1', '.']

** please send this report to <email address hidden>

Revision history for this message
Aaron Bentley (abentley) wrote :

This appears to be resolved by the new bundle implementation

Changed in bzr:
assignee: nobody → aaron-bentley
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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