[PATCH stable] rebase: empty revset should be a gentle no-op with exit code 1, not an error

Matt Mackall mpm at selenic.com
Thu May 1 11:30:14 CDT 2014


On Thu, 2014-05-01 at 12:17 -0400, Jordi Gutiérrez Hermoso wrote:
> On Thu, 2014-05-01 at 17:00 +0200, Mads Kiilerich wrote:
> 
> > rebase: empty revset should be a gentle no-op with exit code 1, not
> > an error
> 
> Out of curiousity, what is the difference between these two? I ask
> because I've been wondering what to do when similar error conditions
> occur with hg fold in Evolve.

Aborts raise an exit code of 255, which is not the documented exit code
for "nothing to rebase".

A small digression here: lots of people think of Unix exit codes as
error codes, but there is a >40 year history of standard Unix tools
returning non-zero exit codes for non-error conditions. For instance,
the grep manpage says:

EXIT STATUS
       The exit status is 0 if selected lines are found, and 1 if  not  found.
       If an error occurred the exit status is 2.  (Note: POSIX error handling
       code should check for '2' or greater.)

We also see here the pattern of "indicate no results via non-zero exit
code". We copy this pattern in a bunch of places (though perhaps not
enough!).

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list