'message' => '--preview does not update any revision.',
),
),
+ 'encoding' => array(
+ 'param' => 'encoding',
+ 'help' =>
+ "Attempt to convert non UTF-8 hunks into specified encoding.",
+ ),
'allow-untracked' => array(
'help' =>
"Skip checks for untracked files in the working copy.",
// liberal about what they're willing to process.
$is_binary = ArcanistDiffUtils::isHeuristicBinaryFile($corpus);
if (!$is_binary) {
+ $try_encoding = nonempty($this->getArgument('encoding'), null);
if ($try_encoding === null) {
// Make a call to check if there's an encoding specified for this
// project.
- $project_info = $this->getConduit()->callMethodSynchronous(
- 'arcanist.projectinfo',
- array(
- 'name' => $this->getWorkingCopy()->getProjectID(),
- ));
- $try_encoding = nonempty($project_info['encoding'], false);
+ try {
+ $project_info = $this->getConduit()->callMethodSynchronous(
+ 'arcanist.projectinfo',
+ array(
+ 'name' => $this->getWorkingCopy()->getProjectID(),
+ ));
+ $try_encoding = nonempty($project_info['encoding'], false);
+ } catch (ConduitClientException $e) {
+ if ($e->getErrorCode() == 'ERR-BAD-ARCANIST-PROJECT') {
+ echo phutil_console_wrap(
+ "Lookup of encoding in arcanist project failed\n".
+ $e->getMessage()
+ );
+ $try_encoding = false;
+ } else {
+ throw $e;
+ }
+ }
}
if ($try_encoding) {
// NOTE: This feature is HIGHLY EXPERIMENTAL and will cause a lot