1#!/usr/bin/perl -w
2
3use strict;
4
5use Test::More tests => 5;
6use File::Path;
7use Cwd;
8use SVK::Test;
9
10my ($xd, $svk) = build_test();
11our $output;
12my ($copath, $corpath) = get_copath();
13my (undef, undef, $repos) = $xd->find_repos ('//', 1);
14my $uuid = $repos->fs->get_uuid;
15
16$svk->mkdir ('-m', 'trunk', '//trunk');
17$svk->checkout ('//', $copath);
18
19# ok, we add A/a_file and commit as rev2 and play with it
20
21is_output($svk, 'mkdir', [__"$copath/A"],
22    [
23        __"A   $copath/A",
24    ]
25);
26overwrite_file(__"$copath/A/a_file", "a file\n");
27is_output($svk, 'add', [__"$copath/A/a_file"],
28    [
29        __"A   $copath/A/a_file",
30    ]
31);
32is_output($svk, 'ci', ['-m', 'add file and dir', __"$copath"],
33    [
34        "Committed revision 2.",
35    ]
36);
37
38# desc command
39{
40    is_output($svk, 'desc', ['2', '//trunk'],
41        [
42            '----------------------------------------------------------------------',
43            qr/^r2:.*/,
44            '',
45            'add file and dir',
46            '----------------------------------------------------------------------',
47            "=== A\t(new directory)",
48            "==================================================================",
49            "=== A/a_file",
50            "==================================================================",
51            "--- A/a_file\t(revision 1)",
52            "+++ A/a_file\t(revision 2)",
53            "@@ -0,0 +1 @@",
54            "+a file",
55        ]
56    );
57}
58
59# diff command
60{
61    TODO: { local $TODO = 'even simple diff doesnt work :(';
62    is_output($svk, 'di', ['-r', '1:2', '//trunk'],
63        [
64            __"=== A\t(new directory)",
65            __"==================================================================",
66            __"=== A/a_file",
67            __"==================================================================",
68            __"--- A/a_file\t(revision 1)",
69            __"+++ A/a_file\t(local)",
70            __"@@ -0,0 +1 @@",
71            __"+a file",
72        ]
73    );
74    }
75}
76
77