Re: [Monotone-devel] restrictions: disabling recursion

2008-03-02 Thread Zack Weinberg
On Sun, Mar 2, 2008 at 1:18 PM, Derek Scherger <[EMAIL PROTECTED]> wrote:
>  I did notice that the ls certs, keys, branches, epochs, tags, and vars
>  commands all take --depth and --exclude as valid options which seems
>  odd. I don't think these options make any sense at all for these
>  commands and the manual doesn't indicate that they do.

Probably historical baggage from when subcommands weren't first-class
CMD() functions?

zw


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] restrictions: disabling recursion

2008-03-02 Thread Derek Scherger

Zack Weinberg wrote:

2008/2/19 Zbigniew Zagórski <[EMAIL PROTECTED]>:

 while fighting with my first lua test (for automate
 get_current_revision) I've found that restrictions are rather
 surprising when using --depth=0 command. Reference says that

 "... For example, n=0 disables recursion ..."

 and i think that it's not absolutely true.


You've run afoul of this, I think:

  // FIXME: this uses depth+1 because the old semantics of depth=0 were
  // something like "the current directory and its immediate children". it
  // seems somewhat more reasonable here to use depth=0 to mean "exactly
  // this directory" and depth=1 to mean "this directory and its immediate
  // children"

The "old" behavior has been preserved in the name of backward
compatibility.  I'd have no objection to calling a flag day and
introducing the more sensible semantics you suggest (which are the
same as the ones suggested in the restrictions.cc comments).  What do
other people think?


Being as there were no objections I've gone ahead and made this change 
in rev 4c17e37f16638c21205bf99d008d1b94ab052fbb on mainline.


I did notice that the ls certs, keys, branches, epochs, tags, and vars 
commands all take --depth and --exclude as valid options which seems 
odd. I don't think these options make any sense at all for these 
commands and the manual doesn't indicate that they do.


Cheers,
Derek




___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] restrictions: disabling recursion

2008-02-20 Thread Richard Levitte
In message <[EMAIL PROTECTED]> on Tue, 19 Feb 2008 18:26:23 -0500, "Zack 
Weinberg" <[EMAIL PROTECTED]> said:

zackw> You've run afoul of this, I think:
zackw> 
zackw>   // FIXME: this uses depth+1 because the old semantics of depth=0 were
zackw>   // something like "the current directory and its immediate children". 
it
zackw>   // seems somewhat more reasonable here to use depth=0 to mean "exactly
zackw>   // this directory" and depth=1 to mean "this directory and its 
immediate
zackw>   // children"
zackw> 
zackw> The "old" behavior has been preserved in the name of backward
zackw> compatibility.  I'd have no objection to calling a flag day and
zackw> introducing the more sensible semantics you suggest (which are the
zackw> same as the ones suggested in the restrictions.cc comments).  What do
zackw> other people think?

I have no problem with that in itself.  Perhaps one should consider
renaming --depth to something else, so the change becomes more
blatant.  I don't have any other name in mind right now, but it's
something to think of...

Cheers,
Richard

-
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

-- 
Richard Levitte [EMAIL PROTECTED]
http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
-- C.S. Lewis


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] restrictions: disabling recursion

2008-02-19 Thread Stephen Leake
"Zack Weinberg" <[EMAIL PROTECTED]> writes:

> 2008/2/19 Zbigniew Zagórski <[EMAIL PROTECTED]>:
>>  while fighting with my first lua test (for automate
>>  get_current_revision) I've found that restrictions are rather
>>  surprising when using --depth=0 command. Reference says that
>>
>>  "... For example, n=0 disables recursion ..."
>>
>>  and i think that it's not absolutely true.
>
> You've run afoul of this, I think:
>
>   // FIXME: this uses depth+1 because the old semantics of depth=0 were
>   // something like "the current directory and its immediate children". it
>   // seems somewhat more reasonable here to use depth=0 to mean "exactly
>   // this directory" and depth=1 to mean "this directory and its immediate
>   // children"
>
> The "old" behavior has been preserved in the name of backward
> compatibility.  I'd have no objection to calling a flag day and
> introducing the more sensible semantics you suggest (which are the
> same as the ones suggested in the restrictions.cc comments).  What do
> other people think?

I've never used --depth, so this works for me.

-- 
-- Stephe


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] restrictions: disabling recursion

2008-02-19 Thread Derek Scherger

Zack Weinberg wrote:

2008/2/19 Zbigniew Zagórski <[EMAIL PROTECTED]>:

 while fighting with my first lua test (for automate
 get_current_revision) I've found that restrictions are rather
 surprising when using --depth=0 command. Reference says that

 "... For example, n=0 disables recursion ..."

 and i think that it's not absolutely true.


You've run afoul of this, I think:

  // FIXME: this uses depth+1 because the old semantics of depth=0 were
  // something like "the current directory and its immediate children". it
  // seems somewhat more reasonable here to use depth=0 to mean "exactly
  // this directory" and depth=1 to mean "this directory and its immediate
  // children"

The "old" behavior has been preserved in the name of backward
compatibility.  I'd have no objection to calling a flag day and
introducing the more sensible semantics you suggest (which are the
same as the ones suggested in the restrictions.cc comments).  What do
other people think?


+1

I think the "old" behaviour refers to the time before monotone 
explicitly supported directories. Perhaps depth=0 meaning all the 
versioned files in some explicitly specified directory made more sense then.


I don't think there's any need to expose -1 to mean infinite recursion 
though is there? Not specifying depth already means this.


Cheers,
Derek





___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] restrictions: disabling recursion

2008-02-19 Thread Zack Weinberg
2008/2/19 Zbigniew Zagórski <[EMAIL PROTECTED]>:
>  while fighting with my first lua test (for automate
>  get_current_revision) I've found that restrictions are rather
>  surprising when using --depth=0 command. Reference says that
>
>  "... For example, n=0 disables recursion ..."
>
>  and i think that it's not absolutely true.

You've run afoul of this, I think:

  // FIXME: this uses depth+1 because the old semantics of depth=0 were
  // something like "the current directory and its immediate children". it
  // seems somewhat more reasonable here to use depth=0 to mean "exactly
  // this directory" and depth=1 to mean "this directory and its immediate
  // children"

The "old" behavior has been preserved in the name of backward
compatibility.  I'd have no objection to calling a flag day and
introducing the more sensible semantics you suggest (which are the
same as the ones suggested in the restrictions.cc comments).  What do
other people think?

zw
___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


[Monotone-devel] restrictions: disabling recursion

2008-02-19 Thread Zbigniew Zagórski

Hi all,

while fighting with my first lua test (for automate 
get_current_revision) I've found that restrictions are rather 
surprising when using --depth=0 command. Reference says that


"... For example, n=0 disables recursion ..."

and i think that it's not absolutely true.

Question is what does "disabled recursion" mean.

When I've got following revision(all of them are folders):

  addedyyy
  addedyyy/ttt
  addedyyy/zzz

I want to check changes:

$ mtn st --depth=0 .
Current branch: a
Changes against parent 5c11ada5b46d4ac9c809a29d35f92e9bb89e6222
  addedyyy

I suppose that mtn will restrict me only to "current folder". But does 
"current folder" includes all files in "current folder" ?

In that case it's very not a problem I'm still not sure.

Maybe next case shows my confusion better. I want to see only things 
added in yyy/ttt subdir:


$ mtn st --depth=0 yyy/ttt
mtn: warning: restriction excludes addition of 'yyy' but includes 
addition of 'yyy/ttt'

mtn: misuse: invalid restriction

(boom, never mind restrictions disabilities now. Lets add yyy/ to 
restriction also):


$ mtn st --depth=0 yyy yyy/ttt
Current branch: a
Changes against parent 5c11ada5b46d4ac9c809a29d35f92e9bb89e6222
  addedyyy
  addedyyy/ttt
  addedyyy/zzz

Of course we didn't wanted this yyy/zzz here. It's a surprise. Is that 
also a feature ?


So, IMHO it would be feasible to change meaning of --depth in all 
restrictions to following

 0   strictly no recursion, take only explicitly given names
 1   + only direct children of explicitly given folders
 2   + direct of these folders
 ...
 -1  -- infinite recursion

Lets assume that implementation is different story.

Is that feasible idea?

It would follow "the least surprise rule" path (at least for me).

BTW. Does directories support attributes ? Yes they do.
This change t would allow operating on "directory as an entity". Now 
it's quite impossible without using tedious --exclude.


$ mtn st yyy --depth=0
Current branch: a
Changes against parent 5c11ada5b46d4ac9c809a29d35f92e9bb89e6222
  addedyyy
  addedyyy/ttt
  addedyyy/zzz
  attr on  yyy
attr   jjj
value  1

(boom, i don't want ttt & zzz).

Best regards,
--
Zbigniew Zagórski
/ software developer / geek / happy daddy /



___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel