Page MenuHomePhabricator

D14990.diff
No OneTemporary

D14990.diff

diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php
--- a/src/applications/diffusion/controller/DiffusionBrowseController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseController.php
@@ -1761,7 +1761,7 @@
'size' => 600,
),
),
- $commit->getShortName());
+ $commit->getLocalName());
$links[$identifier] = $commit_link;
}
diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php
--- a/src/applications/diffusion/view/DiffusionView.php
+++ b/src/applications/diffusion/view/DiffusionView.php
@@ -128,7 +128,7 @@
$commit,
$summary = '') {
- $commit_name = $repository->formatCommitName($commit);
+ $commit_name = $repository->formatCommitName($commit, $local = true);
if (strlen($summary)) {
$commit_name .= ': '.$summary;
diff --git a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php
--- a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php
+++ b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php
@@ -160,10 +160,16 @@
$commit = $repository->getMostRecentCommit();
if ($commit) {
- $commit_link = DiffusionView::linkCommit(
- $repository,
- $commit->getCommitIdentifier(),
- $commit->getSummary());
+ $commit_link = phutil_tag(
+ 'a',
+ array(
+ 'href' => $commit->getURI(),
+ ),
+ pht(
+ '%s: %s',
+ $commit->getLocalName(),
+ $commit->getSummary()));
+
$item->setSubhead($commit_link);
$item->setEpoch($commit->getEpoch());
}
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -924,7 +924,7 @@
return $this->isBranchInFilter($branch, 'branch-filter');
}
- public function formatCommitName($commit_identifier) {
+ public function formatCommitName($commit_identifier, $local = false) {
$vcs = $this->getVersionControlSystem();
$type_git = PhabricatorRepositoryType::REPOSITORY_TYPE_GIT;
@@ -933,12 +933,23 @@
$is_git = ($vcs == $type_git);
$is_hg = ($vcs == $type_hg);
if ($is_git || $is_hg) {
- $short_identifier = substr($commit_identifier, 0, 12);
+ $name = substr($commit_identifier, 0, 12);
+ $need_scope = false;
} else {
- $short_identifier = $commit_identifier;
+ $name = $commit_identifier;
+ $need_scope = true;
}
- return 'r'.$this->getCallsign().$short_identifier;
+ if (!$local) {
+ $need_scope = true;
+ }
+
+ if ($need_scope) {
+ $scope = 'r'.$this->getCallsign();
+ $name = $scope.$name;
+ }
+
+ return $name;
}
public function isImporting() {
diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
--- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
@@ -266,9 +266,20 @@
return $repository->formatCommitName($identifier);
}
- public function getShortName() {
+ /**
+ * Return a local display name for use in the context of the containing
+ * repository.
+ *
+ * In Git and Mercurial, this returns only a short hash, like "abcdef012345".
+ * See @{method:getDisplayName} for a short name that always includes
+ * repository context.
+ *
+ * @return string Short human-readable name for use inside a repository.
+ */
+ public function getLocalName() {
+ $repository = $this->getRepository();
$identifier = $this->getCommitIdentifier();
- return substr($identifier, 0, 9);
+ return $repository->formatCommitName($identifier, $local = true);
}
public function renderAuthorLink($handles) {

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 30, 11:54 PM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714209
Default Alt Text
D14990.diff (4 KB)

Event Timeline