| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# The script tests Arch::Tree methods. |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
38
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
934
|
use FindBin; |
|
|
1
|
|
|
|
|
1335
|
|
|
|
1
|
|
|
|
|
49
|
|
|
8
|
1
|
|
|
1
|
|
1056
|
use lib "$FindBin::Bin/../perllib"; |
|
|
1
|
|
|
|
|
896
|
|
|
|
1
|
|
|
|
|
9
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1483
|
use Test::More; |
|
|
1
|
|
|
|
|
23114
|
|
|
|
1
|
|
|
|
|
11
|
|
|
11
|
1
|
|
|
1
|
|
984
|
use Arch::Util qw(is_tla_functional); |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
2481
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
50
|
|
|
|
6
|
plan skip_all => "No functional arch backend" unless is_tla_functional; |
|
14
|
0
|
|
|
|
|
0
|
plan tests => 15; |
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
0
|
use_ok("Arch::Tree"); |
|
17
|
0
|
|
|
|
|
0
|
use_ok("Arch::Util", "run_tla", "save_file"); |
|
18
|
0
|
|
|
|
|
0
|
use_ok("Arch::Backend", "has_archive_setup_cmd"); |
|
19
|
0
|
|
|
|
|
0
|
use_ok("Arch::TempFiles"); |
|
20
|
0
|
|
|
|
|
0
|
use_ok("Arch::Session"); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# setup testing environment |
|
23
|
0
|
|
|
|
|
0
|
my $TEMP = Arch::TempFiles->new; |
|
24
|
0
|
|
|
|
|
0
|
my $TEMP_DIR = $TEMP->dir; |
|
25
|
0
|
0
|
0
|
|
|
0
|
die "Internal: Arch::TempFiles::dir didn't create dir\n" |
|
26
|
|
|
|
|
|
|
unless $TEMP_DIR && -d $TEMP_DIR; |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
0
|
$ENV{HOME} = $TEMP_DIR; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub run_tla0 (@) { |
|
31
|
0
|
|
|
0
|
|
|
run_tla(@_); |
|
32
|
0
|
0
|
|
|
|
|
fail(), die "'tla " . join(" ", @_) . "' failed: $?\n" if $?; |
|
33
|
0
|
|
|
|
|
|
pass(); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
0
|
my $arch_id = 'Arch Perl '; |
|
37
|
0
|
|
|
|
|
0
|
my $arch_archive = 'arch-perl@example.com--test'; |
|
38
|
0
|
|
|
|
|
0
|
my $arch_version = 'ex--ample--0'; |
|
39
|
0
|
|
|
|
|
0
|
my $arch_fqv = "$arch_archive/$arch_version"; |
|
40
|
0
|
|
|
|
|
0
|
my $arch_archdir = "$TEMP_DIR/archive"; |
|
41
|
0
|
|
|
|
|
0
|
my $arch_projdir = "$TEMP_DIR/project"; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# create archive |
|
44
|
0
|
|
|
|
|
0
|
run_tla0("my-id", $arch_id); |
|
45
|
0
|
|
|
|
|
0
|
run_tla0("make-archive", $arch_archive, $arch_archdir); |
|
46
|
0
|
0
|
|
|
|
0
|
SKIP: { |
|
47
|
0
|
|
|
|
|
0
|
skip("this arch backend has no archive-setup", 1) if !has_archive_setup_cmd(); |
|
48
|
0
|
|
|
|
|
0
|
run_tla0("archive-setup", $arch_fqv); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# setup project |
|
52
|
0
|
|
|
|
|
0
|
mkdir($arch_projdir, 0777); |
|
53
|
0
|
|
|
|
|
0
|
run_tla0("init-tree", "-d", $arch_projdir); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# initial import |
|
56
|
0
|
|
|
|
|
0
|
my $tree = Arch::Tree->new($arch_projdir); |
|
57
|
0
|
|
|
|
|
0
|
ok($tree->add_log_version($arch_fqv) == 0, "add log version"); |
|
58
|
0
|
|
|
|
|
0
|
ok($tree->set_version($arch_fqv) == 0, "set tree version"); |
|
59
|
0
|
|
|
|
|
0
|
ok($tree->import($arch_fqv) == 0, "import"); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# change something |
|
62
|
0
|
|
|
|
|
0
|
save_file("$arch_projdir/somefile", 'some content'); |
|
63
|
0
|
|
|
|
|
0
|
ok($tree->add('somefile') == 0, "add file"); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# check changes |
|
66
|
0
|
|
|
|
|
0
|
my @changes = $tree->get_changes(); |
|
67
|
0
|
|
|
|
|
0
|
ok(@changes, "changes"); |
|
68
|
0
|
|
|
|
|
0
|
eq_hash( |
|
69
|
|
|
|
|
|
|
$changes[0], |
|
70
|
|
|
|
|
|
|
{ |
|
71
|
|
|
|
|
|
|
type => 'A', |
|
72
|
|
|
|
|
|
|
old_path => undef, |
|
73
|
|
|
|
|
|
|
new_path => 'somefile' |
|
74
|
|
|
|
|
|
|
}, |
|
75
|
|
|
|
|
|
|
"change entry" |
|
76
|
|
|
|
|
|
|
); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# commit |
|
79
|
0
|
|
|
|
|
0
|
ok($tree->commit({ summary => 'nothing much'}) == 0, "commit"); |