# # # patch "lib/perl/AdvancedFind.pm" # from [be8cc22c57fa7fde3f67a8bf55b97b55de6e49be] # to [55f479535ab7252fc8db2acae5398ce2ed82c147] # # patch "lib/perl/Common.pm" # from [425d2a518dae5a26fd5d29793796e3f640b427fc] # to [c3895d65117acd3f91336f502cac6c96f1d8a6b1] # # patch "mtn-browse" # from [386c28f5cb465f8e6c7e4e4ab423eac517e3abef] # to [c0fcb16dc95eba64e82f77412d950498041639b0] # ============================================================ --- lib/perl/AdvancedFind.pm be8cc22c57fa7fde3f67a8bf55b97b55de6e49be +++ lib/perl/AdvancedFind.pm 55f479535ab7252fc8db2acae5398ce2ed82c147 @@ -990,7 +990,8 @@ sub update_advanced_find_state($$) Glib::Markup::escape_text($message))); $wm->allow_input(sub { $dialog->run(); }); $dialog->destroy(); - die("Bad query"); }); + die("Bad query"); + }); eval { $advanced_find->{mtn}->select(address@hidden, $query); ============================================================ --- lib/perl/Common.pm 425d2a518dae5a26fd5d29793796e3f640b427fc +++ lib/perl/Common.pm c3895d65117acd3f91336f502cac6c96f1d8a6b1 @@ -536,7 +536,31 @@ sub open_database($$$) # Ok it is a readable file, try and open it but deal with any # errors in a nicer way than normal. - CachingAutomateStdio->register_error_handler(MTN_SEVERITY_ALL); + CachingAutomateStdio->register_error_handler + (MTN_SEVERITY_ALL, + sub { + my($severity, $message) = @_; + my $dialog; + $message =~ s/mtn: misuse: //g; + $message =~ s/^Corrupt\/missing mtn [^\n]+\n//g; + $message =~ s/ at .+ line \d+$//g; + $message =~ s/\n/ /g; + $message =~ s/\s+$//g; + $message .= "." unless ($message =~ m/.+\.$/); + $dialog = Gtk2::MessageDialog->new_with_markup + ($parent, + ["modal"], + "warning", + "close", + __x("There is a problem opening the database, " + . "the details are:\n" + . "{error_message}", + error_message => + Glib::Markup::escape_text($message))); + $dialog->run(); + $dialog->destroy(); + die("Bad open"); + }); eval { $mtn_obj = CachingAutomateStdio->new($fname); @@ -544,19 +568,8 @@ sub open_database($$$) $exception = $@; CachingAutomateStdio->register_error_handler (MTN_SEVERITY_ALL, \&mtn_error_handler); - if ($exception) + if (! $exception) { - my $dialog = Gtk2::MessageDialog->new - ($parent, - ["modal"], - "warning", - "close", - __("Not a valid Monotone database.")); - $dialog->run(); - $dialog->destroy(); - } - else - { # Seems to be ok so tell the caller. ============================================================ --- mtn-browse 386c28f5cb465f8e6c7e4e4ab423eac517e3abef +++ mtn-browse c0fcb16dc95eba64e82f77412d950498041639b0 @@ -3222,7 +3222,7 @@ sub mtn_error_handler($$) ["modal"], "warning", "close", - __x("Problem with monotone request, got:\n" + __x("Problem with Monotone request, got:\n" . "{error_message}\n" . "This should not be happening!", error_message => Glib::Markup::escape_text($message))); @@ -3239,7 +3239,7 @@ sub mtn_error_handler($$) ["modal"], "error", "close", - __x("Monotone process unexpectedly exiting with:\n" + __x("The Monotone subprocess unexpectedly exited with:\n" . "{error_message}\n" . "This is fatal, I am going to exit.", error_message => Glib::Markup::escape_text($message))); @@ -3304,7 +3304,7 @@ sub sigchld_handler() ["modal"], "warning", "close", - __x("The mtn subprocess just unexpectedly\n" + __x("The Monotone subprocess just unexpectedly\n" . "exited ({error_message}).\n" . "This should not be happening!\n" . "It will be restarted when needed.",