1 Version 2.0 of bzr seems to break the bzr plugin.
3 I traced this to the bzr_log method in the plugin, and patching that seems to fix it. The plugin just needs to parse the input little bit differently.
6 > Patch applied, [[done]] (but, it would be good if it could be tested with
7 > an older bzr, and it's a pity bzr's human-targeted log has to be parsed,
8 > I assume there is no machine-targeted version?) --[[Joey]]
10 From fb897114124e627fd3acf5af8e784c9a77419a81 Mon Sep 17 00:00:00 2001
11 From: Lars Wirzenius <liw@liw.fi>
12 Date: Sun, 4 Apr 2010 21:05:07 +1200
13 Subject: [PATCH] Fix bzr plugin to work with bzr 2.0.
15 The output of "bzr log" seems to have changed a bit, so we change the
16 parsing accordingly. This has not been tested with earlier versions of
19 Several problems seemed to occur, all in the bzr_log subroutine:
21 1. The @infos list would contain an empty hash, which would confuse the
23 2. This was because bzr_log would push an empty anonymous hash to the
24 list whenever it thought a new record would start.
25 3. However, a new record marker (now?) also happens at th end of bzr log
27 4. Now we collect the record to a hash that gets pushed to the list only
29 5. Also, sometimes bzr log outputs "revno: 1234 [merge]", so we catch only
31 6. Finally, there may be non-headers at the of the output, so we ignore
34 IkiWiki/Plugin/bzr.pm | 23 ++++++++++++++++-------
35 1 files changed, 16 insertions(+), 7 deletions(-)
37 diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm
38 index 1ffdc23..e813331 100644
39 --- a/IkiWiki/Plugin/bzr.pm
40 +++ b/IkiWiki/Plugin/bzr.pm
41 @@ -73,28 +73,37 @@ sub bzr_log ($) {
49 if ($line =~ /^message:/) {
51 - $infos[$#infos]{$key} = "";
54 elsif ($line =~ /^(modified|added|renamed|renamed and modified|removed):/) {
56 - unless (defined($infos[$#infos]{$key})) { $infos[$#infos]{$key} = ""; }
57 + unless (defined($$hash{$key})) { $$hash{$key} = ""; }
59 elsif (defined($key) and $line =~ /^ (.*)/) {
60 - $infos[$#infos]{$key} .= "$1\n";
61 + $$hash{$key} .= "$1\n";
63 elsif ($line eq "------------------------------------------------------------\n") {
65 + push (@infos, $hash);
72 + elsif ($line =~ /: /) {
74 - ($key, $value) = split /: +/, $line, 2;
75 - $infos[$#infos]{$key} = $value;
76 + if ($line =~ /^revno: (\d+)/) {
80 + ($key, $value) = split /: +/, $line, 2;
82 + $$hash{$key} = $value;