1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

Fix arc diff x y in SVN

Summary:
D4186 added an "svn status --xml x y" form to getSVNStatus(), but the parser doesn't work for multiple files, since we get multiple <target /> elements in the XML output. So, curently, `arc diff` works (one target, all files) and `arc diff x` works (one target, x) but `arc diff x y` does not (more than one target, hits the exception).

  $ arc diff QUACK2 QUACK3
  Exception
  Expected exactly one XML status target.

Test Plan: Ran `arc diff QUACK2 QUACK3` in a working copy with modified QUACK2, QUACK3. Ran `arc diff`; `arc diff QUACK2`.

Reviewers: vrana, btrahan, codeblock, JThramer

Reviewed By: codeblock

CC: aran

Differential Revision: https://secure.phabricator.com/D4372
This commit is contained in:
epriestley 2013-01-09 09:11:26 -08:00
parent ea1585d7fa
commit 57ec5a026d

View file

@ -80,48 +80,45 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
}
$xml = new SimpleXMLElement($status);
if (count($xml->target) != 1) {
throw new Exception("Expected exactly one XML status target.");
}
$externals = array();
$files = array();
$target = $xml->target[0];
$this->svnBaseRevisions = array();
foreach ($target->entry as $entry) {
$path = (string)$entry['path'];
$mask = 0;
foreach ($xml->target as $target) {
$this->svnBaseRevisions = array();
foreach ($target->entry as $entry) {
$path = (string)$entry['path'];
$mask = 0;
$props = (string)($entry->{'wc-status'}[0]['props']);
$item = (string)($entry->{'wc-status'}[0]['item']);
$props = (string)($entry->{'wc-status'}[0]['props']);
$item = (string)($entry->{'wc-status'}[0]['item']);
$base = (string)($entry->{'wc-status'}[0]['revision']);
$this->svnBaseRevisions[$path] = $base;
$base = (string)($entry->{'wc-status'}[0]['revision']);
$this->svnBaseRevisions[$path] = $base;
switch ($props) {
case 'none':
case 'normal':
break;
case 'modified':
$mask |= self::FLAG_MODIFIED;
break;
default:
throw new Exception("Unrecognized property status '{$props}'.");
switch ($props) {
case 'none':
case 'normal':
break;
case 'modified':
$mask |= self::FLAG_MODIFIED;
break;
default:
throw new Exception("Unrecognized property status '{$props}'.");
}
$mask |= $this->parseSVNStatus($item);
if ($item == 'external') {
$externals[] = $path;
}
// This is new in or around Subversion 1.6.
$tree_conflicts = ($entry->{'wc-status'}[0]['tree-conflicted']);
if ((string)$tree_conflicts) {
$mask |= self::FLAG_CONFLICT;
}
$files[$path] = $mask;
}
$mask |= $this->parseSVNStatus($item);
if ($item == 'external') {
$externals[] = $path;
}
// This is new in or around Subversion 1.6.
$tree_conflicts = (string)($entry->{'wc-status'}[0]['tree-conflicted']);
if ($tree_conflicts) {
$mask |= self::FLAG_CONFLICT;
}
$files[$path] = $mask;
}
foreach ($files as $path => $mask) {