From: Ian Lynagh Date: Mon, 25 Aug 2008 14:59:08 +0000 (+0000) Subject: Read the packages file in strictly in darcs-all and push-all X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=29e0999a73665a37c0c3fd311ac961f81c50bb92 Read the packages file in strictly in darcs-all and push-all This fixes a problem where darcs tries to update it while perl has it open. On Windows this fails. Spotted by Claus Reinke. --- diff --git a/darcs-all b/darcs-all index 6c8b406..483cd9d 100644 --- a/darcs-all +++ b/darcs-all @@ -55,9 +55,13 @@ sub darcsall { my $localpath; my $path; my $tag; + my @repos; open IN, "< packages" or die "Can't open packages file"; - while () { + @repos = ; + close IN; + + foreach (@repos) { chomp; if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) { $localpath = $1; @@ -77,7 +81,6 @@ sub darcsall { die "Bad line: $_"; } } - close IN; } sub darcsget { @@ -86,6 +89,7 @@ sub darcsget { my $remotepath; my $path; my $tag; + my @repos; if (! grep /(?:--complete|--partial)/, @_) { warning("adding --partial, to override use --complete"); @@ -96,7 +100,10 @@ sub darcsget { } open IN, "< packages" or die "Can't open packages file"; - while () { + @repos = ; + close IN; + + foreach (@repos) { chomp; if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) { $localpath = $1; @@ -123,7 +130,6 @@ sub darcsget { die "Bad line: $_"; } } - close IN; } sub main { diff --git a/push-all b/push-all index ed825fc..8e9f9f3 100644 --- a/push-all +++ b/push-all @@ -39,9 +39,13 @@ sub pushall { my $remotepath; my $path; my $tag; + my @repos; open IN, "< packages" or die "Can't open packages file"; - while () { + @repos = ; + close IN; + + foreach (@repos) { chomp; if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) { $localpath = $1; @@ -69,7 +73,6 @@ sub pushall { die "Bad line: $_"; } } - close IN; } sub main {