]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/bugs/bzr_plugin_does_not_define_rcs__95__diff.mdwn
(no commit message)
[ikiwiki.git] / doc / bugs / bzr_plugin_does_not_define_rcs__95__diff.mdwn
index e579241313ef4346a19870eba14a0d5d2f14cfb1..110f769c736fe807c0a309af8b1262d289e570c2 100644 (file)
@@ -10,3 +10,52 @@ Grepping to verify absence of rcs_diff:
     /usr/share/perl5/IkiWiki/Plugin/git.pm:sub rcs_diff ($) {
     /usr/share/perl5/IkiWiki/Plugin/bzr.pm:    hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
 
+> I've added the minimal stub needed to avoid the crash, but for
+> recentchangesdiff to work, someone needs to implement `rcs_diff` for bzr.
+> This should be trivial if you know and use bzr. The function
+> is passed as a parameter the revno of interest and just needs
+> to ask bzr for the diff between that and the previous version. --[[Joey]] 
+
+>> I'll see if I can make a patch. The bzr command to get the revision would
+>> look like this: bzr diff -r revno:$PREV:/path/to/src..revno:$REVNO:/path/to/src
+>> (where $PREV would be $REVNO minus one). --liw
+
+>> Sorry, that was not entirely correct, for some reason. I'll add a patch below that
+>> seems to work. I am unfortunately not ready to set up a git repository that you
+>> can pull from. --liw
+
+    diff --git a/IkiWiki/Plugin/.bzr.pm.swp b/IkiWiki/Plugin/.bzr.pm.swp
+    new file mode 100644
+    index 0000000..712120c
+    Binary files /dev/null and b/IkiWiki/Plugin/.bzr.pm.swp differ
+    diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm
+    index 783623d..f1d5854 100644
+    --- a/IkiWiki/Plugin/bzr.pm
+    +++ b/IkiWiki/Plugin/bzr.pm
+    @@ -256,7 +256,25 @@ sub rcs_recentchanges ($) {
+     }
+   
+     sub rcs_diff ($) {
+    -   # TODO
+    +        my $taintedrev=shift;
+    +   my ($rev) = $taintedrev =~ /^(\d+(\.\d+)*)$/; # untaint
+    +           print STDERR "taintedrev: $taintedrev\nrev: $rev\n";
+    +
+    +   my $prevspec = "before:" . $rev;
+    +   my $revspec = "revno:" . $rev;
+    +        my @cmdline = ("bzr", "diff", "--old", $config{srcdir},
+    +                  "--new", $config{srcdir},
+    +                  "-r", $prevspec . ".." . $revspec);
+    +   print STDERR "cmdline: @cmdline\n";
+    +        open (my $out, "@cmdline |");
+    +
+    +   my @lines = <$out>;
+    +        if (wantarray) {
+    +                return @lines;
+    +        }
+    +        else {
+    +                return join("", @lines);
+    +        }
+     }
+   
+     sub rcs_getctime ($) {