* [Sun, Mar 26, 2017 at 08:23:37AM +0000] Ben Franksen:
>Perhaps the intention here was that the pural indicates "zero or more",
>so zero is an expected result?
Probably yes. The fact is that it is not consistent. For example:
$ darcs diff --from-patch xxx --to-patch yyy
raises an error, while
$ darcs diff --index x-y
doesn't, despite the fact they are conceptually the same case.[0]
Also, given that '-h' is an alias to '--match' instead of '--matches'
(more about this on another mail),
$ darcs log --matches 'hash xxx'
does not croak, while
$ darcs log -h xxx
does.
In general, I think darcs should always return an error code when cannot
found a patch he was asked for, both for consistency and for easing
scripting.[1]
Better, darcs should return a specific, different from 1, error code for
this (let's say 20), so that for example
$ darcs diff --patch x file
returns:
20 if the patch cannot be found
1 if there are differences in the two versions of the file (similarly
to the *nix diff command)
0 if the two versions of the file are the same
Ciao,
Gian Piero.
[0] Also, I'm surprised --index doesn't croak about not being fed
integers.
[1] Just for example, as naming convention has often been referred as a
sort of branching, `darcs log -p '<BRANCH>'` could be a quick check for
testing we have the right branch.
|