Fix for Mercurial 2.1: properly handle `hg pull` exit status.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 18 Nov 2014 04:15:34 +0100
changeset 475 f94b58d96d03
parent 474 f610e64874c8
child 476 9f97cda29c0e
Fix for Mercurial 2.1: properly handle `hg pull` exit status. For some reason, Mercurial 2.1 exists with status 1 if pull does not bring any new changesets. 2.0, 2.1.1 nor any other 2.x and 3.x version behaves the same. Therefore, special care has to be taken when running using 2.1 (in HGCommand::pull>>status:resut:
mercurial/HGCommand.st
--- a/mercurial/HGCommand.st	Sun Nov 16 23:52:21 2014 +0000
+++ b/mercurial/HGCommand.st	Tue Nov 18 04:15:34 2014 +0100
@@ -1930,6 +1930,11 @@
 status: status result: res
     "Called when hg command finishes, passing it's status and result from parser"
 
+    (status code == 1) ifTrue:[
+        "/ For whatever reason, Mercurial 2.1 returns exit statis
+        "/ of 1 if no changes has been found. No other release does it.
+        HGCommand hgVersion = #(2 1 nil) ifTrue:[ ^ res ].
+    ].
     (status code ~~ 0) ifTrue:[
         HGCommandError raiseErrorString: ('hg command failed (status %1)' expandMacrosWith: status code) .
     ].