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

Re: [non]recursive semantics revisited.

From: RADICS Peter <mitch_at_lbcons.net>
Date: 2001-10-25 22:54:43 CEST

Today I did an
"svn st -uvn subversion" and was a bit surprised:

[mitch@deneb svn]$ svn st -uvn subversion
_ 294 subversion
_ 294 subversion/LICENSE
_ 294 subversion/svn-dev.el
_ 294 subversion/svn-dev.sh
Head revision: 311

my surprise was that all the directories were omitted in the status output.
I think this is wrong. it should show all the directory entries as well.
I spoke to Kevin at length about it on #svn, and found out that it was a direct
consequence of how svn handles non-recursion now (see quoted message).

I believe that this whole issue can be handled with the depth thingy, but
with the addition that a given depth should apply to directory entries as well, not just files, just as if it were a '-maxdepth' parameter to find, like this:

DEPTH=0:
[mitch@deneb svn]$ find doc -maxdepth 0
doc

DEPTH=1:
[mitch@deneb svn]$ find doc -maxdepth 1
doc
doc/.svn
doc/README
doc/svn-doc.el
doc/programmer
doc/user

and DEPTH=infinity is plain
[mitch@deneb svn]$ find doc

(note that doc/programmer and doc/user are dirents)

of course, all the subcommands should work like this, so
$ svn up --depth=0 target_dir
should update the props of target_dir only
$ svn up --depth=1 target_dir
should update the props of target_dir, the file contents/props in target_dir
and all the props of all the immediate child-dirents of target_dir
$ svn up target_dir does the usual thing (full recursion)

I know some people are unconfortable with the --depth=1 case, 'cos it
doesn't fit well with the current implementation (dir props are not
stored in the parent, but in the dir's own .svn area), but I hope this
analogy will help:

given the above semantics, "svn up --depth=1 target_dir" is equivalent to
"svn up --depth=0 target_dir target_dir/*"
now think of "chown a+r target_dir target_dir/*":
it's the same as "svn up --depth=1 target_dir", and the chown _does_
change the props on dirents as well.

hm... what I really wanted to say is: no matter if --depth=0 or
--depth=1 is the "default non-recursive" behavior, but let it not be
something like "--depth=1.5" which excludes directories but not file
entries.

[btw, I think the default non recursive flag should mean --depth=1, but
 we still need --depth=0 sometimes... probly -n should be --depth=1 and
 -N be --depth=0, but this is not the main point of this mail]

waiting for comments,
mitch

On Wed, Oct 24, 2001 at 07:24:20PM +0900, Yoshiki Hayashi wrote:
> Kevin Pilch-Bisson <kevin@pilch-bisson.net> writes:
>
> > We had previously agreed that the semantics of non-recursive for directories
> > would be:
> >
> > run command on dir and all file entries in dir. Do nothing with dirs.
> >
> > I would like to make an ammendment to that. Consider property subcommands, and
> > the revert command. That would mean that there is no way to run a property
> > or revert command on just a directory, which I think is bogus. So I thought
> > of this proposal.
> >
> > 1) For commands that are recursive by default (checkout, import, update, etc),
> > use the behaviour described above.
> >
> > 2) For commands that are _nonrecursive_ by default (plist, pget, pset, pdel,
> > revert) run command only on dir.
> >
> > This would mean that svn revert [.], would revert only property changes on .,
> > but that you could revert everything in the current dir with svn revert *.
> > Similarly with property commands, i.e. svn pset blah "some value" would set
> > the property only on the current dir.
>
> It might be useful to expose "depth" concept described in
> svn_wc.h to command line option.
>
> The WebDAV concept of "depth" may be useful in understanding the
> motivation behind this. Suppose we're getting the status of
> directory D. The three depth levels would mean
>
> depth 0: D itself (just the named directory)
> depth 1: D and its immediate children (D + its entries)
> depth Infinity: D and all its descendants (full recursion)
>
> Then user will have full control over how the given command
> should recurse. Recursive and nonrecursive will be an alias
> to one of them depending on the nature of the command as you
> described. I think I'll just type svn revert . * instead of
> svn --depth 1 revert, though. :-)
>
> --
> Yoshiki Hayashi

-- 
// RADICS Peter <mitch_at_lbcons.net> (http://lbcons.net)
//
// "If human beings don't keep exercising their lips, 
//  their brains start working." -- Ford Prefect
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:45 2006

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.