monotone

monotone Commit Details

Date:2010-01-09 19:14:44 (9 years 4 months ago)
Author:Tony Cooper
Branch:net.venge.monotone.contrib.lib.automate-stdio
Commit:c25b5c20deadcb5847d2352bd612b31246971242
Parents: dd798e01c1d40cdf8e286c31ef76e3906dcc3a76
Message:- Made the convertion from UTF-8 into Perl's internal string format handle

errors in a better way.
- Made the handling of the convert_to_utf8 flag a little bit more consistent
with other such flags.
Changes:
Mlib/Monotone/AutomateStdio.pm (5 diffs)

File differences

lib/Monotone/AutomateStdio.pm
35473547
35483548
35493549
3550
3550
35513551
35523552
35533553
3554
3554
35553555
35563556
35573557
......
39483948
39493949
39503950
3951
3952
3953
3954
3955
3956
3957
3958
3951
39593952
39603953
39613954
......
40804073
40814074
40824075
4083
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
40844091
40854092
40864093
......
41424149
41434150
41444151
4145
4152
41464153
41474154
41484155
......
46134620
46144621
46154622
4616
4623
46174624
46184625
46194626
if (defined($this))
{
$this->{convert_to_utf8} = $suppress ? 0 : 1;
$this->{convert_to_utf8} = $suppress ? undef : 1;
}
else
{
$convert_to_utf8 = $suppress ? 0 : 1;
$convert_to_utf8 = $suppress ? undef : 1;
}
}
# Work out whether UTF-8 conversion is to be done at all.
if (defined($this->{convert_to_utf8}))
{
$out_as_utf8 = $in_as_utf8 = 0 unless ($this->{convert_to_utf8});
}
else
{
$out_as_utf8 = $in_as_utf8 = 0 unless ($convert_to_utf8);
}
$out_as_utf8 = $in_as_utf8 = undef unless ($this->{convert_to_utf8});
# Work out what database locked handler is to be used.
eval
{
$read_ok = $this->mtn_read_output($buffer_ref);
$$buffer_ref = decode_utf8($$buffer_ref) if ($in_as_utf8);
if ($read_ok && $in_as_utf8)
{
local $@;
eval
{
$$buffer_ref = decode_utf8($$buffer_ref, Encode::FB_CROAK);
};
if ($@)
{
$this->{error_msg} = "The output from Monotone was not "
. "UTF-8 encoded as expected";
&$carper($this->{error_msg});
return;
}
}
};
if ($@)
{
# Split the output up into lines if that is what is required.
@$ref = split(/\n/, $buffer) if (ref($ref) eq "ARRAY");
@$ref = split(/\n/, $$buffer_ref) if (ref($ref) eq "ARRAY");
return 1;
ws_path => undef,
ws_constructed => undef,
cd_to_ws_root => $cd_to_ws_root,
convert_to_utf8 => undef,
convert_to_utf8 => $convert_to_utf8,
mtn_options => undef,
mtn_pid => 0,
mtn_in => undef,

Archive Download the corresponding diff file

Branches

Tags

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