]> Cypherpunks repositories - gostls13.git/commitdiff
hgpatch: do not use hg exit status
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Wed, 28 Sep 2011 16:00:17 +0000 (12:00 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 28 Sep 2011 16:00:17 +0000 (12:00 -0400)
Fixes #2243.

R=rsc
CC=golang-dev
https://golang.org/cl/5146041

src/cmd/hgpatch/main.go

index d4169ae8596d4c4ab27884d7565d737fcf663cf9..e072a80d9bdebdfae017bdcd1f9e8851f0a544dd 100644 (file)
@@ -268,9 +268,10 @@ func hgRoot() (string, os.Error) {
 
 // hgIncoming returns true if hg sync will pull in changes.
 func hgIncoming() bool {
-       // hg -q incoming exits 0 when there is nothing incoming, 1 otherwise.
-       _, err := run([]string{"hg", "-q", "incoming"}, nil)
-       return err == nil
+       // Cannot trust hg's exit code on Windows,
+       // so look at whether hg prints any output.
+       out, _ := run([]string{"hg", "-q", "incoming"}, nil)
+       return len(out) > 0
 }
 
 // hgModified returns a list of the modified files in the