Summary:
This increases the amount of information arc diff collects in
Mercurial repositories. IN particular, it collects the active
bookmark, if there is one, and svn information in hgsubversion
repositories.
The Phabricator half of this is https://secure.phabricator.com/D2897
Test Plan:
[14:06:59 Sat Jun 30 2012] dschleimer@dev4022.snc6 ~/www-hg
www-hg 2941 $ ~/devtools/arcanist/bin/arc diff --only --conduit-uri http://phabricator.dschleimer.dev4022.facebook.com
HipHop Notice: Undefined index: 1 in /data/users/dschleimer/devtools/arcanist/src/repository/api/ArcanistMercurialAPI.php on line 708
Created a new Differential diff:
Diff URI: http://phabricator.dschleimer.dev4022.facebook.com/differential/diff/126/
Included changes:
A foo
HipHop Notice: Undefined index: 1 in /data/users/dschleimer/www-hg/lib/arcanist/arcanist/FacebookArcanistConfiguration.php on line 81
mcproxy on this server is out of date
version: , expected version:
please restart (http://fburl.com/
1787362)
[14:07:46 Sat Jun 30 2012] dschleimer@dev4022.snc6 ~/www-hg
www-hg 2941 $ echo '{"diff_id": 126}' | ~/devtools/arcanist/bin/arc call-conduit differential.getdiff --conduit-uri http://phabricator.dschleimer.dev4022.facebook.com | json_pretty | egrep -i 'bookmark|sourcecontrol'
"bookmark": "bar",
"sourceControlBaseRevision": "svn+ssh://tubbs/svnroot/tfb/trunk/www@583442",
"sourceControlPath": "svn+ssh://tubbs/svnroot/tfb/trunk/www",
"sourceControlSystem": "hg",
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Maniphest Tasks: T1331
Differential Revision: https://secure.phabricator.com/D2896
}
+ public function getSubversionInfo() {
+ $info = array();
+ $base_path = null;
+ $revision = null;
+ list($err, $raw_info) = $this->execManualLocal('svn info');
+ if (!$err) {
+ foreach (explode("\n", trim($raw_info)) as $line) {
+ list($key, $value) = explode(': ', $line, 2);
+ switch ($key) {
+ case 'URL':
+ $info['base_path'] = $value;
+ $base_path = $value;
+ break;
+ case 'Repository UUID':
+ $info['uuid'] = $value;
+ break;
+ case 'Revision':
+ $revision = $value;
+ break;
+ default:
+ break;
+ }
+ }
+ if ($base_path && $revision) {
+ $info['base_revision'] = $base_path.'@'.$revision;
+ }
+ }
+ return $info;
+ }
+
+ public function getActiveBookmark() {
+ list($raw_output) = $this->execxLocal('bookmarks');
+ $raw_output = trim($raw_output);
+ if ($raw_output !== 'no bookmarks set') {
+ foreach (explode("\n", $raw_output) as $line) {
+ $line = trim($line);
+ if ('*' === $line[0]) {
+ return idx(explode(' ', $line, 3), 1);
+ }
+ }
+ }
+ return null;
+ }
+
}
$parent = null;
$source_path = null;
$branch = null;
+ $bookmark = null;
if (!$this->isRawDiffSource()) {
$repository_api = $this->getRepositoryAPI();
} else if ($repository_api instanceof ArcanistSubversionAPI) {
$repo_uuid = $repository_api->getRepositorySVNUUID();
} else if ($repository_api instanceof ArcanistMercurialAPI) {
- // TODO: Provide this information.
+
+ $bookmark = $repository_api->getActiveBookmark();
+ $svn_info = $repository_api->getSubversionInfo();
+ $repo_uuid = idx($svn_info, 'uuid');
+ $base_path = idx($svn_info, 'base_path', $base_path);
+ $base_revision = idx($svn_info, 'base_revision', $base_revision);
+
+ // TODO: provide parent info
+
} else {
throw new Exception("Unsupported repository API!");
}
'sourceMachine' => php_uname('n'),
'sourcePath' => $source_path,
'branch' => $branch,
+ 'bookmark' => $bookmark,
'sourceControlSystem' => $vcs,
'sourceControlPath' => $base_path,
'sourceControlBaseRevision' => $base_revision,