Set initial commit timestamp to be constant.
[git-darcs-import.git] / tests / push.pl
blob1822fb3eda0c040008151a9306daa532b28cf050
1 #!/usr/bin/env perl
3 # Some tests for 'darcs push'
5 use lib 'lib/perl';
6 use Test::More tests => 7;
7 use Test::Darcs;
8 use Shell::Command;
9 use strict;
10 use File::Temp 'tempdir';
11 chdir tempdir( CLEANUP => 1 );
13 mkpath 'temp1';
14 mkpath 'temp2/one/two';
15 chdir 'temp1';
16 darcs 'init';
17 chdir '../temp2';
18 darcs 'init';
19 chdir '../';
22 my $test_name = 'push without a repo gives an error';
23 chdir './temp1';
24 my $out = darcs qw/push -p 123/;
25 like($out,qr/missing argument/i,$test_name);
26 chdir '../';
30 chdir './temp2/one/two';
31 my $test_name = 'darcs push should work relative to the current directory';
32 my $push_out = darcs qw!push -a ../../../temp1!;
33 like($push_out, qr/No recorded local changes to push/i, $test_name);
34 chdir '../../../'; # above temp repos
38 my $test_name = 'darcs push should push into repo specified with --repo';
39 chdir './temp2';
40 darcs 'add one';
41 darcs "record --patch-name 'uno' --all";
42 chdir '../'; # now outside of any repo
44 like(darcs(qw!push --repodir temp2 --all "../temp1"!), # temp2 is relative to temp1
45 qr/Finished apply./i, $test_name);
48 SELF_PUSH: {
49 chdir './temp1';
51 my $default_repo_pre_test = 'Before trying to pull from self, defaultrepo does not exist';
52 ok( (! -r './_darcs/prefs/defaultrepo'),$default_repo_pre_test);
54 my $test_name = 'return special message when you try to push to yourself';
55 use Cwd;
56 like( darcs(qw/push -a/,getcwd()), qr/Can't push to current repository!/i, $test_name);
57 like( darcs(qw/push -a ./), qr/Can't push to current repository!/i, $test_name);
59 my $set_default_repo_test = "and don't update the default repo to be the current dir";
60 ok( (! -r './_darcs/prefs/defaultrepo'),$set_default_repo_test);
62 chdir '../'; # now outside of any repo