1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
Hello Aaron.
I can confirm the attached bug report, that `bzr branches` does not seem
to work with http:// URLs. I digged a bit in the source, and as far as I
can see the problem is that the t.get('.') line in apache_ls() raises a
RedirectRequested exception, which is silently swallowed in iter_bzrdirs().
I don't know much about bzr transport, but I tried to fix the issue with
do_catching_redirections, but it didn't seem to work, see the attached
script. What happens is that the trailing slash gets lost somewhere:
get_transport('http://bzr.debian.org/bzr/pkg-maemo').get('.')
raises a RedirectRequested exception whose .target is
http://bzr.debian.org/bzr/pkg-maemo/ (one trailing slash added); BUT:
get_transport('http://bzr.debian.org/bzr/pkg-maemo/').get('.')
raises again the very same exception!! (same .source and .target); AND:
get_transport('http://bzr.debian.org/bzr/pkg-maemo//').get('.')
works correctly.
So two issues here, as I understand it:
1. `bzr branch` is not robust against redirections
2. transport code seems to be silently ignoring one trailing slash in URLs
Please let me know if I can be of any help.
------------------------8<---------------------------
#! /usr/bin/python
import sys
from bzrlib.errors import RedirectRequested, TooManyRedirections
from bzrlib.transport import get_transport, do_catching_redirections
url = sys.argv[1:] and sys.argv[1] or 'http://bzr.debian.org/bzr/pkg-maemo'
transport = get_transport(url)
try:
transport.get('.')
except RedirectRequested:
print "A RedirectRequested was raised, trying now with do_catching_redirections."
else:
print "No RedirectRequested was raised, URL not good for this test."
sys.exit(1)
try:
lines = do_catching_redirections(lambda t: t.get('.'), transport,
lambda t, e, notice: get_transport(e.target))
except TooManyRedirections:
print "We got TooManyRedirections, that's bad."
else:
print "do_catching_redirections works nicely."
------------------------>8---------------------------
----- Forwarded message from Loïc Minier <lool@dooz.org> -----
From: Loïc Minier <lool@dooz.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Date: Sun, 29 Jul 2007 12:12:10 +0200
Subject: Bug#435110: "bzr branches" doesn't work with http:// URLs
Package: bzrtools
Version: 0.18.0-1
Severity: normal
Hi,
bzr branches works with:
bzr+ssh://bzr.debian.org/bzr/pkg-maemo
bzr+ssh://bzr.debian.org/bzr/pkg-maemo/hildon-desktop
sftp://bzr.debian.org/bzr/pkg-maemo
~/bzr/debian/pkg-maemo
but fails with:
http://bzr.debian.org/bzr/pkg-maemo
http://bzr.debian.org/bzr/pkg-maemo/hildon-desktop
while bzr ls works on:
http://bzr.debian.org/bzr/pkg-maemo/hildon-desktop/ubuntu
I see there's a special case for http:// in the code; could this be the
issue? Or is this because iterating over HTTP requires listing the
.bzr directory?
Bye,
|