mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 15:22: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:
parent
ec736f9c50
commit
0f45e85ce5
5 changed files with 14 additions and 16 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2011 Facebook, Inc.
|
* Copyright 2012 Facebook, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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());
|
$drequest->getPath());
|
||||||
$hash = trim($hash);
|
$hash = trim($hash);
|
||||||
|
|
||||||
$commit_data = null;
|
|
||||||
|
|
||||||
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
|
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
|
||||||
'repositoryID = %d AND commitIdentifier = %s',
|
'repositoryID = %d AND commitIdentifier = %s',
|
||||||
$repository->getID(),
|
$repository->getID(),
|
||||||
$hash);
|
$hash);
|
||||||
|
|
||||||
if ($commit) {
|
if ($commit) {
|
||||||
$commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
|
$commit_data = $commit->loadCommitData();
|
||||||
'commitID = %d',
|
} else {
|
||||||
$commit->getID());
|
$commit_data = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($commit, $commit_data);
|
return array($commit, $commit_data);
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
|
||||||
phutil_require_module('phabricator', 'applications/repository/storage/commit');
|
phutil_require_module('phabricator', 'applications/repository/storage/commit');
|
||||||
phutil_require_module('phabricator', 'applications/repository/storage/commitdata');
|
|
||||||
|
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2011 Facebook, Inc.
|
* Copyright 2012 Facebook, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.
|
// TODO: Share some of this with History query.
|
||||||
list($hash) = $repository->execxLocalCommand(
|
list($hash) = $repository->execxLocalCommand(
|
||||||
'log --template %s --limit 1 --branch %s --rev %s:0 -- %s',
|
'log --template %s --limit 1 --branch %s --rev %s:0 -- %s',
|
||||||
'{node}\\n',
|
'{node}',
|
||||||
$drequest->getBranch(),
|
$drequest->getBranch(),
|
||||||
$drequest->getCommit(),
|
$drequest->getCommit(),
|
||||||
nonempty(ltrim($path, '/'), '.'));
|
nonempty(ltrim($path, '/'), '.'));
|
||||||
$hash = trim($hash);
|
|
||||||
|
|
||||||
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
|
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
|
||||||
'repositoryID = %d AND commitIdentifier = %s',
|
'repositoryID = %d AND commitIdentifier = %s',
|
||||||
$repository->getID(),
|
$repository->getID(),
|
||||||
$hash);
|
$hash);
|
||||||
|
|
||||||
if ($commit) {
|
if ($commit) {
|
||||||
$commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
|
$commit_data = $commit->loadCommitData();
|
||||||
'commitID = %d',
|
} else {
|
||||||
$commit->getID());
|
$commit_data = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($commit, $commit_data);
|
return array($commit, $commit_data);
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
|
||||||
phutil_require_module('phabricator', 'applications/repository/storage/commit');
|
phutil_require_module('phabricator', 'applications/repository/storage/commit');
|
||||||
phutil_require_module('phabricator', 'applications/repository/storage/commitdata');
|
|
||||||
|
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2011 Facebook, Inc.
|
* Copyright 2012 Facebook, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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()) {
|
switch ($repository->getVersionControlSystem()) {
|
||||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||||
$commit_name = substr($commit, 0, 16);
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
||||||
|
$commit_name = substr($commit, 0, 12);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$commit_name = $commit;
|
$commit_name = $commit;
|
||||||
|
|
Loading…
Reference in a new issue