update readmes
[git-darcs-import.git] / tests / missed_resolution.pl
blobfbf71f565bf9fe471154e8bfdad3b588a958e148
1 #!/usr/bin/env perl
3 # A test for a missed resolution, inspired by bug #10 in RT
5 use lib 'lib/perl';
6 use Test::More 'no_plan';
7 use strict;
8 use Test::Darcs;
9 use Shell::Command;
10 use File::Temp 'tempdir';
11 my $work_dir = tempdir( CLEANUP => 1 );
12 chdir $work_dir;
15 for my $dir (qw/tmp1 tmp2/) {
16 cleanup($dir);
17 mkpath("$dir/") || die "couldn't mkpath: $!";
18 chdir $dir || die;
19 darcs 'init';
20 chdir '../';
23 sub writeLines {
24 my $content = shift;
25 open(A,">A");
26 print A $content;
27 close A;
30 chdir 'tmp1';
31 writeLines ("i\n\nm\nb\nv\n");
33 darcs "add A";
34 darcs "record -m 'add' --all";
36 chdir '../tmp2';
38 darcs "pull --all ../tmp1";
39 writeLines ("J\ni\n\nC2\n\nm\nD\nb\nv\n");
40 darcs "record -m 'change2' --all";
42 chdir '../tmp1';
44 writeLines ("I\ni\n\nC1\n\nm\nb\n");
46 darcs "record -m 'change1' --all";
48 darcs "pull --all ../tmp2";
50 # we should have a marked conflict now.
51 # we resolve it simply by removing conflict markers.
53 # I'm too lazy to translate this to Perl right now.
54 `grep -v '\(\^ \^\|\*\*\|v v\)' A > tmp`;
55 mv('tmp','A');
57 darcs "record -m 'mark-conflicts' --all";
59 # now resolve shouldn't find any unresolved conflicts
60 like( darcs('resolve'), qr/No conflicts to mark/, 'darcs finds no conflicts to mark');