]> Sergey Matveev's repositories - gerrvim.git/commitdiff
Ability to make replies to comments
authorSergey Matveev <stargrave@stargrave.org>
Fri, 17 Jul 2015 20:48:22 +0000 (23:48 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 17 Jul 2015 20:48:22 +0000 (23:48 +0300)
gerrvim2json.pl

index cb4e210822b1cd0095c0ea6519e8aac6b958d393..b38104f4382f8ccaf99011910bf4e21838c7248d 100755 (executable)
@@ -94,6 +94,7 @@ use Encode;
 use JSON;
 
 my %comments;
+my $blockid;
 my $filename = undef;
 my $linebgn = undef;
 my $lineend = undef;
@@ -118,19 +119,21 @@ sub comment_done {
     } else {
         $c{range} = {start_line => $linebgn, end_line => $lineend};
     };
+    ($c{in_reply_to} = $1) if ($blockid =~ /^R(.*)$/);
     push @{$comments{$filename}}, \%c;
 }
 
 while (<>) {
     chomp;
-    if (/^-{5}BEGIN \w{40} (.*) (\d+) (\d+)-{5}$/) {
+    if (/^-{5}BEGIN (\w+) (.*) (\d+) (\d+)-{5}$/) {
         $verbatim_block = 1;
         ($main_message = buf2str) unless $blockn;
         $blockn++;
         comment_done if defined $filename;
-        $filename = $1;
-        $linebgn = $2;
-        $lineend = $3;
+        $blockid = $1;
+        $filename = $2;
+        $linebgn = $3;
+        $lineend = $4;
     };
     push @buf, $_ unless $verbatim_block;
     if (/^-{5}END-{5}$/) {