bzr-feed Patch for Shared Repositories

December 19, 2007

I’ve started using shared repositories in Bazaar lately but the current version (revision 9) of bzr-feed had trouble recognizing them. Rather than write another one, I decided to fix it.

Here is a small patch which does the trick:

=== modified file ''
--- 2007-09-23 06:28:24 +0000
+++ 2007-12-20 04:14:57 +0000
@@ -116,13 +116,16 @@
     dir = cgi.FieldStorage().getvalue("dir")
     repo =
+    branch_dir = dir
+    if cgi.FieldStorage().has_key("branch"):
+        branch_dir += '/' + cgi.FieldStorage().getvalue("branch")
     status(404, "Repository Not Found")
 if not len(repo.all_revision_ids()):
     status(404, "No Revisions Found")
 # Basic branch info
-branch =
+branch =
 start_rev = branch.revno()-9
 if (start_rev < 1): start_rev = 1
 first_rev = repo.get_revisions(repo.all_revision_ids()[0:])[0]

Basically, in the case of a shared repository, we now have to track the repository path, still dir, and the particular branch, branch_dir. For shared repositories, simply adding the branch CGI parameter should do the trick. For standalone repositories, the repository and branch directories are the same. That is, unless you have a shared repository it works as before so the branch keyword is not needed.

After applying the above patch, I generate my feeds by running it locally using something like this:

export SERVER_PORT=80
export REQUEST_URI="/bzr-feed/index.atom"
python dir=~/projects/bzr-feed\&branch=trunk > index.atom