@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Show refs in Diffusion for Git commits

Summary: In Diffusion, for Git, show commit refs (like "origin/master, origin/HEAD").

Test Plan: Looked at several Git, Hg and SVN commits.

Reviewers: davidreuss, btrahan, vrana, jungejason

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1130

Differential Revision: https://secure.phabricator.com/D2311

+26 -2
+26 -2
src/applications/diffusion/controller/commit/DiffusionCommitController.php
··· 352 352 } 353 353 354 354 355 - $tags = $this->renderTags($request); 355 + $tags = $this->buildTags($request); 356 356 if ($tags) { 357 357 $props['Tags'] = $tags; 358 + } 359 + 360 + $refs = $this->buildRefs($request); 361 + if ($refs) { 362 + $props['Refs'] = $refs; 358 363 } 359 364 360 365 if ($task_phids) { ··· 726 731 return $action_list; 727 732 } 728 733 729 - private function renderTags(DiffusionRequest $request) { 734 + private function buildTags(DiffusionRequest $request) { 730 735 $tag_limit = 10; 731 736 732 737 $tag_query = DiffusionCommitTagsQuery::newFromDiffusionRequest($request); ··· 769 774 $tag_links = implode(', ', $tag_links); 770 775 771 776 return $tag_links; 777 + } 778 + 779 + private function buildRefs(DiffusionRequest $request) { 780 + // Not turning this into a proper Query class since it's pretty simple, 781 + // one-off, and Git-specific. 782 + 783 + $type_git = PhabricatorRepositoryType::REPOSITORY_TYPE_GIT; 784 + 785 + $repository = $request->getRepository(); 786 + if ($repository->getVersionControlSystem() != $type_git) { 787 + return null; 788 + } 789 + 790 + list($stdout) = $repository->execxLocalCommand( 791 + 'log --format=%s -n 1 %s --', 792 + '%d', 793 + $request->getCommit()); 794 + 795 + return trim($stdout, "() \n"); 772 796 } 773 797 774 798 }