monotone

monotone Commit Details

Date:2008-09-04 12:19:06 (10 years 9 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.mtn-browse
Commit:e8c29f3bb011b596002e6a85b9f00f184c7edc0c
Parents: f178b077fb901e228a726f16c34746c11aa03bb3
Message:- Written a cache_extra_file_info routine to take centralise all of the file

info caching code into one place.
- Rei-instated the `file only' style of regex expression generation
file_glob_to_regexp (yes I know this is reversing a change I made earlier
:-().
- I have now changed the search_files_button_clicked_cb routine to just match
against the file name rather than the whole path. It also now displays any
matching files relative to the starting point in the directory hierarchy
rather than the whole path.
Changes:
MCommon.pm (3 diffs)
MFindFiles.pm (7 diffs)
Mmtn-browse (5 diffs)

File differences

Common.pm
5656
5757
5858
59
5960
6061
6162
......
769770
770771
771772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
772805
773806
774807
......
865898
866899
867900
868
901
869902
870903
871904
872
905
873906
874907
875908
# Public routines.
sub cache_extra_file_info($$$);
sub colour_to_string($);
sub create_format_tags($);
sub data_is_binary($);
#
##############################################################################
#
# Routine - cache_extra_file_info
#
# Description - Cache extra information about a file in its manifest entry
# record.
#
# Data - $mtn : The Monotone::AutomateStdio object that
# is to be used.
# $revision_id : The revision id from where the search for
# the latest file update is to start,
# working backwards.
# $manifest_entry : A reference to the file's manifest entry.
#
##############################################################################
sub cache_extra_file_info($$$)
{
my($mtn, $revision_id, $manifest_entry) = @_;
get_file_details($mtn,
$revision_id,
$manifest_entry->{name},
\$manifest_entry->{author},
\$manifest_entry->{last_update},
\$manifest_entry->{last_changed_revision});
}
#
##############################################################################
#
# Routine - get_file_details
#
# Description - Get the details of the specified file.
}
elsif ($char eq "*")
{
$re_text .= $escaping ? "\\*" : ".*";
$re_text .= $escaping ? "\\*" : "[^/]*";
}
elsif ($char eq "?")
{
$re_text .= $escaping ? "\\?" : ".";
$re_text .= $escaping ? "\\?" : "[^/]";
}
elsif ($char eq "\\")
{
FindFiles.pm
310310
311311
312312
313
313314
314315
316
315317
316318
317319
......
337339
338340
339341
342
340343
341344
342345
......
360363
361364
362365
366
367
363368
364369
365370
......
515520
516521
517522
518
523
519524
520525
521526
......
532537
533538
534539
535
536
537
538
539
540
541
542
540
541
542
543543
544
545
546
547
548
544
545
549546
550547
551548
......
609606
610607
611608
609
612610
613611
614
612
615613
616614
617615
......
704702
705703
706704
707
708
709
710
711
712
713
714
715
716
705
706
707
717708
718
719
720
721
722
723
724
709
725710
711
712
726713
727714
728715
my($contents_re,
$counter,
$file_glob_re,
$file_prefix_length,
$manifest,
$matches,
$name,
$period,
$query,
$size);
# Build up a sub-manifest representing the items that we are going to
# search.
$file_prefix_length = 0;
if ($query->{file_glob_search_subdirectories}
&& $instance->{starting_point} eq "")
{
@manifest = map($_->{manifest_entry}, @result);
}
$manifest = \@manifest;
$file_prefix_length = length($instance->{starting_point});
++ $file_prefix_length if ($file_prefix_length > 0);
}
# Precompile the regexps and more complex comparison values.
# Name.
next if ($entry->{name} !~ m/$file_glob_re/
next if (basename($entry->{name}) !~ m/$file_glob_re/
|| ($query->{file_glob} eq "" && $entry->{type} ne "file"));
# The remaining tests only make sense for files.
$last_update);
if (! exists($entry->{author}))
{
get_file_details($instance->{mtn},
$instance->{revision_id},
$entry->{name},
\$author,
\$last_update,
\$entry->{last_changed_revision});
$entry->{author} = $author;
$entry->{last_update} = $last_update;
cache_extra_file_info($instance->{mtn},
$instance->{revision_id},
$entry);
}
else
{
$author = $entry->{author};
$last_update = $entry->{last_update};
}
$author = $entry->{author};
$last_update = $entry->{last_update};
if (exists($query->{older_date}))
{
next if ($last_update lt $query->{older_date}
# If we have got this far then it is a match.
++ $matches;
$name = substr($entry->{name}, $file_prefix_length);
$instance->{results_liststore}->
set($instance->{results_liststore}->append(),
RLS_NAME_COLUMN, $entry->{name},
RLS_NAME_COLUMN, $name,
RLS_MANIFEST_ENTRY_COLUMN, $entry);
}
{
if (! exists($manifest_entry->{author}))
{
get_file_details($instance->{mtn},
$instance->{revision_id},
$manifest_entry->{name},
\$author,
\$last_update,
\$last_changed_revision);
$manifest_entry->{author} = $author;
$manifest_entry->{last_changed_revision} =
$last_changed_revision;
$manifest_entry->{last_update} = $last_update;
cache_extra_file_info($instance->{mtn},
$instance->{revision_id},
$manifest_entry);
}
else
{
$author = $manifest_entry->{author};
$last_changed_revision =
$manifest_entry->{last_changed_revision};
$last_update = $manifest_entry->{last_update};
}
$author = $manifest_entry->{author};
$file_id = $manifest_entry->{file_id};
$last_changed_revision = $manifest_entry->{last_changed_revision};
$last_update = $manifest_entry->{last_update};
$last_update =~ s/T/ /;
}
else
mtn-browse
174174
175175
176176
177
177
178178
179179
180180
......
416416
417417
418418
419
419
420420
421421
422422
......
13381338
13391339
13401340
1341
1342
1341
13431342
13441343
13451344
13461345
13471346
13481347
1349
13501348
13511349
13521350
......
21642162
21652163
21662164
2167
2168
2169
2170
2171
2172
2173
2174
2175
2165
2166
2167
21762168
2177
2178
2179
2180
2181
2169
2170
21822171
21832172
21842173
......
22892278
22902279
22912280
2292
2293
2294
2295
2296
2297
2298
2281
2282
2283
22992284
23002285
23012286
# Initialise stuff.
Gnome2::Program->init("mtn-browse", 0.3);
Gnome2::Program->init("mtn-browse", 0.51);
setup_sigchld_handler(\&sigchld_handler);
$glade_file = LIB_PATH . "/UI/mtn-browse.glade";
$tooltips = Gtk2::Tooltips->new();
if (! defined($large_logo));
Gnome2::About->new
("mtn-browse",
"0.45",
"0.51",
__("Copyright \xa9 2007-2009 Anthony Cooper"),
__("A graphical front-end browser for Monotone VCS databases"),
["Anthony Cooper <support\@coosoft.plus.com>"],
return if ($browser->{in_cb});
local $browser->{in_cb} = 1;
my($manifest_entry,
$short_name);
my $manifest_entry;
# Get the manifest entry details for the item that was double-clicked.
$widget->get_selection()->selected_foreach
(sub {
my($model, $path, $iter) = @_;
$short_name = $model->get($iter, MLS_NAME_COLUMN);
$manifest_entry = $model->get($iter, MLS_MANIFEST_ENTRY_COLUMN);
});
if (! exists($item->{manifest_entry}->{author}))
{
$taking_our_time = 1;
get_file_details($browser->{mtn},
$revision_ids[0],
$item->{manifest_entry}->{name},
\$author,
\$last_update,
\$item->{manifest_entry}->
{last_changed_revision});
$item->{manifest_entry}->{author} = $author;
$item->{manifest_entry}->{last_update} = $last_update;
cache_extra_file_info($browser->{mtn},
$revision_ids[0],
$item->{manifest_entry});
}
else
{
$author = $item->{manifest_entry}->{author};
$last_update = $item->{manifest_entry}->{last_update};
}
$author = $item->{manifest_entry}->{author};
$last_update = $item->{manifest_entry}->{last_update};
$last_update =~ s/T/ /;
}
else
{
my @revision_ids;
get_revision_ids($browser, \@revision_ids);
get_file_details($browser->{mtn},
$revision_ids[0],
$manifest_entry->{name},
\$manifest_entry->{author},
\$manifest_entry->{last_update},
\$manifest_entry->
{last_changed_revision});
cache_extra_file_info($browser->{mtn},
$revision_ids[0],
$manifest_entry);
}
$last_update = $manifest_entry->{last_update};
$last_update =~ s/T/ /;

Archive Download the corresponding diff file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status