You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Jaap DeHaan <Ja...@alpine-research.de> on 2008/01/09 08:33:08 UTC

[PATCH] Fix in Client Side Contrib Tool: svn-clean

This patch fixes two small issues in one svn contribution: svn-clean perl 
script.
1- A problem with array initialization 
2- A bigger issue concerning the processing of files and directories with 
whitespaces in their names.
Hope you like it :-)

[[[
* contrib/client-side/svn-clean:
    - J. de Haan: Fixed array initialization
    - J. de Haan: Fixed bug on processing files and directories with 
whitespaces in name
]]]

------------ BEGIN
Index: svn-clean
===================================================================
--- svn-clean   (revision 28581)
+++ svn-clean   (working copy)
@@ -28,7 +28,7 @@
 
 my $CWD = getcwd;
 
-my @exclude      = "";
+my @exclude      = ();
 my $force        = 0;
 my $quiet        = 0;
 my $print        = 0;
@@ -83,7 +83,9 @@
     }
   LINE: while (<SVN>) {
         if (/^([\?ID])/) {
-            my $file = (split)[-1];
+               chomp;
+            my $file = $_;
+            $file =~ s!\?\s*!!;
             foreach my $ex (@exclude) {
                 if ( $file =~ $ex ) {
                     print "excluded $file\n" unless $quiet or $print;
------------ END

Best Regards,

  Jaap de Haan
  Software Quality Assurance Engineer
  QM Group
______________________________________________________________________

  Alpine Electronics R&D Europe GmbH, Vor dem Lauch 14, 70567 Stuttgart
  Geschäftsführer: Hitoshi Kajiwara, Masana Minami, Satoshi Soma, Kazuo 
Nakamura, Shigehiro Inoue, Katsumi Miyake
  Registergericht: Amtsgericht Stuttgart, Handelsregisternummer: 25265
  St.-Nr.: 99031/23688, USt-ID-Nr: DE 814380762

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: [PATCH] Fix in Client Side Contrib Tool: svn-clean

Posted by Julian Foad <ju...@btopenworld.com>.
Jaap DeHaan wrote:
> This patch fixes two small issues in one svn contribution: svn-clean perl 
> script.
> 1- A problem with array initialization 
> 2- A bigger issue concerning the processing of files and directories with 
> whitespaces in their names.
> Hope you like it :-)
> 
> [[[
> * contrib/client-side/svn-clean:
>     - J. de Haan: Fixed array initialization
>     - J. de Haan: Fixed bug on processing files and directories with 
> whitespaces in name
> ]]]

Jaap,

Thanks for the patch.

> ------------ BEGIN
> Index: svn-clean
> ===================================================================
> --- svn-clean   (revision 28581)
> +++ svn-clean   (working copy)
> @@ -28,7 +28,7 @@
>  
>  my $CWD = getcwd;
>  
> -my @exclude      = "";
> +my @exclude      = ();

That's fine and I have committed it in r29056. I believe it was not causing any 
malfunction, and have said so in the commit message. Tell me if I am wrong.

>  my $force        = 0;
>  my $quiet        = 0;
>  my $print        = 0;
> @@ -83,7 +83,9 @@
>      }
>    LINE: while (<SVN>) {
>          if (/^([\?ID])/) {
> -            my $file = (split)[-1];
> +               chomp;
> +            my $file = $_;
> +            $file =~ s!\?\s*!!;

I think there is a small problem with this part.

The line accepted by "if (/^([\?ID])/)" can be in one of these three forms:
[[[
?                                       file1
I                                       file2
D            1335      115 julianfoad   file3
]]]

Your substitution "$file =~ s!\?\s*!!;" only does the right thing with a line 
starting with "?". You could easily extend it to do the same for a line 
starting with "I", but I don't know how to make it work correctly with the line 
starting with "D", because the exact number of fields and characters vary on 
different lines and in different versions of Subversion.

Maybe you could modify the program so that it does not need to extract the file 
name from a line starting with "D"? I do not know if this is possible.

A better way would be to use "svn status --xml" but that would be a much bigger 
change.

Regards,
- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org