# # # patch "lib/perl/AdvancedFind.pm" # from [e2a9f9d3e2beb8081c0dfd83323a5c309f982d3b] # to [4ecd24f16f0b9b03790c321de932ef0feb773a2f] # # patch "lib/perl/History.pm" # from [8b821d263a1376c0b81ca75e31651494f4eb3fd4] # to [f3f763ea6fa78ef4aede759bbd559c4491cb3a38] # # patch "lib/ui/mtn-browse.glade" # from [70f487fdd041004d3c2c0dca64b2428fd8b146e7] # to [d28f10001e5140a215e8742ea94f15ac60b0faf6] # # patch "mtn-browse" # from [9b7faacea38fe15d95baab4948eef4134b06dc9c] # to [b6cbd29c33318168c2112ce7d90cd0edfaeac93a] # ============================================================ --- lib/perl/AdvancedFind.pm e2a9f9d3e2beb8081c0dfd83323a5c309f982d3b +++ lib/perl/AdvancedFind.pm 4ecd24f16f0b9b03790c321de932ef0feb773a2f @@ -110,22 +110,31 @@ sub advanced_find($$$) local $advanced_find->{in_cb} = 1; - # Update it with any preset values. + # Update it with any preset values if they exist. - $advanced_find->{branch_combo_details}->{preset} = 1; - $advanced_find->{branch_combo_details}->{complete} = - $browser->{branch_combo_details}->{complete}; - $advanced_find->{branch_combo_details}->{value} = - $browser->{branch_combo_details}->{value}; + if (exists($browser->{branch_combo_details})) + { + $advanced_find->{branch_combo_details}->{preset} = 1; + $advanced_find->{branch_combo_details}->{complete} = + $browser->{branch_combo_details}->{complete}; + $advanced_find->{branch_combo_details}->{value} = + $browser->{branch_combo_details}->{value}; - $advanced_find->{revision_combo_details}->{preset} = 1; - $advanced_find->{revision_combo_details}->{complete} = - $browser->{revision_combo_details}->{complete}; - $advanced_find->{revision_combo_details}->{value} = - $browser->{revision_combo_details}->{value}; + $advanced_find->{revision_combo_details}->{preset} = 1; + $advanced_find->{revision_combo_details}->{complete} = + $browser->{revision_combo_details}->{complete}; + $advanced_find->{revision_combo_details}->{value} = + $browser->{revision_combo_details}->{value}; - $advanced_find->{tagged_checkbutton}-> - set_active($browser->{tagged_checkbutton}->get_active()); + $advanced_find->{tagged_checkbutton}-> + set_active($browser->{tagged_checkbutton}->get_active()); + } + else + { + $advanced_find->{branch_combo_details}->{preset} = 0; + $advanced_find->{revision_combo_details}->{preset} = 0; + $advanced_find->{tagged_checkbutton}->set_active(FALSE); + } &{$advanced_find->{update_handler}}($advanced_find, NEW_FIND); @@ -794,6 +803,12 @@ sub get_advanced_find_window($) $instance->{selected} = 0; $instance->{stop} = 0; + # Make sure that the branch comboboxentry has the focus and not the cancel + # button. + + $instance->{branch_comboboxentry}->child()->grab_focus(); + $instance->{branch_comboboxentry}->child()->set_position(-1); + return $instance; } ============================================================ --- lib/perl/History.pm 8b821d263a1376c0b81ca75e31651494f4eb3fd4 +++ lib/perl/History.pm f3f763ea6fa78ef4aede759bbd559c4491cb3a38 @@ -80,6 +80,7 @@ my $__select_id_rev_2_ttip = __("Select # Public routines. +sub display_arbitrary_revision_comparison($); sub display_file_change_history($$$); sub display_renamed_file_comparison($$$$$$); sub display_revision_change_history($$$); @@ -87,11 +88,13 @@ sub display_revision_comparison($$$;$); # Private routines. +sub compare_arbitrary_revision_advanced_find_button_clicked_cb($$); sub compare_button_clicked_cb($$); sub comparison_revision_change_log_button_clicked_cb($$); sub external_diffs($$$$$$); sub external_diffs_button_clicked_cb($$); sub file_comparison_combobox_changed_cb($$); +sub get_compare_arbitrary_revisions_window(); sub get_file_history_helper($$$); sub get_history_window(); sub get_revision_comparison_window($); @@ -1131,6 +1134,36 @@ sub display_renamed_file_comparison($$$$ # ############################################################################## # +# Routine - display_arbitrary_revision_comparison +# +# Description - Display a window that allows the user to select two +# arbitrary revisions for comparison. +# +# Data - $mtn : The Monotone::AutomateStdio object that is to be +# used to do the comparison. +# +############################################################################## + + + +sub display_arbitrary_revision_comparison($) +{ + + my $mtn = $_[0]; + + my $instance; + + $instance = get_compare_arbitrary_revisions_window(); + local $instance->{in_cb} = 1; + + $instance->{mtn} = $mtn; + $instance->{first_revision_id} = ""; + $instance->{second_revision_id} = ""; + +} +# +############################################################################## +# # Routine - history_list_button_clicked_cb # # Description - Callback routine called when the user clicks on any of the @@ -1270,6 +1303,81 @@ sub history_list_button_clicked_cb($$) # ############################################################################## # +# Routine - compare_arbitrary_revision_advanced_find_button_clicked_cb +# +# Description - Callback routine called when the user clicks on either of +# the advanced find buttons displayed in the compare +# arbitrary revisions window. +# +# Data - $widget : The widget object that received the signal. +# $details : A reference to an anonymous hash containing the +# window instance and the number of the button +# pressed. +# +############################################################################## + + + +sub compare_arbitrary_revision_advanced_find_button_clicked_cb($$) +{ + + my($widget, $details) = @_; + + my(@dummy, + $instance, + $revision_id); + + $instance = $details->{instance}; + + return if ($instance->{in_cb}); + local $instance->{in_cb} = 1; + + # Let the user choose the revision (we aren't interested in the branch + # name(s)) and then store and display the result. + + if (advanced_find($instance, \$revision_id, address@hidden)) + { + if ($details->{button} == 1) + { + $instance->{first_revision_id} = $revision_id; + set_label_value($instance->{arbitrary_revision_id_1_value_label}, + $revision_id); + if ($instance->{first_revision_id} + eq $instance->{second_revision_id}) + { + $instance->{second_revision_id} = ""; + set_label_value + ($instance->{arbitrary_revision_id_2_value_label}, ""); + } + } + else + { + $instance->{second_revision_id} = $revision_id; + set_label_value($instance->{arbitrary_revision_id_2_value_label}, + $revision_id); + if ($instance->{second_revision_id} + eq $instance->{first_revision_id}) + { + $instance->{first_revision_id} = ""; + set_label_value + ($instance->{arbitrary_revision_id_1_value_label}, ""); + } + } + if ($instance->{first_revision_id} ne "" + && $instance->{second_revision_id} ne "") + { + $instance->{arbitrary_compare_button}->set_sensitive(TRUE); + } + else + { + $instance->{arbitrary_compare_button}->set_sensitive(FALSE); + } + } + +} +# +############################################################################## +# # Routine - compare_button_clicked_cb # # Description - Callback routine called when the user clicks on the @@ -1560,7 +1668,7 @@ sub get_history_window() my $window_type = "history_window"; my $wm = WindowManager->instance(); - # Create a new file history window if an unused one wasn't found, otherwise + # Create a new history window if an unused one wasn't found, otherwise # reuse an existing unused one. if (! defined($instance = $wm->find_unused($window_type))) @@ -1595,7 +1703,7 @@ sub get_history_window() $instance->{$widget} = $instance->{glade}->get_widget($widget); } - # Setup the file history callbacks. + # Setup the history callbacks. $instance->{window}->signal_connect ("delete_event", @@ -1615,7 +1723,7 @@ sub get_history_window() $instance->{stop_button}->signal_connect ("clicked", sub { $_[1]->{stop} = 1; }, $instance); - # Setup the file history viewer. + # Setup the history viewer. $instance->{history_buffer} = $instance->{history_textview}->get_buffer(); @@ -1786,6 +1894,118 @@ sub get_revision_history_helper($$) # ############################################################################## # +# Routine - get_compare_arbitrary_revisions_window +# +# Description - Creates or prepares an existing compare arbitrary revisions +# window for use. +# +# Data - Return Value : A reference to the newly created or unused +# compare arbitrary revisions instance record. +# +############################################################################## + + + +sub get_compare_arbitrary_revisions_window() +{ + + my $instance; + my $window_type = "compare_arbitrary_revisions_window"; + my $wm = WindowManager->instance(); + + # Create a new file history window if an unused one wasn't found, otherwise + # reuse an existing unused one. + + if (! defined($instance = $wm->find_unused($window_type))) + { + $instance = {}; + $instance->{glade} = Gtk2::GladeXML->new($glade_file, + $window_type, + APPLICATION_NAME); + + # Flag to stop recursive calling of callbacks. + + $instance->{in_cb} = 0; + local $instance->{in_cb} = 1; + + # Connect Glade registered signal handlers. + + glade_signal_autoconnect($instance->{glade}, $instance); + + # Get the widgets that we are interested in. + + $instance->{window} = $instance->{glade}->get_widget($window_type); + foreach my $widget ("arbitrary_revision_id_1_value_label", + "arbitrary_revision_id_2_value_label", + "arbitrary_revision_1_advanced_find_button", + "arbitrary_revision_2_advanced_find_button", + "arbitrary_compare_button") + { + $instance->{$widget} = $instance->{glade}->get_widget($widget); + } + + # Setup the arbitrary compare callbacks. + + $instance->{window}->signal_connect + ("delete_event", + sub { + my($widget, $event, $instance) = @_; + return TRUE if ($instance->{in_cb}); + local $instance->{in_cb} = 1; + $widget->hide(); + $instance->{mtn} = undef; + return TRUE; + }, + $instance); + foreach my $button (1 .. 2) + { + my $widget = + "arbitrary_revision_" . $button . "_advanced_find_button"; + $instance->{$widget}->signal_connect + ("clicked", + \&compare_arbitrary_revision_advanced_find_button_clicked_cb, + {instance => $instance, + button => $button}); + } + + # Display the window. + + $instance->{window}->show_all(); + $instance->{window}->present(); + + # Register the window for management and set up the help callbacks. + + $wm->manage($instance, + $window_type, + $instance->{window}); + # TBD + register_help_callbacks + ($instance, + {widget => "stop_button", + help_ref => __("mtnb-lachc-history-buttons")}, + {widget => "compare_button", + help_ref => __("mtnb-lachc-history-buttons")}, + {widget => undef, + help_ref => __("mtnb-lachc-the-revision-and-file-history-" + . "windows")}); + } + else + { + $instance->{in_cb} = 0; + local $instance->{in_cb} = 1; + $instance->{arbitrary_compare_button}->set_sensitive(FALSE); + set_label_value($instance->{arbitrary_revision_id_1_value_label}, ""); + set_label_value($instance->{arbitrary_revision_id_2_value_label}, ""); + $instance->{window}->show_all(); + $instance->{window}->present(); + } + + return $instance; + +} +# +############################################################################## +# # Routine - get_revision_comparison_window # # Description - Creates or prepares an existing revision comparison window ============================================================ --- lib/ui/mtn-browse.glade 70f487fdd041004d3c2c0dca64b2428fd8b146e7 +++ lib/ui/mtn-browse.glade d28f10001e5140a215e8742ea94f15ac60b0faf6 @@ -64,7 +64,7 @@ - + True gtk-new 1 @@ -92,7 +92,7 @@ True - + True gtk-network 1 @@ -106,7 +106,7 @@ - + True GNOMEUIINFO_MENU_CLOSE_ITEM @@ -127,7 +127,7 @@ - + True gtk-quit 1 @@ -185,6 +185,28 @@ + + True + _Tools + True + + + + + + + True + _Compare Arbitrary Revisions + True + + + + + + + + + True GNOMEUIINFO_MENU_HELP_TREE @@ -201,7 +223,7 @@ - + True gtk-help 1 @@ -223,7 +245,7 @@ - + True gtk-help 1 @@ -245,7 +267,7 @@ - + True gtk-help 1 @@ -272,7 +294,7 @@ - + True gtk-home 1 @@ -9903,4 +9925,391 @@ Monotone server from the list + + True + Compare Arbitrary Revisions + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + mtn-browse.png + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + + + + 5 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 0 + 0 + + + + 5 + True + False + 5 + + + + True + 2 + 3 + False + 0 + 5 + + + + 250 + True + True + GTK_POLICY_NEVER + GTK_POLICY_NEVER + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + 1 + 1 + 0 0 250 10 225 250 + 0 0 30 10 27 30 + + + + 0 + 0 + True + File id of the first file that is to be compared + True + False + + + + 0 + 0 + True + True + + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + + + + + 0 + 7 + + + + + + + 1 + 2 + 0 + 1 + fill + + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_NEVER + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + 1 + 1 + 0 0 250 10 225 250 + 0 0 30 10 27 30 + + + + 0 + 0 + True + File id of the second file that is to be compared + True + False + + + + 0 + 0 + True + True + + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + + + + + 0 + 7 + + + + + + + 1 + 2 + 1 + 2 + fill + + + + + + True + The first of two revision ids +selected for comparison + True + False + + + + True + First revision id: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + 0 + 1 + 0 + 1 + fill + fill + + + + + + True + The second of two revision +ids selected for comparison + True + False + + + + True + Second revision id: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + 0 + 1 + 1 + 2 + fill + fill + + + + + + True + Select a revision using +advanced selection criteria + True + GTK_RELIEF_NONE + True + + + + True + gtk-find + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 2 + 3 + 0 + 1 + fill + + + + + + + True + Select a revision using +advanced selection criteria + True + GTK_RELIEF_NONE + True + + + + True + gtk-find + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 2 + 3 + 1 + 2 + fill + + + + + + 0 + True + True + + + + + + True + 1 + 1 + False + 0 + 5 + + + + True + False + Compare the two +selected revisions + True + GTK_RELIEF_NONE + False + + + + + True + diffs.png + 0.5 + 0.5 + 0 + 0 + + + + + 0 + 1 + 0 + 1 + fill + + + + + + 0 + False + True + + + + + + + + + + True + <b>Compare</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + + ============================================================ --- mtn-browse 9b7faacea38fe15d95baab4948eef4134b06dc9c +++ mtn-browse b6cbd29c33318168c2112ce7d90cd0edfaeac93a @@ -145,6 +145,7 @@ sub close_toolbutton_clicked_cb($$); sub advanced_find_button_clicked_cb($$); sub annotate_button_clicked_cb($$); sub close_toolbutton_clicked_cb($$); +sub compare_arbitrary_revisions_activate_cb($$); sub connect_to_server_activate_cb($$); sub context_help_activate_cb($$); sub create_browser_widgets(); @@ -583,6 +584,33 @@ sub quit_activate_cb($$) # ############################################################################## # +# Routine - compare_arbitrary_revisions_activate_cb +# +# Description - Callback routine called when the user selects the compare +# arbitrary revisions menu option. +# +# Data - $widget : The widget object that received the signal. +# $browser : The browser instance that is associated with +# this widget. +# +############################################################################## + + + +sub compare_arbitrary_revisions_activate_cb($$) +{ + + my($widget, $browser) = @_; + + return if ($browser->{in_cb}); + local $browser->{in_cb} = 1; + + display_arbitrary_revision_comparison($browser->{mtn}); + +} +# +############################################################################## +# # Routine - help_on_window_activate_cb # # Description - Callback routine called when the user selects the help on @@ -1768,7 +1796,9 @@ sub get_browser_window(;$$$$$) $browser->{window} = $browser->{glade}->get_widget($window_type); foreach my $widget ("appbar", "connect_to_server_menutiem", + "close_menuitem", "file_encoding_menuitem", + "compare_arbitrary_revisions_menuitem", "main_vbox", "browser_hpaned", "close_toolbutton", @@ -2342,6 +2372,9 @@ sub update_browser_state($$) # Disable the browser as no database is associated with it. + $browser->{close_menuitem}->set_sensitive(FALSE); + $browser->{compare_arbitrary_revisions_menuitem}-> + set_sensitive(FALSE); $browser->{close_toolbutton}->set_sensitive(FALSE); $browser->{reload_toolbutton}->set_sensitive(FALSE); $browser->{main_vbox}->set_sensitive(FALSE); @@ -2353,6 +2386,9 @@ sub update_browser_state($$) # Enable the browser as there is a database associated with it. + $browser->{close_menuitem}->set_sensitive(TRUE); + $browser->{compare_arbitrary_revisions_menuitem}-> + set_sensitive(TRUE); $browser->{close_toolbutton}->set_sensitive(TRUE); $browser->{reload_toolbutton}->set_sensitive(TRUE); $browser->{main_vbox}->set_sensitive(TRUE);