From 76ea456e450c4d49266cdab16cbaca09aa1e8af0 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Wed, 28 Sep 2011 12:00:17 -0400 Subject: [PATCH] hgpatch: do not use hg exit status Fixes #2243. R=rsc CC=golang-dev https://golang.org/cl/5146041 --- src/cmd/hgpatch/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmd/hgpatch/main.go b/src/cmd/hgpatch/main.go index d4169ae859..e072a80d9b 100644 --- a/src/cmd/hgpatch/main.go +++ b/src/cmd/hgpatch/main.go @@ -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 -- 2.50.0