1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

Silence Mercurial warning for lastmodified query; minor cleanup

Summary:
See <https://github.com/facebook/phabricator/issues/102>. Commit data may not be available for unpared commits, but we'll raise a warning about $commit_data in that case (the UI correctly handles missing $commit_data).

Also some minor cleanup / UI fixes.

Test Plan: Browsed around hg / git repos, including unparsed commits.

Reviewers: btrahan, killermonk

Reviewed By: btrahan

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1961
This commit is contained in:
epriestley 2012-03-19 19:19:55 -07:00
parent ec736f9c50
commit 0f45e85ce5
5 changed files with 14 additions and 16 deletions

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,16 +28,15 @@ final class DiffusionGitLastModifiedQuery extends DiffusionLastModifiedQuery {
$drequest->getPath());
$hash = trim($hash);
$commit_data = null;
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %d AND commitIdentifier = %s',
$repository->getID(),
$hash);
if ($commit) {
$commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
'commitID = %d',
$commit->getID());
$commit_data = $commit->loadCommitData();
} else {
$commit_data = null;
}
return array($commit, $commit_data);

View file

@ -8,7 +8,6 @@
phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
phutil_require_module('phabricator', 'applications/repository/storage/commit');
phutil_require_module('phabricator', 'applications/repository/storage/commitdata');
phutil_require_module('phutil', 'utils');

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,20 +28,20 @@ final class DiffusionMercurialLastModifiedQuery
// TODO: Share some of this with History query.
list($hash) = $repository->execxLocalCommand(
'log --template %s --limit 1 --branch %s --rev %s:0 -- %s',
'{node}\\n',
'{node}',
$drequest->getBranch(),
$drequest->getCommit(),
nonempty(ltrim($path, '/'), '.'));
$hash = trim($hash);
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %d AND commitIdentifier = %s',
$repository->getID(),
$hash);
if ($commit) {
$commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
'commitID = %d',
$commit->getID());
$commit_data = $commit->loadCommitData();
} else {
$commit_data = null;
}
return array($commit, $commit_data);

View file

@ -8,7 +8,6 @@
phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
phutil_require_module('phabricator', 'applications/repository/storage/commit');
phutil_require_module('phabricator', 'applications/repository/storage/commitdata');
phutil_require_module('phutil', 'utils');

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -124,7 +124,8 @@ abstract class DiffusionView extends AphrontView {
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$commit_name = substr($commit, 0, 16);
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
$commit_name = substr($commit, 0, 12);
break;
default:
$commit_name = $commit;