From: Sergey Matveev <stargrave@stargrave.org>
Date: Fri, 17 Jul 2015 20:48:22 +0000 (+0300)
Subject: Ability to make replies to comments
X-Git-Tag: 0.1~1
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=f6ab2695b71b0da343d2f37c38f6fd0a6a484005;p=gerrvim.git

Ability to make replies to comments
---

diff --git a/gerrvim2json.pl b/gerrvim2json.pl
index cb4e210..b38104f 100755
--- a/gerrvim2json.pl
+++ b/gerrvim2json.pl
@@ -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}$/) {