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

RE: [RFE] Make 'svn patch' read from STDIN

From: Bert Huijben <bert_at_qqmail.nl>
Date: Sun, 7 Feb 2016 13:56:12 +0100

Well.. Perhaps ^D works on your platform, but you will need other keys on other platforms. And ^D doesn’t abort, but signals successful EOF, so you need a different description else.

Creating a temporary file from the calling process/shell is most likely not much harder than in Subversion itself. And given that the diff parse code has to read the file multiple times we will need a tempfile anyway.

Bert

Sent from Outlook Mail for Windows 10 phone

From: Daniel Shahaf
Sent: zondag 7 februari 2016 01:22
To: Andreas Scherer; dev_at_subversion.apache.org
Subject: Re: [RFE] Make 'svn patch' read from STDIN

Stefan Sperling wrote on Mon, Feb 01, 2016 at 10:51:39 +0100:
> On Sun, Jan 31, 2016 at 11:48:26AM +0100, Andreas Scherer wrote:
> > I suggest to extend 'svn patch' so that it supports usage in a pipe like
> >
> > gzip -dc patch-0042.gz | svn patch -P patch-0042 -
> >
> > This would permit using 'svn patch' directly as a drop-in replacement for
> >
> > gzip -dc patch-0042.gz | patch
> >
> > An example use case is the '%autosetup -S [SCM]' feature of RPM
> > (http://www.rpm.org/wiki/PackagerDocs/Autosetup,introducedinversion4.11;

That link 404s; I think you meant http://www.rpm.org/wiki/PackagerDocs/Autosetup

> Also, I think we should preserve the following behaviour if stdin is
> indeed a terminal:
>
> $ svn patch
> svn: E205001: Try 'svn help patch' for more information
> svn: E205001: Not enough arguments provided
>
> This is consistent with other svn subcommands, and avoids giving the
> impression that 'svn patch' "hangs" when the user doesn't pass a patch
> on stdin. This avoids confusing casual command line users line who might
> not know about file redirection and pipes (I know we have such users,
> based on my personal interactions with many of them).

Let's not throw the baby out with the bathwater. Simply printing an
informative message "svn: Reading a patch from standard input; press ^D
to abort" should address the confusion without breaking the use-case of
people who run 'patch' without arguments and then paste a patch from the
clipboard.

Cheers,

Daniel
Received on 2016-02-07 13:56:18 CET

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.