You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Steve Cohen <sc...@javactivity.org> on 2010/12/01 19:31:08 UTC

pattern for specifying svn:ignore for files without extension

The build process of the application I am bringing under svn creates a 
number of unix binary executables that have no extension : for example

abcde
fghqp

etc.

I believe that * will match any files with or without periods so it 
isn't suitable.  Is there a pattern specifier that would embrace all 
files without an extension?

Alternatively, one common differentiating aspect of these files is that 
they have executable privileges.  Being able to svn:ignore based on this 
would be a nice feature to have.




Re: pattern for specifying svn:ignore for files without extension

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Dec 2, 2010, at 08:43, Luke Imhoff wrote:
> On Thu, 2010-12-02 at 00:31 -0600, Daniel Shahaf wrote:
>> svn:ignore patterns are apr_fnmatch() patterns, and apr_fnmatch() does
>> accept regex-like [a-z] expressions in its patterns, so you could try
>> 
>> [a-z][a-z][a-z][a-z][a-z]
>> 
>> to ignore all 5-lowercase-character filenames.  :-)
> 
> If it accepts regex,

It doesn't. Daniel said it accepts "regex-like ... expressions". In fact, looking at the source code, I would rather say that it accepts glob-like expressions. The comments at the top of the function in the source code have all the details about the syntax that is supported:

http://apr.apache.org/docs/apr/1.3/apr__fnmatch_8h-source.html#l00067


> why not just use the original criteria where it
> excludes extensions:
> 
> [^.]*


In particular, the syntax described states that "*" matches "zero or more characters". It does not mean, as it does in regular expression syntax, "zero or more of the preceding". So I don't think what you describe is possible to do with the available syntax.


Re: pattern for specifying svn:ignore for files without extension

Posted by Luke Imhoff <lu...@cray.com>.
On Thu, 2010-12-02 at 00:31 -0600, Daniel Shahaf wrote:
> Ryan Schmidt wrote on Wed, Dec 01, 2010 at 13:33:50 -0600:
> > 
> > On Dec 1, 2010, at 13:31, Steve Cohen wrote:
> > 
> > > The build process of the application I am bringing under svn creates a number of unix binary executables that have no extension : for example
> > > 
> > > abcde
> > > fghqp
> > > 
> > > etc.
> > > 
> > > I believe that * will match any files with or without periods so it isn't suitable.  Is there a pattern specifier that would embrace all files without an extension?
> > 
> > I can't think of a way to do that.
> > 
> 
> svn:ignore patterns are apr_fnmatch() patterns, and apr_fnmatch() does
> accept regex-like [a-z] expressions in its patterns, so you could try
> 
> [a-z][a-z][a-z][a-z][a-z]
> 
> to ignore all 5-lowercase-character filenames.  :-)

If it accepts regex, why not just use the original criteria where it
excludes extensions:

[^.]*

That should exclude '.' from being a character anywhere in the filename
if I'm reading the comment at
http://apr.apache.org/docs/apr/1.3/apr__fnmatch_8h-source.html correctly

If it was a full regex, then you might have to do [^\.]* since '.' would
be a special character then.

> 
> > 
> > > Alternatively, one common differentiating aspect of these files is that they have executable privileges.  Being able to svn:ignore based on this would be a nice feature to have.
> > 
> > Unfortunately that feature doesn't exist either.
> > 
> > 


Re: pattern for specifying svn:ignore for files without extension

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Ryan Schmidt wrote on Wed, Dec 01, 2010 at 13:33:50 -0600:
> 
> On Dec 1, 2010, at 13:31, Steve Cohen wrote:
> 
> > The build process of the application I am bringing under svn creates a number of unix binary executables that have no extension : for example
> > 
> > abcde
> > fghqp
> > 
> > etc.
> > 
> > I believe that * will match any files with or without periods so it isn't suitable.  Is there a pattern specifier that would embrace all files without an extension?
> 
> I can't think of a way to do that.
> 

svn:ignore patterns are apr_fnmatch() patterns, and apr_fnmatch() does
accept regex-like [a-z] expressions in its patterns, so you could try

[a-z][a-z][a-z][a-z][a-z]

to ignore all 5-lowercase-character filenames.  :-)

> 
> > Alternatively, one common differentiating aspect of these files is that they have executable privileges.  Being able to svn:ignore based on this would be a nice feature to have.
> 
> Unfortunately that feature doesn't exist either.
> 
> 

Re: pattern for specifying svn:ignore for files without extension

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Steve Cohen wrote on Wed, Dec 01, 2010 at 17:40:12 -0600:
> On 12/01/2010 03:33 PM, Ryan Schmidt wrote:
>> On Dec 1, 2010, at 15:19, Steve Cohen wrote:
>>
>>> It seems to me that
>>> 	svn --recursive propset svn:ignore xyz
>>>
>>> is basically just syntactic sugar for manually going through issuing
>>> 	svn propset svn:ignore xyz
>>>
>>> on every node of the directory structure,  It is syntactic sugar in the sense that the end product in either case would be the same.  There is no "recursive" data attribute in a project's svn:ignore tree.
>>
>> Yes, that's right.
>>
>>
>>> Which leads me to think that a one-time shell script or python script or whatever might be written to walk the directory tree, look for all the executable files and manually add them to that directory's svn:ignore list.
>>
>> That should work.
>>
>> The other approach that initially occurred to me was to clean the directory so there are no unversioned files ("make clean" perhaps), then build the software ("make"), then copy the output of "svn status" into an editor and massage it a bit to turn it into something you can hand to "svn propset svn:ignore --file". Though this would have to be done on a per-directory basis, so if there are many directories involved this may be impractical and a script as you suggest may do better.
>>
>>
>>
>>
> Thanks for confirming, this should work, but one more question.
> I've already got some other files in svn:ignore in each directory. There 
> is no command to append a name to the svn:ignore property.  So my script 
> would have to call
> 	svn propget svn:ignore
> and then
> 	svn propset svn:ignore
> appending the list, right?
>
>

svn propedit --editor-cmd foo.sh
where foo.sh gets some filename as argv[1] and appends to it.

Re: pattern for specifying svn:ignore for files without extension

Posted by Steve Cohen <sc...@javactivity.org>.
On 12/01/2010 03:33 PM, Ryan Schmidt wrote:
> On Dec 1, 2010, at 15:19, Steve Cohen wrote:
>
>> It seems to me that
>> 	svn --recursive propset svn:ignore xyz
>>
>> is basically just syntactic sugar for manually going through issuing
>> 	svn propset svn:ignore xyz
>>
>> on every node of the directory structure,  It is syntactic sugar in the sense that the end product in either case would be the same.  There is no "recursive" data attribute in a project's svn:ignore tree.
>
> Yes, that's right.
>
>
>> Which leads me to think that a one-time shell script or python script or whatever might be written to walk the directory tree, look for all the executable files and manually add them to that directory's svn:ignore list.
>
> That should work.
>
> The other approach that initially occurred to me was to clean the directory so there are no unversioned files ("make clean" perhaps), then build the software ("make"), then copy the output of "svn status" into an editor and massage it a bit to turn it into something you can hand to "svn propset svn:ignore --file". Though this would have to be done on a per-directory basis, so if there are many directories involved this may be impractical and a script as you suggest may do better.
>
>
>
>
Thanks for confirming, this should work, but one more question.
I've already got some other files in svn:ignore in each directory. 
There is no command to append a name to the svn:ignore property.  So my 
script would have to call
	svn propget svn:ignore
and then
	svn propset svn:ignore
appending the list, right?


Re: pattern for specifying svn:ignore for files without extension

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Dec 1, 2010, at 15:19, Steve Cohen wrote:

> It seems to me that
> 	svn --recursive propset svn:ignore xyz
> 
> is basically just syntactic sugar for manually going through issuing
> 	svn propset svn:ignore xyz
> 
> on every node of the directory structure,  It is syntactic sugar in the sense that the end product in either case would be the same.  There is no "recursive" data attribute in a project's svn:ignore tree.

Yes, that's right.


> Which leads me to think that a one-time shell script or python script or whatever might be written to walk the directory tree, look for all the executable files and manually add them to that directory's svn:ignore list.

That should work.

The other approach that initially occurred to me was to clean the directory so there are no unversioned files ("make clean" perhaps), then build the software ("make"), then copy the output of "svn status" into an editor and massage it a bit to turn it into something you can hand to "svn propset svn:ignore --file". Though this would have to be done on a per-directory basis, so if there are many directories involved this may be impractical and a script as you suggest may do better.


Re: pattern for specifying svn:ignore for files without extension

Posted by Steve Cohen <sc...@javactivity.org>.
On 12/01/2010 02:08 PM, Ryan Schmidt wrote:
> Redirecting this discussion back to the mailing list......
>
>
> On Dec 1, 2010, at 14:05, Steve Cohen wrote:
>> On 12/01/2010 01:38 PM, Ryan Schmidt wrote:
>>> Can you have the build process write its files to a different directory (a "build" directory) that you could svn:ignore everything in?
>>>
>>
>> Sadly, no, not without a major rewrite of the build process.  This is deep legacy stuff, using make, with the typical pattern of mixing source and object in the same directory.  Not the way I would have designed it but ...
>
> Then you may have to set an svn:ignore for each file you want to ignore.
>
>
>

It seems to me that
	svn --recursive propset svn:ignore xyz

is basically just syntactic sugar for manually going through issuing
	svn propset svn:ignore xyz

on every node of the directory structure,  It is syntactic sugar in the 
sense that the end product in either case would be the same.  There is 
no "recursive" data attribute in a project's svn:ignore tree.

Which leads me to think that a one-time shell script or python script or 
whatever might be written to walk the directory tree, look for all the 
executable files and manually add them to that directory's svn:ignore list.


Re: pattern for specifying svn:ignore for files without extension

Posted by Ryan Schmidt <su...@ryandesign.com>.
Redirecting this discussion back to the mailing list......


On Dec 1, 2010, at 14:05, Steve Cohen wrote:
> On 12/01/2010 01:38 PM, Ryan Schmidt wrote:
>> Can you have the build process write its files to a different directory (a "build" directory) that you could svn:ignore everything in?
>> 
> 
> Sadly, no, not without a major rewrite of the build process.  This is deep legacy stuff, using make, with the typical pattern of mixing source and object in the same directory.  Not the way I would have designed it but ...

Then you may have to set an svn:ignore for each file you want to ignore.

Re: pattern for specifying svn:ignore for files without extension

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Dec 1, 2010, at 13:33, Ryan Schmidt wrote:

> On Dec 1, 2010, at 13:31, Steve Cohen wrote:
> 
>> The build process of the application I am bringing under svn creates a number of unix binary executables that have no extension : for example
>> 
>> abcde
>> fghqp
>> 
>> etc.
>> 
>> I believe that * will match any files with or without periods so it isn't suitable.  Is there a pattern specifier that would embrace all files without an extension?
> 
> I can't think of a way to do that.

Can you have the build process write its files to a different directory (a "build" directory) that you could svn:ignore everything in?


Re: pattern for specifying svn:ignore for files without extension

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Dec 1, 2010, at 13:31, Steve Cohen wrote:

> The build process of the application I am bringing under svn creates a number of unix binary executables that have no extension : for example
> 
> abcde
> fghqp
> 
> etc.
> 
> I believe that * will match any files with or without periods so it isn't suitable.  Is there a pattern specifier that would embrace all files without an extension?

I can't think of a way to do that.


> Alternatively, one common differentiating aspect of these files is that they have executable privileges.  Being able to svn:ignore based on this would be a nice feature to have.

Unfortunately that feature doesn't exist either.