File: mark-conflicts.pl

package info (click to toggle)
darcs 2.0.2-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 6,400 kB
  • ctags: 1,048
  • sloc: haskell: 24,937; perl: 9,736; sh: 3,369; ansic: 1,913; makefile: 17; xml: 14
file content (74 lines) | stat: -rw-r--r-- 1,568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env perl

# Automated tests for "darcs mark-conflicts". 

use lib 'lib/perl';
use Test::More 'no_plan';
use strict;
use Test::Darcs;
use Shell::Command;
use File::Temp 'tempdir';

my $work_dir = tempdir( CLEANUP => 1 );
chdir $work_dir;

mkpath 'temp1';
chdir 'temp1';

like( darcs('init'), qr/^$/i, 'initialized repo');
open(F, ">_darcs/prefs/author") || die;
print F "Tester";
close(F);

open(F, ">child_of_conflict") || die;
print F "Conflict, Base .";
close(F);

darcs("add child_of_conflict");
like( darcs("record -am 'Conflict Base'"), qr/finished/i);
like( darcs("get . ../temp2"), qr/finished/i);

chdir '../';

# Add and record differing lines to both repos
for my $repo (1,2) {
    chdir "temp".$repo;

    open(F, ">child_of_conflict") || die;
    print F "Conflict, Part $repo.";
    close(F);

    like( darcs("record -A author -am 'Conflict Part $repo'"), qr/finished/i);

    chdir '../';
}

chdir './temp1';
my $pull_out = darcs("pull -a ../temp2");
like($pull_out, qr/conflict/i);
like($pull_out, qr/finished/i);

{
    open(F, "<child_of_conflict") || die;
    my $line = <F>;
    close(F);
    like($line, qr/v v/, 'found conflict markers');
}

like( darcs("revert -a"), qr/finished/i, 'conflicts reverted');

{
    open(F, "<child_of_conflict") || die;
    my $line = <F>;
    close(F);
    unlike($line, qr/v v/, 'conflict markers are gone');
}

darcs("mark-conflicts");

{
    open(F, "<child_of_conflict") || die;
    my $line = <F>;
    close(F);
    like($line, qr/v v/, 'found conflict markers after revert and mark-conflicts');
}