// TODO: Check commits since tracking branch. If empty then return false.
- $repository_phid = idx($this->getProjectInfo(), 'repositoryPHID');
- if ($repository_phid) {
- $repositories = $this->getConduit()->callMethodSynchronous(
- 'repository.query',
- array());
- $callsigns = ipull($repositories, 'callsign', 'phid');
- $callsign = idx($callsigns, $repository_phid);
- if ($callsign) {
- $known_commits = $this->getConduit()->callMethodSynchronous(
- 'diffusion.getcommits',
- array('commits' => array('r'.$callsign.$commit['commit'])));
- if (ifilter($known_commits, 'error', $negate = true)) {
- return false;
- }
+ $repository = $this->loadProjectRepository();
+ if ($repository) {
+ $callsign = $repository['callsign'];
+ $known_commits = $this->getConduit()->callMethodSynchronous(
+ 'diffusion.getcommits',
+ array('commits' => array('r'.$callsign.$commit['commit'])));
+ if (ifilter($known_commits, 'error', $negate = true)) {
+ return false;
}
}
return $this->projectInfo;
}
+ protected function loadProjectRepository() {
+ $repository_phid = idx($this->getProjectInfo(), 'repositoryPHID');
+ if (!$repository_phid) {
+ return array();
+ }
+
+ $repositories = $this->getConduit()->callMethodSynchronous(
+ 'repository.query',
+ array());
+ $repositories = ipull($repositories, null, 'phid');
+
+ return idx($repositories, $repository_phid, array());
+ }
+
protected function newInteractiveEditor($text) {
$editor = new PhutilInteractiveEditor($text);
*/
final class ArcanistLandWorkflow extends ArcanistBaseWorkflow {
private $isGit;
+ private $isGitSvn;
private $isHg;
private $oldBranch;
"'arc land' only supports git and mercurial.");
}
+ if ($this->isGit) {
+ $repository = $this->loadProjectRepository();
+ $this->isGitSvn = (idx($repository, 'vcs') == 'svn');
+ }
+
$branch = $this->getArgument('branch');
if (empty($branch)) {
$branch = $this->getBranchOrBookmark();
}
$this->ontoRemoteBranch = $this->onto;
- if ($this->isGit) {
+ if ($this->isGitSvn) {
+ $this->ontoRemoteBranch = 'trunk';
+ } else if ($this->isGit) {
$this->ontoRemoteBranch = $this->remote.'/'.$this->onto;
}
if ($this->isGit) {
$repository_api->execxLocal('pull --ff-only');
- list($out) = $repository_api->execxLocal(
- 'log %s/%s..%s',
- $this->remote,
- $this->onto,
- $this->onto);
- if (strlen(trim($out))) {
- $local_ahead_of_remote = true;
+ if (!$this->isGitSvn) {
+ list($out) = $repository_api->execxLocal(
+ 'log %s..%s',
+ $this->ontoRemoteBranch,
+ $this->onto);
+ if (strlen(trim($out))) {
+ $local_ahead_of_remote = true;
+ }
}
} else if ($this->isHg) {
// execManual instead of execx because outgoing returns
chdir($repository_api->getPath());
- if ($this->isGit) {
+ if ($this->isGitSvn) {
+ $err = phutil_passthru('git svn dcommit');
+ } else if ($this->isGit) {
$err = phutil_passthru(
'git push %s %s',
$this->remote,