From: Peter Baumann <waste.manager@gmx.de>
To: Alex Bennee <kernel-hacker@bennee.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Make git-cvsexportcommit "status" each file in turn
Date: Wed, 15 Aug 2007 16:04:31 +0200 [thread overview]
Message-ID: <20070815140431.GC4550@xp.machine.xx> (raw)
In-Reply-To: <1187184448.13096.54.camel@murta.transitives.com>
On Wed, Aug 15, 2007 at 02:27:28PM +0100, Alex Bennee wrote:
> Hi,
>
> It turns out CVS doesn't always give the status output in the order
> requested. According to my local CVS gurus this is a known CVS issue.
>
> The attached patch just makes the script check each file in turn. It's
> slower but correct.
>
> I also slightly formatted the warn output when it detects problems as
> multiple line wraps with long file paths where making my eyes bleed :-)
>
I inlined the patch for easier commenting. Please inline further
patches.
> ---
> git-cvsexportcommit.perl | 30 ++++++++++++++++++++----------
> 1 files changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
> index e9832d2..ee02c56 100755
> --- a/git-cvsexportcommit.perl
> +++ b/git-cvsexportcommit.perl
> @@ -182,15 +182,21 @@ if (@canstatusfiles) {
> my @updated = safe_pipe_capture(@cvs, 'update', @canstatusfiles);
> print @updated;
> }
> - my @cvsoutput;
> - @cvsoutput= safe_pipe_capture(@cvs, 'status', @canstatusfiles);
> - my $matchcount = 0;
> - foreach my $l (@cvsoutput) {
> - chomp $l;
> - if ( $l =~ /^File:/ and $l =~ /Status: (.*)$/ ) {
> - $cvsstat{$canstatusfiles[$matchcount]} = $1;
> - $matchcount++;
> - }
> +
> + # We can't status all the files at once as CVS doesn't gaurentee
> + # that it will output the status bits in the order requested.
> +
> + foreach my $f (@canstatusfiles)
> + {
> + my $cvscmd = join(' ', @cvs)." status $f";
> + my $cvsoutput = `$cvscmd`;
> +
> + # slurp out the status out of the result
> + my ($status) = $cvsoutput =~ m/.*Status: (\S*)/;
> +
> + $opt_v && print "Status of $f is $status\n";
> +
> + $cvsstat{$f} = $status;
> }
> }
>
This is extremly wastefull, because it will spawn a CVS process for each file.
A better fix would be to parse the filename from the output of
'cvs status' and use that as input for $cvsstat.
(And/or you could use an hash instead of an array for 'cvsoutput', so
you could double check that you only get the status for those files you
asked for.)
>
>
> @@ -198,10 +204,14 @@ if (@canstatusfiles) {
> foreach my $f (@afiles) {
> if (defined ($cvsstat{$f}) and $cvsstat{$f} ne "Unknown") {
> $dirty = 1;
> - warn "File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\n";
> + warn "File $f is already known in your CVS checkout.\n"
> + warn " Perhaps it has been added by another user.\n"
> + warn " Or this may indicate that it exists on a different branch.\n"
> + warn " If this is the case, use -f to force the merge.\n";
> warn "Status was: $cvsstat{$f}\n";
> }
> }
> +
> # ... validate known files.
> foreach my $f (@files) {
> next if grep { $_ eq $f } @afiles;
> --
> 1.5.2.3
>
-Peter
next prev parent reply other threads:[~2007-08-15 14:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-15 13:27 [PATCH] Make git-cvsexportcommit "status" each file in turn Alex Bennee
2007-08-15 14:04 ` Peter Baumann [this message]
2007-08-15 16:25 ` Alex Bennee
2007-08-15 19:40 ` Robin Rosenberg
2007-08-15 15:47 ` Alex Bennee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070815140431.GC4550@xp.machine.xx \
--to=waste.manager@gmx.de \
--cc=git@vger.kernel.org \
--cc=kernel-hacker@bennee.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.