Commit ca667439 authored by epriestley's avatar epriestley

Support Perforce/Git repositories in "arc land"

Summary: Ref T13434. Detect perforce remotes and use "git p4" commands in place of "git" commands when operating in Perforce mode.

Test Plan:
  - Landed "master" onto itself, saw master update.
  - Landed "feature1" onto clean "master", saw master update.
  - Landed "feature2" onto dirty "master", saw master stay dirty.
  - Landed with "--hold", got sensible submit instructions.

Maniphest Tasks: T13434

Differential Revision:
parent 9c7bbb76
This diff is collapsed.
......@@ -1550,4 +1550,31 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
return $path;
public function isPerforceRemote($remote_name) {
// See T13434. In Perforce workflows, "git p4 clone" creates "p4" refs
// under "refs/remotes/", but does not define a real remote named "p4".
// We treat this remote as though it were a real remote during "arc land",
// but it does not respond to commands like "git remote show p4", so we
// need to handle it specially.
if ($remote_name !== 'p4') {
return false;
$remote_dir = $this->getMetadataPath().'/refs/remotes/p4';
if (!Filesystem::pathExists($remote_dir)) {
return false;
return true;
public function isPushableRemote($remote_name) {
list($err, $stdout) = $this->execManualLocal(
'remote get-url --push -- %s',
return !$err;
......@@ -245,6 +245,14 @@ EOTEXT
// could probably be structured more cleanly.
// This must be configured or we fail later inside "buildEngineMessage()".
// This is less than ideal.
$this->ontoRemoteBranch = sprintf(
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment