Issue178

Title hg pull returns non-zero exit code on no changes
Priority bug Status resolved
Superseder pull, push, etc. need sane exit codes
View: 186
Nosy List ThomasAH, bos, junkblocker
Assigned To Topics

Created on 2006-03-22.18:43:58 by junkblocker, last changed 2006-03-28.19:30:26 by ThomasAH.

Messages
msg859 (view) Author: ThomasAH Date: 2006-03-28.19:30:25
issue186 discusses the same problem more generally, so closing this issue
msg808 (view) Author: junkblocker Date: 2006-03-22.19:54:58
As long as return code semantics are clearly stated like grep it should be ok to
go with individual exit codes. I guess it depends on what level of detail you
are looking for. To me as long as hg pull worked, no matter it got new files or
there were none, it is success. To you if nothing was pulled it is 1, if
something was pulled 2, if something broke it is 3 etc.
msg806 (view) Author: ThomasAH Date: 2006-03-22.19:17:42
Think of grep: It returns 1 if the pattern was not found and 2 if the file was
not found (at least for GNU grep)
msg805 (view) Author: junkblocker Date: 2006-03-22.19:08:08
This goes against the traditional way of checking exit codes. An operation
should only return a non-zero exit status if some error occured. Ignoring the
return value requires using another operation to see what happened to the pull
i.e. operation failed, succeeded and no changes were pulled or succeeded and
some changes were pulled.
msg804 (view) Author: ThomasAH Date: 2006-03-22.18:56:55
This is used for things like:  hg pull && do_something_if_new_changesets
You can easily ignore the exit code with:  hg pull || true
History
Date User Action Args
2006-03-28 19:30:26ThomasAHsetstatus: chatting -> resolved
nosy: + bos
superseder: + pull, push, etc. need sane exit codes
messages: + msg859
2006-03-22 19:55:04junkblockersetmessages: + msg808
2006-03-22 19:17:44ThomasAHsetmessages: + msg806
2006-03-22 19:08:26junkblockersetmessages: + msg805
2006-03-22 18:57:08ThomasAHsetstatus: unread -> chatting
nosy: + ThomasAH, junkblocker
messages: + msg804
2006-03-22 18:43:58junkblockercreate