~ubuntu-branches/debian/lenny/bzrtools/lenny

« back to all changes in this revision

Viewing changes to .be/bugs/b47ef4d6-6a96-44ad-9694-6dd2c855d9c3/comments/4946aca8-392b-4d95-ae22-65c1a38d842c/body

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2008-05-12 20:25:35 UTC
  • mfrom: (1.2.2 upstream) (4.1.34 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080512202535-y92gjpczwr98htxe
Tags: 1.5.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

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