You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Kamesh Jayachandran <ka...@collab.net> on 2007/05/17 23:06:38 UTC

[PATCH] '-p' shortcut to '--parents'

Hi All,

Find the attached patch and log.

With regards
Kamesh Jayachandran


Re: [PATCH] '-p' shortcut to '--parents'

Posted by "C. Michael Pilato" <cm...@collab.net>.
Kamesh Jayachandran wrote:
> [[[
> 
> Provide '-p' shortcut for '--parents'.
> 
> * subversion/svn/cl.h
>   (svn_cl__longopt_t): Remove 'svn_cl__parents_opt'.
> * subversion/svn/main.c
>   (svn_cl__options): Register '-p' shortcut for '--parents'.
>   (svn_cl__cmd_table): Register '-p' to be the allowable parameter to 'add',
>    'copy', 'mkdir', 'move'.
>   (main): Set 'opt_state.parents' for '-p' switch too.
> 
> Patch by: kameshj
> ]]]

I thought about submitting this same patch myself because of the obvious
'mkdir -p'.  But 'copy' also takes --parents, and 'cp -p' means something
totally different.  Alas, I'm not this merits the consumption of a short_opt.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: [PATCH] '-p' shortcut to '--parents'

Posted by Jared Hardy <ja...@gmail.com>.
> At 1:17 PM -0700 5/18/07, Jared Hardy wrote:
> >I find any such attempts to "save the user from themselves"
> >simultaneously amusing and frustrating. If you're so afraid of typos,
> >why not add an "Are you sure? (y/n)" message after each and every
> >command that creates anything new?? ;P
> >    If users are intelligent enough to be using the command-line
> >client in the first place, then they're probably also intelligent
> >enough to clean up after their own mistakes.
>
On 5/18/07, Garance A Drosihn <dr...@rpi.edu> wrote:
> IMO, it's not just a question of saving a user from themselves, but:
>
> Q: How many times do I "need" some parent directories automatically
>     created for me?
> a: Very few times (speaking for me personally)
>
> Q: How many times do I make a typo in some parent-directory name,
>     while trying to create a single new directory in an already-
>     existing directory?
> a: Much more often.  Not that I make a lot of typos, but that does
>     happen more often than I need to create multiple levels of
>     directories in a single command.
>
> Q: For the two possible behaviors, which is more annoying to me when
>     I want the "not-chosen" behavior but get the chosen behavior?
> a: It's not annoying (to me) to re-enter a command and add '-p' to
>     it.  It's much more annoying if a bunch of extra directories were
>     created due to a typo, and now I have to get rid of them all.

All good points. I guess I had my own set of use case assumptions,
different from these. I use copy'n'paste and auto-complete features
(like tab in bash) extensively, to avoid typos. Most of my
command-line use is also in the form of scripts, which use file
browser shells or "svk info" parsers to generate or convert path names
for me, so I end up having a lot of "-p" lines in these scripts. I
guess I also create deep directory structures far more frequently than
"normal" users. :)
    Your usage patterns make a good case for having some form of "pwd"
tracking in subversion clients, and "svn cd repo/path" commands. That
discussion should probably move to the thread suggesting there should
be an SVN "console mode"...

    Something in the history of all that is Posix must have lead to
"-p" not being the default in mkdir and cp, so I guess I'll bow to
that. Anyway, I guess my vote, if --parents isn't on by default, would
be to add the "-p" shorthand, since I do use it so often. "-P" would
also be acceptable. Using both "-p" and "-P" might be best. I must
admit, I didn't find it likely that it would become the default
behavior, but I thought it was worth debate. One of my devil's
advocate moments I suppose. I wonder if there's been any public
surveys about "mkdir -p" or "cp -P" usage patterns in the wild?

:) Jred

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

Re: [PATCH] '-p' shortcut to '--parents'

Posted by Garance A Drosihn <dr...@rpi.edu>.
At 1:17 PM -0700 5/18/07, Jared Hardy wrote:
>>On 5/18/07, Karl Fogel <kf...@red-bean.com> wrote:
>>>  What do you think of Jared's proposal?  I'm guardedly in favor; are
>>>  there cases where one *wouldn't* want the parent-creating behavior,
>>>  and if so, are they compelling enough to override the principle that
>>>  the intuitive thing should be the default?
>>
>On 5/17/07, David Glasser <gl...@mit.edu> wrote:
>>The obvious case, to me, is a typo: if you misspell the name of a
>>directory when trying to make a directory nested deep inside it, you
>>probably don't want a whole hierarchy of directories to be made by
>>mistake, complete with .svn directories and all.
>
>I find any such attempts to "save the user from themselves"
>simultaneously amusing and frustrating. If you're so afraid of typos,
>why not add an "Are you sure? (y/n)" message after each and every
>command that creates anything new?? ;P
>    If users are intelligent enough to be using the command-line
>client in the first place, then they're probably also intelligent
>enough to clean up after their own mistakes.

IMO, it's not just a question of saving a user from themselves, but:

Q: How many times do I "need" some parent directories automatically
    created for me?
a: Very few times (speaking for me personally)

Q: How many times do I make a typo in some parent-directory name,
    while trying to create a single new directory in an already-
    existing directory?
a: Much more often.  Not that I make a lot of typos, but that does
    happen more often than I need to create multiple levels of
    directories in a single command.

Q: For the two possible behaviors, which is more annoying to me when
    I want the "not-chosen" behavior but get the chosen behavior?
a: It's not annoying (to me) to re-enter a command and add '-p' to
    it.  It's much more annoying if a bunch of extra directories were
    created due to a typo, and now I have to get rid of them all.

-- 
Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

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

Re: [PATCH] '-p' shortcut to '--parents'

Posted by Jared Hardy <ja...@gmail.com>.
> On 5/18/07, Karl Fogel <kf...@red-bean.com> wrote:
> > What do you think of Jared's proposal?  I'm guardedly in favor; are
> > there cases where one *wouldn't* want the parent-creating behavior,
> > and if so, are they compelling enough to override the principle that
> > the intuitive thing should be the default?
>
On 5/17/07, David Glasser <gl...@mit.edu> wrote:
> The obvious case, to me, is a typo: if you misspell the name of a
> directory when trying to make a directory nested deep inside it, you
> probably don't want a whole hierarchy of directories to be made by
> mistake, complete with .svn directories and all.

I find any such attempts to "save the user from themselves"
simultaneously amusing and frustrating. If you're so afraid of typos,
why not add an "Are you sure? (y/n)" message after each and every
command that creates anything new?? ;P
    If users are intelligent enough to be using the command-line
client in the first place, then they're probably also intelligent
enough to clean up after their own mistakes. In GUI land, auto-suggest
and spell-check are the proper solutions to potential typo problems --
not pop-ups and failures. In client land, you have to trust your users
to know what they're doing. I understand your concerns, I just don't
agree with them.

:) Jred

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

Re: [PATCH] '-p' shortcut to '--parents'

Posted by "C. Michael Pilato" <cm...@collab.net>.
Justin Erenkrantz wrote:
> BTW, I also don't think -p has enough universal meaning to warrant it
> always being '--parents'. -- justin

...which is exactly the point I was trying to make.  Sure, I know folks
(like me) use 'mkdir -p' all the time.  But I also use 'cp -R' and 'rm -r',
neither of which works with 'svn' prepended to it.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: [PATCH] '-p' shortcut to '--parents'

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On 5/17/07, David Glasser <gl...@mit.edu> wrote:
> The obvious case, to me, is a typo: if you misspell the name of a
> directory when trying to make a directory nested deep inside it, you
> probably don't want a whole hierarchy of directories to be made by
> mistake, complete with .svn directories and all.

Ditto - I think it'd be far too dangerous to create such entries by
default because of a typo.

BTW, I also don't think -p has enough universal meaning to warrant it
always being '--parents'. -- justin

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

Re: [PATCH] '-p' shortcut to '--parents'

Posted by David Glasser <gl...@mit.edu>.
On 5/18/07, Karl Fogel <kf...@red-bean.com> wrote:
> What do you think of Jared's proposal?  I'm guardedly in favor; are
> there cases where one *wouldn't* want the parent-creating behavior,
> and if so, are they compelling enough to override the principle that
> the intuitive thing should be the default?

The obvious case, to me, is a typo: if you misspell the name of a
directory when trying to make a directory nested deep inside it, you
probably don't want a whole hierarchy of directories to be made by
mistake, complete with .svn directories and all.

--dave

-- 
David Glasser | glasser@mit.edu | http://www.davidglasser.net/

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

Re: [PATCH] '-p' shortcut to '--parents'

Posted by Karl Fogel <kf...@red-bean.com>.
"Hyrum K. Wright" <hy...@mail.utexas.edu> writes:
> [Replying to your mail, but comments are general.]
>
> Jared Hardy wrote:
>> Don't let me stoke any fires here, but I wanted to mention that SVK
>> has "-p" as an equivalent to "--parents", in both the cp and mv
>> commands. It is so handy, I just scripted it in, so both commands use
>> this flag by default. Is there ever a situation where a user wouldn't
>> want non-existing parents to be created for them? It irks me that this
>> isn't a default for mkdir as well. I would rather that happen, than
>> see a useless error message any day. Perhaps the question should be
>> "what flag do we use to turn the create-parents feature off?"
>>    In my opinion, design decisions that force the user to go through
>> manual steps, when they can be done automatically based on available
>> data, are obnoxious. I'm sure plenty of potential users are turned off
>> of many shells, just for this reason.
>
> Note that the functionality you describe now exists in trunk, it's just
> a question of whether or not to add '-p' as a shortcut for '--parents'.

I think the behavior Jared was describing was that the current
'--parents' behavior would be the default.  If it were the default, we
wouldn't need the '--parents' flag at all.  Unless we have its
opposite: a flag (I dunno, '--no-parents' maybe?) that suppresses the
parent-creating behavior, in which case if run-time config offered a
way to make '--no-parents' the default, then we'd still need
'--parents' to allow overriding it.  But then the case for '-p' would
be pretty weak.

What do you think of Jared's proposal?  I'm guardedly in favor; are
there cases where one *wouldn't* want the parent-creating behavior,
and if so, are they compelling enough to override the principle that
the intuitive thing should be the default?

I feel like if this is important enough to contemplate using up a
short option ('-p') on, then maybe it's important enough to just be
the default in the first place.

-Karl

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

Re: [PATCH] '-p' shortcut to '--parents'

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
[Replying to your mail, but comments are general.]

Jared Hardy wrote:
> Don't let me stoke any fires here, but I wanted to mention that SVK
> has "-p" as an equivalent to "--parents", in both the cp and mv
> commands. It is so handy, I just scripted it in, so both commands use
> this flag by default. Is there ever a situation where a user wouldn't
> want non-existing parents to be created for them? It irks me that this
> isn't a default for mkdir as well. I would rather that happen, than
> see a useless error message any day. Perhaps the question should be
> "what flag do we use to turn the create-parents feature off?"
>    In my opinion, design decisions that force the user to go through
> manual steps, when they can be done automatically based on available
> data, are obnoxious. I'm sure plenty of potential users are turned off
> of many shells, just for this reason.

Note that the functionality you describe now exists in trunk, it's just
a question of whether or not to add '-p' as a shortcut for '--parents'.

> On 5/17/07, Kamesh Jayachandran <ka...@collab.net> wrote:
>> C. Michael Pilato wrote:
>> > Kamesh Jayachandran wrote:
>> >
>> >> [[[
>> >>
>> >> Provide '-p' shortcut for '--parents'.

I thought about this idea when writing the feature and decided not to
include '-p' initially.  This discussion about shortcuts comes up
frequently, and we've been pretty (overly?) protective of the shortcut
space.  I'd like to see what the usage is before we consume a shortcut
on it.

>> >> * subversion/svn/cl.h
>> >>   (svn_cl__longopt_t): Remove 'svn_cl__parents_opt'.
>> >> * subversion/svn/main.c
>> >>   (svn_cl__options): Register '-p' shortcut for '--parents'.
>> >>   (svn_cl__cmd_table): Register '-p' to be the allowable parameter
>> to 'add',
>> >>    'copy', 'mkdir', 'move'.
>> >>   (main): Set 'opt_state.parents' for '-p' switch too.
>> >>
>> >> Patch by: kameshj
>> >> ]]]
>> >>
>> >
>> > I thought about submitting this same patch myself because of the
>> obvious
>> > 'mkdir -p'.  But 'copy' also takes --parents, and 'cp -p' means
>> something
>> > totally different.  Alas, I'm not sure this merits the consumption of a
>> > short_opt.
>> >
>> >
>> <snip from man cp>
>> -p     same as --preserve=mode,ownership,timestamps
>> </snip>
>> Subversion does not know ownership as such(left to external
>> authorization modules).
>> I am not sure copying timestamp(svn:date) makes sense?
>> We support 'executable' mode via versioned property which is copied
>> anyways.
>>
>> So expecting 'svn cp -p' to behave as 'cp -p' shows once ignorance about
>> subversion.
>>
>> I think here the goal is user experience(All these days I used mkdir -p,
>> and learnt the --parents equivalent only today.) not parity with
>> existing tools especially when one is not possible.

I agree that the purpose of this feature is to help the user.  'cp -p'
doesn't create parents like the proposed 'svn cp -p'.  I think we're
doing the users a disservice if we confuse the meaning of '-p' in the
context of 'svn cp' and vanilla 'cp'.


Another question I've been thinking about is what the behavior of the
following should be (from within the greek tree):

mkdir X
mkdir X/Y
svn cp --parents iota X/Y/Z

Right now, it complains because Y isn't versioned.  If a local copy or
move finds unversioned directories, should it just add them a la 'svn
add --parents'?

-Hyrum

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

Re: [PATCH] '-p' shortcut to '--parents'

Posted by Jared Hardy <ja...@gmail.com>.
Don't let me stoke any fires here, but I wanted to mention that SVK
has "-p" as an equivalent to "--parents", in both the cp and mv
commands. It is so handy, I just scripted it in, so both commands use
this flag by default. Is there ever a situation where a user wouldn't
want non-existing parents to be created for them? It irks me that this
isn't a default for mkdir as well. I would rather that happen, than
see a useless error message any day. Perhaps the question should be
"what flag do we use to turn the create-parents feature off?"
    In my opinion, design decisions that force the user to go through
manual steps, when they can be done automatically based on available
data, are obnoxious. I'm sure plenty of potential users are turned off
of many shells, just for this reason.

:) Jred


On 5/17/07, Kamesh Jayachandran <ka...@collab.net> wrote:
> C. Michael Pilato wrote:
> > Kamesh Jayachandran wrote:
> >
> >> [[[
> >>
> >> Provide '-p' shortcut for '--parents'.
> >>
> >> * subversion/svn/cl.h
> >>   (svn_cl__longopt_t): Remove 'svn_cl__parents_opt'.
> >> * subversion/svn/main.c
> >>   (svn_cl__options): Register '-p' shortcut for '--parents'.
> >>   (svn_cl__cmd_table): Register '-p' to be the allowable parameter to 'add',
> >>    'copy', 'mkdir', 'move'.
> >>   (main): Set 'opt_state.parents' for '-p' switch too.
> >>
> >> Patch by: kameshj
> >> ]]]
> >>
> >
> > I thought about submitting this same patch myself because of the obvious
> > 'mkdir -p'.  But 'copy' also takes --parents, and 'cp -p' means something
> > totally different.  Alas, I'm not sure this merits the consumption of a
> > short_opt.
> >
> >
> <snip from man cp>
> -p     same as --preserve=mode,ownership,timestamps
> </snip>
> Subversion does not know ownership as such(left to external
> authorization modules).
> I am not sure copying timestamp(svn:date) makes sense?
> We support 'executable' mode via versioned property which is copied anyways.
>
> So expecting 'svn cp -p' to behave as 'cp -p' shows once ignorance about
> subversion.
>
> I think here the goal is user experience(All these days I used mkdir -p,
> and learnt the --parents equivalent only today.) not parity with
> existing tools especially when one is not possible.
>
> With regards
> Kamesh Jayachandran
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>

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

Re: [PATCH] '-p' shortcut to '--parents'

Posted by Kamesh Jayachandran <ka...@collab.net>.
C. Michael Pilato wrote:
> Kamesh Jayachandran wrote:
>   
>> [[[
>>
>> Provide '-p' shortcut for '--parents'.
>>
>> * subversion/svn/cl.h
>>   (svn_cl__longopt_t): Remove 'svn_cl__parents_opt'.
>> * subversion/svn/main.c
>>   (svn_cl__options): Register '-p' shortcut for '--parents'.
>>   (svn_cl__cmd_table): Register '-p' to be the allowable parameter to 'add',
>>    'copy', 'mkdir', 'move'.
>>   (main): Set 'opt_state.parents' for '-p' switch too.
>>
>> Patch by: kameshj
>> ]]]
>>     
>
> I thought about submitting this same patch myself because of the obvious
> 'mkdir -p'.  But 'copy' also takes --parents, and 'cp -p' means something
> totally different.  Alas, I'm not sure this merits the consumption of a
> short_opt.
>
>   
<snip from man cp>
-p     same as --preserve=mode,ownership,timestamps
</snip>
Subversion does not know ownership as such(left to external 
authorization modules).
I am not sure copying timestamp(svn:date) makes sense?
We support 'executable' mode via versioned property which is copied anyways.

So expecting 'svn cp -p' to behave as 'cp -p' shows once ignorance about 
subversion.

I think here the goal is user experience(All these days I used mkdir -p, 
and learnt the --parents equivalent only today.) not parity with 
existing tools especially when one is not possible.

With regards
Kamesh Jayachandran

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

Re: [PATCH] '-p' shortcut to '--parents'

Posted by "C. Michael Pilato" <cm...@collab.net>.
Kamesh Jayachandran wrote:
> [[[
> 
> Provide '-p' shortcut for '--parents'.
> 
> * subversion/svn/cl.h
>   (svn_cl__longopt_t): Remove 'svn_cl__parents_opt'.
> * subversion/svn/main.c
>   (svn_cl__options): Register '-p' shortcut for '--parents'.
>   (svn_cl__cmd_table): Register '-p' to be the allowable parameter to 'add',
>    'copy', 'mkdir', 'move'.
>   (main): Set 'opt_state.parents' for '-p' switch too.
> 
> Patch by: kameshj
> ]]]

I thought about submitting this same patch myself because of the obvious
'mkdir -p'.  But 'copy' also takes --parents, and 'cp -p' means something
totally different.  Alas, I'm not sure this merits the consumption of a
short_opt.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand