Set initial commit timestamp to be constant.
[git-darcs-import.git] / tests / changes.pl
blob247c3bf0c2f7fe0d6a4b2aa2257158e14794bb25
1 #!/usr/bin/env perl
3 # Some tests for 'darcs changes'
5 use lib 'lib/perl';
6 use Test::More 'no_plan';
7 use Test::Darcs;
8 use Shell::Command;
9 use strict;
11 init_tmp_repo();
13 my $test_name = 'record something';
15 `date >> date.t`;
16 darcs 'add date.t';
18 like(darcs(q(record -A 'Mark Stosberg <a@b.com>' -a -m foo date.t)), qr/finished recording/i, $test_name);
20 ####
22 like(darcs(q(changes date.t)), qr/foo/,'changes file.txt: trivial case works');
23 like(darcs(q(changes --last=1 date.t)), qr/foo/,'changes --last=1 file.txt');
24 like(darcs(q(changes --last=1 --summary date.t)),qr/foo/,'changes --last=1 --summary file.txt');
25 like(darcs(q(changes --last=1 --xml )), qr/&lt;a\@b.com&gt;/,'changes --last=1 --xml encodes < and >');
27 ###
29 # Add 50 records and try again
30 for (my $i = 0; $i <= 5; $i++) {
31 `date >> date.t`;
32 my $out = darcs(qq(record -a -m "foo record num $i" date.t));
33 like( $out, qr/Finished record/i, "foo record num $i: success");
36 like(darcs(q(changes date.t)), qr/foo/,'after 50 records: changes file.txt: trivial case works');
37 like(darcs(q(changes --last=1 date.t)), qr/foo/,'after 50 records: changes --last=1 file.txt');
38 like(darcs(q(changes --last=1 --summary date.t)),qr/foo/,'after 50 records: changes --last=1 --summary file.txt');
40 ###
43 like(darcs(q(changes --context --from-patch='num 1' --to-patch='num 4')),
44 qr/^\n.*\n\n.*num 4\n.*\n\n.*num 3\n.*\n\n.*num 2\n.*\n\n.*num 1\n.*\n$/,
45 'changes --context --from-patch="num 1$" --to-patch="num 4$"');
47 ###
49 `date >>second_file.t`;
50 darcs 'add second_file.t';
51 like(darcs(q(record -a -m adding_second_file second_file.t)), qr/finished recording/i, 'recorded second file');