[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Recursive client operations not intuitive

From: Norbert Unterberg <nepo_at_gmx.net>
Date: 2004-08-01 10:40:06 CEST

Branko Čibej <brane <at> xbc.nu> writes:

> > In this case they are used to filter
> >file names within subdirectories, too.
>
> I'd like to see proof of that. I don't believe it.

I have to apologise.

I have created a small test case and tried to verify all this again. You are
right, the wildcards are not expanded within subdirectories. However, I find the
behaviour still some kind of weird, but it is beginning to make sense to me.

This is an example script:

svn mkdir test
cd test
svn mkdir dir.txt
echo test1 > test1.txt
echo test1 > test1.bla
echo test2 > dir.txt\test2.txt
echo test2 > dir.txt\test2.bla
svn add *.*
svn add dir.txt\*.*
svn ci -m "test dir"

This creates a demo directory structure, where "svn ls -R" reports
dir.txt/
dir.txt/test2.bla
dir.txt/test2.txt
test1.bla
test1.txt

Try this: "svn ls"
dir.txt/
test1.bla
test1.txt

But now "svn ls *.txt" and "svn ls -R *.txt" both do this:
test2.bla
test2.txt
test1.txt

Without understanding svn internals, I would have expexted
"svn ls *.txt"
   dir.txt/
   test1.txt
because a "dir /b *.txt" also gives me
   dir.txt
   test1.txt

and "svn ls -R *.txt"
   dir.txt/ (<-- we can talk about this one...)
   dir.txt/test2.txt
   test1.txt

as does "dir /s/b *.txt"
   dir.txt
   test1.txt
   dir.txt\test2.txt

Ok lets stop here, I think I am might be starting to count beans ...

I want to go back to the original topic. When I want to perform an operation on
my project tree, I usally want to perform the operation either on a set of files
(like removing *.bak in all directories), or on a set of directories (like
setting the property svn:ignore). Both operations are recursive. I for myself
dustinguish clearly if the operation is targeting a set of directories or files.
But I have no way telling svn the target type. svn allows recursive operations
on single files (not complaining about -R when target is a file), and it
operates also on files when my intent is to work recursively only on directores.
svn only distiguishes files from directories in a very implicit way, like not
setting an svn:ignore property on a file. The only thing the user can do is not
to name dirctories and files the same way (which is not always possible due to
rules of some development systems).

To summarize: From my (windows biased) point of view, I think the way svn
currently handles wildcards and recursion is not optimal. It is your decision if
this is the correct and planned behaviour, or if this is an issue that might be
improved. I can live with it now I think I have understood.

How about some additional sentences in the manual, something like this:

--recursive (-R)
Makes a subcommand recurse into subdirectories, only if the target is a
directory. Ignored if the target is a file. Care must be taken if the target is
a wildcard that matches directories and files because the subcommand is applied
to all matching files and directories individually.
Most subcommands recurse by default.

Norbert

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Aug 1 10:41:00 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.