File: missed_resolution.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 (61 lines) | stat: -rw-r--r-- 1,251 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
#!/usr/bin/env perl

# A test for a missed resolution, inspired by bug #10 in RT

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;


for my $dir (qw/tmp1 tmp2/) {
    cleanup($dir);
    mkpath("$dir/") || die "couldn't mkpath: $!";
    chdir $dir || die;
    darcs 'init';
    chdir '../';
}

sub writeLines {
    my $content = shift;
    open(A,">A");
    print A $content;
    close A;
} 

chdir 'tmp1';
writeLines ("i\n\nm\nb\nv\n");

darcs "add A";
darcs "record -m 'add' --all";

chdir '../tmp2';

darcs "pull --all ../tmp1";
writeLines ("J\ni\n\nC2\n\nm\nD\nb\nv\n");
darcs "record  -m 'change2' --all";

chdir '../tmp1';

writeLines ("I\ni\n\nC1\n\nm\nb\n");

darcs "record -m 'change1' --all";

darcs "pull --all ../tmp2";

# we should have a marked conflict now.
# we resolve it simply by removing conflict markers.

# I'm too lazy to translate this to Perl right now. 
`grep -v '\(\^ \^\|\*\*\|v v\)' A > tmp`;
mv('tmp','A');

darcs "record -m 'mark-conflicts' --all";

# now resolve shouldn't find any unresolved conflicts
like( darcs('resolve'), qr/No conflicts to mark/, 'darcs finds no conflicts to mark');