comparison contrib/chg/chg.c @ 28605:baa073200ba2

chg: allows default hg path to be overridden Before this patch, chg will fall back to "hg" if neither CHGHG nor HG are set. This may have trouble if the "hg" in PATH is not compatible with chg, which can happen, for example, an old hg is installed in a virtualenv. Since it's very hard to do a quick hg version check from chg, after discussion in IRC with smf and marmoute, the quickest solution is to build a package with a hardcoded absolute hg path in chg. This patch makes it possible by adding a C macro HGPATH.
author Jun Wu <quark@fb.com>
date Sun, 20 Mar 2016 15:43:20 -0700
parents 1435a8e9b5fe
children 222f482930c8
comparison
equal deleted inserted replaced
28604:d4d8a3c89e6d 28605:baa073200ba2
192 if (!hgcmd) { 192 if (!hgcmd) {
193 hgcmd = getenv("CHGHG"); 193 hgcmd = getenv("CHGHG");
194 if (!hgcmd || hgcmd[0] == '\0') 194 if (!hgcmd || hgcmd[0] == '\0')
195 hgcmd = getenv("HG"); 195 hgcmd = getenv("HG");
196 if (!hgcmd || hgcmd[0] == '\0') 196 if (!hgcmd || hgcmd[0] == '\0')
197 #ifdef HGPATH
198 hgcmd = (HGPATH);
199 #else
197 hgcmd = "hg"; 200 hgcmd = "hg";
201 #endif
198 } 202 }
199 return hgcmd; 203 return hgcmd;
200 } 204 }
201 205
202 static void execcmdserver(const struct cmdserveropts *opts) 206 static void execcmdserver(const struct cmdserveropts *opts)