You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Monnier <mo...@rum.cs.yale.edu> on 2003/05/08 21:28:26 UTC

Return status of `svn diff'

Is there any particular reason why `svn diff' does not return a 0/1
status similar to plain `diff' (i.e. indicating whether or not there
was any actual difference) ?

If it is just accidental, could it be changed ?
It is not of the utmost importance, but it can be convenient in scripts.


        Stefan


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

Re: Return status of `svn diff'

Posted by Stefan Monnier <mo...@rum.cs.yale.edu>.
> The svn client program returns 1 to indicate an error happened, just
> like most programs do.  It would be really strange and inconsistent,
> IMO, to have 'return 1' mean something completely different just
> because you invoked the 'diff' subcommand.

Makes sense.

>> It is not of the utmost importance, but it can be convenient in scripts.
> If you want to know whether a diff occurred, couldn't you just check
> to see if any lines were printed to stdout?  :-)

As I said, it is not of the utmost importance.  It's just that sometimes
checking the output is inconvenient (it's already gone somewhere else).


        Stefan


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

Re: Return status of `svn diff'

Posted by Matt Kraai <kr...@alumni.cmu.edu>.
On Thu, May 08, 2003 at 04:37:02PM -0500, Ben Collins-Sussman wrote:
> "Stefan Monnier" <mo...@rum.cs.yale.edu> writes:
> 
> > Is there any particular reason why `svn diff' does not return a 0/1
> > status similar to plain `diff' (i.e. indicating whether or not there
> > was any actual difference) ?
> > 
> > If it is just accidental, could it be changed ?
> 
> The svn client program returns 1 to indicate an error happened, just
> like most programs do.  It would be really strange and inconsistent,
> IMO, to have 'return 1' mean something completely different just
> because you invoked the 'diff' subcommand.

The Single Unix Specification, Version 2 diff manual page states:

 EXIT STATUS

      The following exit values are returned:

      0
	No differences were found.

      1
	Differences were found.

      >1
        An error occurred.

Re: Return status of `svn diff'

Posted by Ben Collins-Sussman <su...@collab.net>.
"Stefan Monnier" <mo...@rum.cs.yale.edu> writes:

> Is there any particular reason why `svn diff' does not return a 0/1
> status similar to plain `diff' (i.e. indicating whether or not there
> was any actual difference) ?
> 
> If it is just accidental, could it be changed ?

The svn client program returns 1 to indicate an error happened, just
like most programs do.  It would be really strange and inconsistent,
IMO, to have 'return 1' mean something completely different just
because you invoked the 'diff' subcommand.

> It is not of the utmost importance, but it can be convenient in scripts.

If you want to know whether a diff occurred, couldn't you just check
to see if any lines were printed to stdout?  :-)

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