comparison tests/test-rhg.t @ 49149:006688e36e12 stable

rhg: use `Command::exec` instead of `Command::status` `rhg` is supposed to be a transparent executable, using a subprocess defeats that purpose. See inline comments for more details. This also introduces the `which` crate to check if the fallback executable actually exists to help debugging (plain `execve` doesn't give much information). The error code 253 is used to signify that the fallback is not found, but may mean in the future that it is otherwise invalid if we start being more specific. Differential Revision: https://phab.mercurial-scm.org/D12578
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 19 Apr 2022 12:27:40 +0200
parents 7ee07e1a25c0
children a932cad26d37
comparison
equal deleted inserted replaced
49148:db3f8e5cc965 49149:006688e36e12
177 177
178 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=false 178 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=false
179 [1] 179 [1]
180 180
181 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=hg-non-existent 181 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=hg-non-existent
182 tried to fall back to a 'hg-non-existent' sub-process but got error $ENOENT$ 182 abort: invalid fallback 'hg-non-existent': cannot find binary path
183 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context 183 [253]
184
185 USAGE:
186 rhg cat [OPTIONS] <FILE>...
187
188 For more information try --help
189
190 [252]
191 184
192 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=rhg 185 $ rhg cat original --exclude="*.rs" --config rhg.fallback-executable=rhg
193 Blocking recursive fallback. The 'rhg.fallback-executable = rhg' config points to `rhg` itself. 186 Blocking recursive fallback. The 'rhg.fallback-executable = rhg' config points to `rhg` itself.
194 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context 187 unsupported feature: error: Found argument '--exclude' which wasn't expected, or isn't valid in this context
195 188