# # # patch "Preferences.pm" # from [ce39e679c617347077fda4a113fe215bd3522a2a] # to [e7a7991e6e5d4b6df1b5eb1e790989251e7c1829] # # patch "mtn-browse" # from [3b5148c89ee9ae73df8c18d104e476e27c6aa764] # to [0c39f078f90d1a49509d537e401af8f8a1c83d4d] # # patch "mtn-browse.glade" # from [cfe9e3171f3f842633db5c602f10340385122831] # to [ec7ec4bdb1b3d30d8d849e2b41d665727deb8904] # ============================================================ --- Preferences.pm ce39e679c617347077fda4a113fe215bd3522a2a +++ Preferences.pm e7a7991e6e5d4b6df1b5eb1e790989251e7c1829 @@ -60,7 +60,7 @@ use constant PREFERENCES_FILE_NAME => ". # Constant for the preferences file's format version. -use constant PREFERENCES_FORMAT_VERSION => 3; +use constant PREFERENCES_FORMAT_VERSION => 4; # Text viewable application mime types. @@ -995,6 +995,7 @@ sub get_preferences_window($$) "database_browse_button", "precedence_checkbutton", "auto_select_checkbutton", + "auto_select_head_checkbutton", "tagged_lists_limit_spinbutton", "tagged_lists_sort_cronologically_radiobutton", "tagged_lists_sort_by_name_radiobutton", @@ -1194,6 +1195,9 @@ sub load_preferences_into_gui($) $instance->{auto_select_checkbutton}-> set_active($instance->{preferences}->{workspace}->{auto_select} ? TRUE : FALSE); + $instance->{auto_select_head_checkbutton}-> + set_active($instance->{preferences}->{auto_select_head} ? + TRUE : FALSE); $instance->{tagged_lists_limit_spinbutton}-> set_value($instance->{preferences}->{query}->{tagged}->{limit}); if ($instance->{preferences}->{query}->{tagged}->{sort_cronologically}) @@ -1362,6 +1366,8 @@ sub save_preferences_from_gui($) $instance->{precedence_checkbutton}->get_active() ? 1 : 0; $instance->{preferences}->{workspace}->{auto_select} = $instance->{auto_select_checkbutton}->get_active() ? 1 : 0; + $instance->{preferences}->{auto_select_head} = + $instance->{auto_select_head_checkbutton}->get_active() ? 1 : 0; $instance->{preferences}->{query}->{tagged}->{limit} = $instance->{tagged_lists_limit_spinbutton}->get_value_as_int(); $instance->{preferences}->{query}->{tagged}->{sort_cronologically} = @@ -1517,6 +1523,11 @@ sub upgrade_preferences($) find_text => []}; $preferences->{version} = 3; } + if ($preferences->{version} == 3) + { + $preferences->{auto_select_head} = 0; + $preferences->{version} = 4; + } $preferences->{version} = PREFERENCES_FORMAT_VERSION; @@ -1549,6 +1560,7 @@ sub initialise_preferences() default_mtn_db => "", workspace => {takes_precedence => 1, auto_select => 1}, + auto_select_head => 0, query => {tagged => {limit => 200, sort_cronologically => 1}, id => {limit => 200, ============================================================ --- mtn-browse 3b5148c89ee9ae73df8c18d104e476e27c6aa764 +++ mtn-browse 0c39f078f90d1a49509d537e401af8f8a1c83d4d @@ -1749,7 +1749,7 @@ sub update_browser_state($$) # The database has changed. - if ($changed & DATABASE_CHANGED) + if ($changed == DATABASE_CHANGED) { my $db_name; @@ -1859,6 +1859,47 @@ sub update_browser_state($$) my @revision_list; + # If auto-selection of the head revision is wanted by the user and it + # is appropriate then preset the revision id. + + if ($user_preferences->{auto_select_head} + && ! $browser->{tagged_checkbutton}->get_active() + && $browser->{branch_combo_details}->{complete} + && ! $browser->{revision_combo_details}->{preset}) + { + my @revision_ids; + $browser->{appbar}->set_status(__("Auto selecting head revision")); + $wm->update_gui(); + $browser->{mtn}->select + (address@hidden, + "h:" . $browser->{branch_combo_details}->{value}); + if (scalar(@revision_ids) == 1) + { + $browser->{revision_combo_details}->{preset} = 1; + $browser->{revision_combo_details}->{value} = $revision_ids[0]; + $browser->{tagged_checkbutton}->set_active(FALSE); + } + elsif (scalar(@revision_ids) > 1) + { + my $message; + $message = + __x("The `{branch}' branch has multiple heads.\n", + branch => $browser->{branch_combo_details}->{value}) + . __("Please manually select the revision.\n") + . __("The head revision ids are:"); + foreach my $item (@revision_ids) + { + $message .= "\n" . Glib::Markup::escape_text($item); + } + my $dialog = Gtk2::MessageDialog->new_with_markup + ($browser->{window}, ["modal"], "info", "close", $message); + $wm->allow_input(sub { $dialog->run(); }); + $dialog->destroy(); + } + $browser->{appbar}->set_status(""); + $wm->update_gui(); + } + # Reset the revision selection. $browser->{revision_combo_details}->{completion} = undef; ============================================================ --- mtn-browse.glade cfe9e3171f3f842633db5c602f10340385122831 +++ mtn-browse.glade ec7ec4bdb1b3d30d8d849e2b41d665727deb8904 @@ -4755,6 +4755,74 @@ loaded into the browser upon startup + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 0 + 0 + + + + 5 + True + Select if the head revision on a branch +should automatically be loaded into a +browser as soon as the branch has +been selected (this only works when +selecting revisions by their ids and not +by their tags) + True + Auto select head revision + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + + + + True + <b>Revision Selection</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + False + True + + + + True 0