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

# Some tests for 'darcs pull', with many files

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

# We need to find GNU tar first (it's for example `gtar' on SunOS)
my $tarcmd = "";
for my $cmd ('tar', 'gtar') {
    my $ver = `/bin/sh -c "${cmd} --version 2>&1"`;
    if (index(${ver}, "GNU") >= 0) {
        $tarcmd = ${cmd};
    }
}

if (${tarcmd} eq "") {
    die ("Cannot find GNU tar");
}

for my $format ('--old-fashioned-inventory','--hashed','--darcs-2') {
    ok( (chdir 'repos'), "$format: chdir repos");

    # This tar call could be replaced by pure Perl for portability, but it would mean shipping several more Perl modules.
    `${tarcmd} -xzf many-files${format}.tgz`;
    chdir '../';
    init_tmp_repo($format);

    like( darcs("pull -a ../repos/many-files${format}"),
        qr/Finished pulling/,
        "$format: pull works on many patches at a time" );

    # put things back how we found them.
    chdir '../';
    `ls -l repos/many-files${format}`;
    rm_rf "repos/many-files${format}";
}