monotone

monotone Commit Details

Date:2009-01-30 19:33:50 (10 years 4 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.mtn-browse
Commit:829f59f1d4c0b25af7dc045ccbe0195ed5ab08a7
Parents: 22c28617e3b260bff5299bcd6215c41ba58ff2c9
Message:Bugs fixed:

- Annotate no longer fails on an empty file.
- Annotate and comparisons are no longer affected by where the application is
run inside a workspace.
- mtn-browse now always explicitly opens a database rather than relying on the
mtn subprocess sorting itself out inside a workspace. This means that the mtn
subprocess is always run in the root directory which is much safer WRT
unexpected interactions with a workspace.
- Database locked dialog windows are no longer parented as these dialogs are in
fact related to Monotone::AutomateStdio object instances and not browser
window instances (which share Monotone::AutomateStdio object instances).
Changes:
Mlib/perl/Annotate.pm (3 diffs)
Mlib/perl/History.pm (2 diffs)
Mmtn-browse (3 diffs)

File differences

lib/perl/Annotate.pm
114114
115115
116116
117
117
118
119
120
121
122
123
124
118125
119126
120127
......
456463
457464
458465
459
466
467
468
460469
461
470
471
462472
463473
464474
......
467477
468478
469479
470
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
471503
472504
473505
# their prefix and text parts.
$max_len = 0;
$instance->{prefix_length} = length(($lines[0] =~ m/^([^:]+):.*$/)[0]);
if (scalar(@lines) > 0)
{
$instance->{prefix_length} = length(($lines[0] =~ m/^([^:]+):.*$/)[0]);
}
else
{
$instance->{prefix_length} = 0;
}
$template = sprintf("a%da2a*", $instance->{prefix_length});
for ($i = 0; $i < scalar(@lines); ++ $i)
{
my($list, $mtn_db, $revision_id, $file_name) = @_;
my($buffer,
@cmd);
@cmd,
$cwd,
$err);
# Run mtn annotate.
# Run mtn annotate in the root directory so as to avoid any workspace
# conflicts.
@$list = ();
push(@cmd, "mtn");
push(@cmd, "-r");
push(@cmd, "i:" . $revision_id);
push(@cmd, $file_name);
run_command(\$buffer, @cmd) or return;
$cwd = getcwd();
eval
{
die("chdir failed: " . $!) unless (chdir(File::Spec->rootdir()));
run_command(\$buffer, @cmd) or return;
};
$err = $@;
chdir($cwd);
if ($err ne "")
{
my $dialog = Gtk2::MessageDialog->new_with_markup
(undef,
["modal"],
"warning",
"close",
__x("Problem running mtn annotate, got:\n"
. "<b><i>{error_message}</i></b>\n"
. "This should not be happening!",
error_message => Glib::Markup::escape_text($err)));
WindowManager->instance()->allow_input(sub { $dialog->run(); });
$dialog->destroy();
return;
}
# Break up the input into a list of lines.
lib/perl/History.pm
19371937
19381938
19391939
1940
1940
1941
1942
19411943
1942
1944
1945
19431946
19441947
19451948
......
19501953
19511954
19521955
1953
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
19541979
19551980
19561981
my($list, $mtn_db, $revision_id_1, $revision_id_2, $file_name) = @_;
my($buffer,
@cmd);
@cmd,
$cwd,
$err);
# Run mtn diff.
# Run mtn diff in the root directory so as to avoid any workspace
# conflicts.
@$list = ();
push(@cmd, "mtn");
push(@cmd, "-r");
push(@cmd, "i:" . $revision_id_2);
push(@cmd, $file_name) if (defined($file_name));
run_command(\$buffer, @cmd) or return;
$cwd = getcwd();
eval
{
die("chdir failed: " . $!) unless (chdir(File::Spec->rootdir()));
run_command(\$buffer, @cmd) or return;
};
$err = $@;
chdir($cwd);
if ($err ne "")
{
my $dialog = Gtk2::MessageDialog->new_with_markup
(undef,
["modal"],
"warning",
"close",
__x("Problem running mtn diff, got:\n"
. "<b><i>{error_message}</i></b>\n"
. "This should not be happening!",
error_message => Glib::Markup::escape_text($err)));
WindowManager->instance()->allow_input(sub { $dialog->run(); });
$dialog->destroy();
return;
}
# Break up the input into a list of lines.
mtn-browse
5757
5858
5959
60
6061
6162
6263
......
237238
238239
239240
240
241
242
241
242
243
244
243245
244246
245247
248
249
250
251
252
253
254
255
246256
247257
258
248259
249260
250261
262
251263
252264
265
266
267
268
269
270
253271
272
273
254274
275
255276
256277
257278
258279
259
280
260281
261282
262283
......
25862607
25872608
25882609
2589
25902610
25912611
25922612
# Standard Perl and CPAN modules.
use Cwd qw(getcwd);
use Data::Dumper;
use File::Basename;
use File::Spec;
exit(1);
}
# Open a Monotone database. First attempt to open the current Monotone
# workspace's database. If this doesn't work or the default database is to
# be used anyway then attempt to open that database instead.
# Open a Monotone database. First attempt to open the current workspace's
# database. If this doesn't work or the database listed in the user's
# preferences file is to be used anyway then attempt to open that database
# instead.
if ($user_preferences->{workspace}->{takes_precedence})
{
# Attempt to open the current workspace's database. If this works then
# get the workspace's details and then re-open the database but this
# time explicitly specifying the database itself. When given a database
# name, Monotone::AutomateStdio will make sure any current workspace
# will not `interfere' the with the mtn subprocess. One could use the
# "--no-workspace" option but this is only supported on later versions.
eval
{
my $db;
$mtn = Monotone::AutomateStdio->new();
if ($user_preferences->{workspace}->{auto_select})
{
$mtn->get_option(\$db, "database");
$mtn->get_option(\$branch, "branch");
$mtn->get_base_revision_id(\$revision_id);
# Unset the branch name if there is no revision associated with
# it (this can happen if we are in a new workspace on a new
# branch that doesn't exist in the database yet).
$branch = undef if (! defined($revision_id));
}
$mtn = undef;
$mtn = Monotone::AutomateStdio->new($db);
};
}
if (! defined($mtn) && $user_preferences->{default_mtn_db} ne "")
{
# Attempt to open the default database.
# Attempt to open the database specified in the user's preferences.
eval
{
my($mtn, $parent) = @_;
$mtn->register_db_locked_handler(\&mtn_db_locked_handler, $parent);
if ($user_preferences->{show_suspended})
{
if ($mtn->can(MTN_IGNORE_SUSPEND_CERTS))

Archive Download the corresponding diff file

Branches

Tags

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