checkout over http error

Bug #39542 reported by wouter bolsterlee
10
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Critical
Robert Collins

Bug Description

I was trying to create a checkout, but bzr wouldn't let me do so:

$ bzr checkout http://anewt.uwstopia.nl/bzr/anewt.uws/
Backup Inventory created.
Inventory regenerated.
bzr: ERROR: http does not support lock_write()

Revision history for this message
Martin Pool (mbp) wrote :

I'm trying to reproduce that now.

Changed in bzr:
assignee: nobody → mbp
Revision history for this message
Martin Pool (mbp) wrote :

Can be reproduced in current bzr.dev

Changed in bzr:
status: Unconfirmed → Confirmed
Revision history for this message
Martin Pool (mbp) wrote :

Backtrace

[28568] Mon 18:21:08.696 ERROR: Cannot lock: transport is read only: <bzrlib.transport.http._pycurl.PyCurlTransport url=http://an
ewt.uwstopia.nl/bzr/anewt.uws/.bzr/branch/>
Traceback (most recent call last):
  File "/home/mbp/lib/python/bzrlib/commands.py", line 650, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/mbp/lib/python/bzrlib/commands.py", line 612, in run_bzr
    ret = run(*run_argv)
  File "/home/mbp/lib/python/bzrlib/commands.py", line 246, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/mbp/lib/python/bzrlib/builtins.py", line 706, in run
    checkout_branch.bind(source)
  File "/home/mbp/lib/python/bzrlib/decorators.py", line 51, in write_locked
    return unbound(self, *args, **kwargs)
  File "/home/mbp/lib/python/bzrlib/branch.py", line 1260, in bind
    other.lock_write()
  File "/home/mbp/lib/python/bzrlib/branch.py", line 944, in lock_write
    self.control_files.lock_write()
  File "/home/mbp/lib/python/bzrlib/lockable_files.py", line 214, in lock_write
    self._lock.lock_write()
  File "/home/mbp/lib/python/bzrlib/lockdir.py", line 349, in lock_write
    self.attempt_lock()
  File "/home/mbp/lib/python/bzrlib/lockdir.py", line 195, in attempt_lock
    raise UnlockableTransport(self.transport)
UnlockableTransport: Cannot lock: transport is read only: <bzrlib.transport.http._pycurl.PyCurlTransport url=http://anewt.uwstopi
a.nl/bzr/anewt.uws/.bzr/branch/>

Revision history for this message
Martin Pool (mbp) wrote :

At minimum we should give a meaningful error, suggesting to use branch instead, when the command is first run.

Robert says - problem is that binding implicitly tries to push/pull between the two, and in doing this takes a write lock on both.

Lightweight checkout will still take a lock because it has to lock the working tree to populate it, and locking the working tree implies locking the branch and repo, and they're remote. Need to systematically fix that so that we lock only the objects which need to be locked.

Robert says "checkout as a readonly operation is actually a mental fault", leftover from cvs/svn. The use case for reaodnly checkouts are

1 - to make a branch to work on when they're not a contributor (but better in bzr to just make a branch)
2 - to have a readonly mirror of the current tip of the branch, without keeping any history (whether the history is present or not is somewhat less of a burden if we can keep only some of the history on the client)

Alternative concept for 2 - introduce the explicit notion of a mirror of a branch. With a checkout we presume we still have access to the parent on all operations. Where we currently create a branch reference, rather than giving the original gives a readonly version of a branch that raises exceptions on any methods that would need write access, but things like Pull still work.

Gist is - solve this more specific case directly.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

What is the status on this bug?

In the meantime, how do I make a publically readable tree (bare with me - I'm pretty new to this bzr deal). Or more precisely how can Anonymous George checkout my tree?

I've pushed via sftp, but checking out via http is failing (hence this bug report). Checking out via sftp works fine.

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 39542] Re: checkout over http error

Mikkel Kamstrup Erlandsen wrote:
> What is the status on this bug?
>
> In the meantime, how do I make a publically readable tree (bare with me - I'm pretty new to this bzr deal). Or more precisely how can Anonymous George checkout my tree?
>
> I've pushed via sftp, but checking out via http is failing (hence this bug report). Checking out via sftp works fine.
>

Currently 'checkout' does not work, but 'get/branch' should.

You should be able to do:

bzr get http://the/project local-name

bzr checkout http://the/project local-name

currently requires write access to what you are checking out. We are
working out the details of how to 'checkout' a readonly branch.

John
=:->

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Thanks a ton!

bzr get http://evilubermastermind.net/evilplans

works perfectly. I think I'm hooked on bzr now :-D

Revision history for this message
John Dong (jdong) wrote :

Isn't it a bug that lightweight checkouts do not work over the net? If a user only needs to track the head revision with no intent on changing anything, why does he need to branch the entire revision history, however huge it is?

bzr should have something that mirrors SVN/CVS checkouts...

Revision history for this message
Jonas Bonn (jonas.bonn) wrote :

I just stumbled across this problem now. If I try

bzr checkout http://www.site.com/bzr/branch

I get:

bzr: ERROR: Cannot lock: transport is read only: <bzrlib.transport.http._pycurl.PyCurlTransport url=http://www.site.com/bzr/branch/.bzr/branch/>

This is logical as this is a read-only connection, BUT.... the failure comes only AFTER most of the branch has already been downloaded. Wouldn't it make sense to try to lock FIRST, and fail gracefully, before spending a lot of time downloading files? If it fails to lock, no problem: suggest 'branch' instead.

Revision history for this message
Matthieu Moy (matthieu-moy) wrote :

Perhaps bzr could also actually do "branch", and end with a message like:

"can not bind local branch to http://.../. Creating a branch instead".

(there's a bind/checkout vocabulary that might confuse the user)

(also, it might be better to actually fail and suggest branch quickly).

Revision history for this message
Colin Watson (cjwatson) wrote :

In addition to the use cases Martin listed, mine is that I have data stored in bzr (the Ubuntu seeds) which various automatic build processes need to retrieve; I want them to be able to retrieve the data at the head of the branch as quickly as possible, but I'm not interested in keeping up to date (I'll throw away the checkout immediately after processing the data). Something like 'bzr export URL DEST' would actually be slightly closer to what I want, but checkout is definitely closer to the ideal than branch.

Revision history for this message
Robert Collins (lifeless) wrote :

I have fixed this, its just going through review.

Changed in bzr:
assignee: mbp → lifeless
Revision history for this message
Robert Collins (lifeless) wrote :

This is fixed in bzr.dev which will become 0.11

Changed in bzr:
status: Confirmed → 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.