Merge lp:~j/loggerhead/loggerhead-add_url-prefix_to_serve-branches into lp:loggerhead

Proposed by j^
Status: Work in progress
Proposed branch: lp:~j/loggerhead/loggerhead-add_url-prefix_to_serve-branches
Merge into: lp:loggerhead
Diff against target: 57 lines (+11/-0)
3 files modified
loggerhead/apps/transport.py (+5/-0)
loggerhead/config.py (+3/-0)
serve-branches.1 (+3/-0)
To merge this branch: bzr merge lp:~j/loggerhead/loggerhead-add_url-prefix_to_serve-branches
Reviewer Review Type Date Requested Status
Matt Nordhoff Needs Fixing
Review via email: mp+20575@code.launchpad.net
To post a comment you must log in.
Revision history for this message
j^ (j) wrote :

since all branches served via serve-branches are available, i want to advertise them,
this patch adds an option --url-prefix that works like url_prefix in loggerhead.conf

403. By j^

use object() as default

404. By j^

make that None

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

This seems reasonable to me, but I'd like to be more clear on just what the impact is. Can we add an example to the manual perhaps?

Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

A couple of quick comments:

9 + served_url = self._config.get_option('url_prefix') + name

I think it would be nice to run this through paste.request.resolve_relative_url() somewhere along the line.

11 + served_url = None

Changing served_url's default from loggerhead.apps.branch._DEFAULT to None will break things.

40 + help="All branches will be advertised to be available from this prefix")

This line's too long -- needs to be wrapped.

45 === modified file 'serve-branches.1'

Wow, you remembered the man page. I had forgotten it existed. \o/

review: Needs Fixing
Revision history for this message
Kevin Jadin (marcspitz) wrote :

I have been able to adapt this patch to loggerhead 1.18.
I am not that good in merging and all that stuff.

Can someone more experienced than I am please follow the request that Matt Nordhoff made in order to merge the diff into loggerhead's trunk?

It shouldn't take that long to edit 4 lines of code just to enjoy this feature..
Thanks

PS : for this to work, I also had to add:
--url-prefix=$url_prefix in /etc/init.d/loggerhead
url_preview=http://mysite/url
to make this work, maybe this should also be edited in sources, but I don't know where..

Revision history for this message
Kevin Jadin (marcspitz) wrote :

of course: url_preview=http://mysite/url in /etc/serve-branches.conf

Unmerged revisions

404. By j^

make that None

403. By j^

use object() as default

402. By j^

add option to advertice all branches served by serve-branches to be available from given prefix (inline with loggeread.conf url_prefix option)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'loggerhead/apps/transport.py'
--- loggerhead/apps/transport.py 2009-11-26 03:20:53 +0000
+++ loggerhead/apps/transport.py 2010-03-03 17:33:15 +0000
@@ -54,6 +54,10 @@
54 else:54 else:
55 name = self.name55 name = self.name
56 is_root = False56 is_root = False
57 if self._config.get_option('url_prefix'):
58 served_url = self._config.get_option('url_prefix') + name
59 else:
60 served_url = None
57 branch_app = BranchWSGIApp(61 branch_app = BranchWSGIApp(
58 branch,62 branch,
59 name,63 name,
@@ -61,6 +65,7 @@
61 self.root.graph_cache,65 self.root.graph_cache,
62 is_root=is_root,66 is_root=is_root,
63 use_cdn=self._config.get_option('use_cdn'),67 use_cdn=self._config.get_option('use_cdn'),
68 served_url=served_url
64 )69 )
65 return branch_app.app70 return branch_app.app
6671
6772
=== modified file 'loggerhead/config.py'
--- loggerhead/config.py 2009-11-23 22:45:46 +0000
+++ loggerhead/config.py 2010-03-03 17:33:15 +0000
@@ -36,6 +36,7 @@
36 use_cdn=False,36 use_cdn=False,
37 sql_dir=None,37 sql_dir=None,
38 allow_writes=False,38 allow_writes=False,
39 url_prefix=None,
39 )40 )
40 parser.add_option("--user-dirs", action="store_true",41 parser.add_option("--user-dirs", action="store_true",
41 help="Serve user directories as ~user.")42 help="Serve user directories as ~user.")
@@ -69,6 +70,8 @@
69 help="The directory to place the SQL cache in")70 help="The directory to place the SQL cache in")
70 parser.add_option("--allow-writes", action="store_true",71 parser.add_option("--allow-writes", action="store_true",
71 help="Allow writing to the Bazaar server.")72 help="Allow writing to the Bazaar server.")
73 parser.add_option('--url-prefix', dest='url_prefix',
74 help="All branches will be advertised to be available from this prefix")
72 return parser75 return parser
7376
7477
7578
=== modified file 'serve-branches.1'
--- serve-branches.1 2008-09-10 23:12:59 +0000
+++ serve-branches.1 2010-03-03 17:33:15 +0000
@@ -38,6 +38,9 @@
38.TP38.TP
39\fB\-\-version\fR39\fB\-\-version\fR
40Print the software version and exit.40Print the software version and exit.
41.TP
42\fB\-\-url-prefix\fR
43All branches will be advertised to be available from this prefix.
41.SH "LICENSE"44.SH "LICENSE"
42GNU GPLv2 or later.45GNU GPLv2 or later.
43.SH "SEE ALSO"46.SH "SEE ALSO"

Subscribers

People subscribed via source and target branches