From f6ab2695b71b0da343d2f37c38f6fd0a6a484005 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 17 Jul 2015 23:48:22 +0300 Subject: [PATCH] Ability to make replies to comments --- gerrvim2json.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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}$/) { -- 2.44.0