1#!/usr/bin/perl -w
2use strict;
3use SVK::Test;
4plan tests => 7;
5our $output;
6
7my ($xd, $svk) = build_test('test');
8
9$svk->mkdir(-m => 'trunk', '/test/trunk');
10$svk->mkdir(-m => 'trunk', '/test/branches');
11$svk->mkdir(-m => 'trunk', '/test/tags');
12my $tree = create_basic_tree($xd, '/test/trunk');
13
14my $depot = $xd->find_depot('test');
15my $uri = uri($depot->repospath);
16
17$svk->mirror('//mirror/MyProject', $uri);
18$svk->sync('//mirror/MyProject');
19
20$svk->cp(-m => 'branch Foo', '//mirror/MyProject/trunk', '//mirror/MyProject/branches/Foo');
21
22my ($copath, $corpath) = get_copath('bm-local');
23
24$svk->checkout('//mirror/MyProject/trunk', $copath);
25
26chdir($copath);
27
28is_output_like ($svk, 'branch', ['--create', 'feature/foobar', '--local'],
29    qr'Project branch created: feature/foobar \(in local\)');
30
31is_output($svk, 'br', ['-l', '--local', '//mirror/MyProject'],
32          ['feature/foobar']);
33
34# switch back
35$svk->br('--switch', 'trunk');
36is_output_like ($svk, 'info', [],
37   qr|Depot Path: //mirror/MyProject/trunk|);
38
39$svk->br('--switch', 'feature/foobar', '--local');
40is_output_like ($svk, 'info', [],
41   qr|Depot Path: //local/MyProject/feature/foobar|);
42
43$svk->branch ('--create', 'localfoo', '--switch-to', '--local');
44append_file ('B/S/Q/qu', "\nappend CBA on local branch localfoo\n");
45$svk->commit ('-m', 'commit message','');
46
47my $trunk = '/mirror/MyProject/trunk';
48is_output ($svk, 'branch', ['--push', '-C'],
49    ["Auto-merging (0, 10) /local/MyProject/localfoo to $trunk (base $trunk:6).",
50     "===> Auto-merging (0, 9) /local/MyProject/localfoo to $trunk (base $trunk:6).",
51     "Empty merge.",
52     "===> Auto-merging (9, 10) /local/MyProject/localfoo to $trunk (base $trunk:6).",
53     'U   B/S/Q/qu',
54     qr'New merge ticket: [\w\d-]+:/local/MyProject/localfoo:10']);
55is_output ($svk, 'branch', ['--push'],
56    ["Auto-merging (0, 10) /local/MyProject/localfoo to $trunk (base $trunk:6).",
57     "===> Auto-merging (0, 9) /local/MyProject/localfoo to $trunk (base $trunk:6).",
58     "Merging back to mirror source $uri.",
59     "Empty merge.",
60     "===> Auto-merging (9, 10) /local/MyProject/localfoo to $trunk (base $trunk:6).",
61     "Merging back to mirror source $uri.",
62     'U   B/S/Q/qu',
63     qr'New merge ticket: [\w\d-]+:/local/MyProject/localfoo:10',
64     "Merge back committed as revision 7.",
65     "Syncing $uri",
66     "Retrieving log information from 7 to 7",
67     "Committed revision 11 from revision 7."]);
68
69is_output ($svk, 'branch', ['--list', '--local'],
70    ["feature/foobar","localfoo"]);
71