[bugzilla-gnome-org-extensions] Just create traces in the DB when parsing them the first time from a comment. This deals with the fa
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] Just create traces in the DB when parsing them the first time from a comment. This deals with the fa
- Date: Thu, 20 Nov 2014 22:12:10 +0000 (UTC)
commit ad7dee0cee7880e44068fa682742837d600d2050
Author: Max Kanat-Alexander <mkanat everythingsolved com>
Date: Tue Aug 4 03:16:53 2009 -0500
Just create traces in the DB when parsing them the first time from a comment.
This deals with the fact that comments come to us pre-wrapped, in quoteUrls.
code/install-update_db.pl | 69 ---------------------------------------------
lib/TraceParser/Hooks.pm | 2 +-
lib/TraceParser/Trace.pm | 17 ++++++-----
3 files changed, 10 insertions(+), 78 deletions(-)
---
diff --git a/lib/TraceParser/Hooks.pm b/lib/TraceParser/Hooks.pm
index ae9e62d..ac3fc5b 100644
--- a/lib/TraceParser/Hooks.pm
+++ b/lib/TraceParser/Hooks.pm
@@ -32,7 +32,7 @@ our @EXPORT = qw(
sub linkify_comment {
my %params = @_;
my ($text, $bug_id, $match, $replace) = @params{qw(text bug_id match replace)};
- my $trace = TraceParser::Trace->new_from_text($$text, $bug_id);
+ my $trace = TraceParser::Trace->new_or_create_from_text($$text, $bug_id);
return if !$trace;
my $template = Bugzilla->template_inner;
my $match_text = quotemeta($trace->text);
diff --git a/lib/TraceParser/Trace.pm b/lib/TraceParser/Trace.pm
index ae24244..6874000 100644
--- a/lib/TraceParser/Trace.pm
+++ b/lib/TraceParser/Trace.pm
@@ -87,7 +87,7 @@ use constant IGNORE_FUNCTIONS => qw(
# Returns a hash suitable for passing to create(), or undef if there is no
# trace in the comment.
sub parse_from_text {
- my ($class, $text, $bug_id) = @_;
+ my ($class, $text) = @_;
my $trace = Parse::StackTrace->parse(types => TRACE_TYPES,
text => $text);
return undef if !$trace;
@@ -114,7 +114,6 @@ sub parse_from_text {
my $trace_hash = md5_base64($trace_text);
return {
- bug_id => $bug_id,
stack_hash => $stack_hash,
short_hash => $short_hash,
short_stack => join(', ', @short_stack),
@@ -125,19 +124,21 @@ sub parse_from_text {
};
}
-sub new_from_text {
+sub new_or_create_from_text {
my ($class, $text, $bug_id) = @_;
my $parsed = Parse::StackTrace->parse(types => TRACE_TYPES,
text => $text);
return undef if !$parsed;
my $hash = md5_base64($parsed->text);
my $traces = $class->match({ trace_hash => $hash, bug_id => $bug_id });
- if (@$traces) {
- $traces->[0]->{stacktrace_object} = $parsed;
- return $traces->[0];
+ my $trace = $traces->[0];
+ if (!$trace) {
+ my $data = $class->parse_from_text($text);
+ $trace = $class->create({ %$data, bug_id => $bug_id });
}
- warn "No trace found on bug $bug_id with hash $hash";
- return undef;
+
+ $trace->{stacktrace_object} = $parsed;
+ return $trace;
}
###############################
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]