hg diff/status always returns zero?

Stephen Rasku mercurial at srasku.net
Wed May 6 15:38:19 CDT 2009


On Wed, May 6, 2009 at 16:31, Giorgos Keramidas
<keramida at ceid.upatras.gr> wrote:
> On Wed, 6 May 2009 15:55:07 -0400, Stephen Rasku <mercurial at srasku.net> wrote:
>>
>> For "hg diff" it should return a non-zero status if any diffs are generated.
>
> That's arguably wrong.  How would you distinguish between a non-zero
> status that means "there are diffs" and a non-zero status that means "an
> exception was thrown and hg displayed a traceback"?
>
> I think Ted is right that it's not very clear why or when diff/status
> should return non-zero for operations that didn't raise an exception,
> so their current mode seems a good 'failsafe default'.

Well, there are 255 possible return codes.  Use 1 for "there are
diffs" and 2-255 for "such-and-such error occured".  Is there a
fundamental reason that grep can return an error code but hg can't?

...Stephen



More information about the Mercurial mailing list