How to make Git Commits Show in a Project's "Recent Activity" Feed


#1

Does anyone know how to make a Git Commit (Diffusion) show in a project’s Recent Activity feed? According to this link (https://secure.phabricator.com/T6973), they should show up when you include the hashtag for the project in the commit’s message. That isn’t what actually happens. The commits do not show anywhere.

Another user here (@avivey) said that this works, but it shows the commits in the “Manage” page. But (a) he was not correct and (b) that would not be a good solution. You want the commits to appear in a project’s default view/feed.

Has anyone found a way to do this?

Second question: if you do not do this, how do your users know when there is a commit? Do they have to click around the interface to all repos just to see if there are new commits?


#2

I’m not sure, but I think you need to include Tags: #project in you commit message.

Another way would be to set up some kind of Herald rule to tag certain commits, or use Owners. It depends on why you want them to know there is a new commit.


#3

@ivo Do you actually mean the whole phrase “Tags: #project” has to be in the commit message? I already said in the post that I am including just the project’s hashtag but it doesn’t show up.

I don’t know what Herald or Owners is but I don’t have the time or interest to learn the inner workings of a PM system. This is the system that should be easy for every end-user with no tech skills to use so we can maintain our 40 other technical services. :slight_smile:


#4

Yes, that is what I mean.

I don’t know what Herald or Owners is but I don’t have the time or interest to learn the inner workings of a PM system. This is the system that should be easy for every end-user with no tech skills to use so we can maintain our 40 other technical services. :slight_smile:

Why do you want users with no tech skills to know when there is a new commit?


#5

This problem interested me because I thought it would also be useful for my users, however unless I did something wrong, I’m not sure the use of:

Tags: #projecthash

is enough to make it appear (so I did a little test)… whilst I can see that it highlighted the project in the commit

image

there is nothing back in the TestProject Recent Activity other than the new project creation

image

and I don’t see this in the “Projects Manage”, which doesn’t show the commits on the project history either

image

For the commits to appear in the “Recent Activity” of a Project then those commits would need to be added in PhabricatorProjectProfileController.php (in phabricator/src/applications/project/controller) possibly in this section

$feed_header = id(new PHUIHeaderView())
  ->setHeader(pht('Recent Activity'))
  ->addActionLink($view_all);

$feed = $this->renderStories($stories);
$feed = id(new PHUIObjectBoxView())
  ->setHeader($feed_header)
  ->addClass('project-view-feed')
  ->appendChild($feed);

Those stories comes from

$stories = id(new PhabricatorFeedQuery())
  ->setViewer($viewer)
  ->withFilterPHIDs(
    array(
      $project->getPHID(),
    ))
  ->setLimit(50)
  ->execute();

can PhabricatorFeedQuery can be used fetch the commits that have associated #project tags

This whole topic seems to be described here:

https://secure.phabricator.com/T6973

and the conversion seems to suggest that the commit should indeed show up. (but I couldn’t get it to work)

But perhaps the solution IS the Herald rule


#6

As I look on secure.phabricator.com I wonder if commits in the projects “Recent Activity” are by virtue of the fact they are associated with a Maniphest task as opposed to being a commit with no task associated with it.


#7

So they can download the new files to use on their systems. Also so the managers can see progress of many developers commits. Probably the managers will only read the comments?


#8

@ivo

Yes, that is what I mean.

This also does not have the desired effect. I added a git commit as:

$ git commit -m "Tags: #project_hashtag"

But it still does not show a commit in the project feed.


#9

If there is one Herald rule that will do this for all repos in the future then that is ok. But I do not have time to set up new rules for every one of dozens of developers creating 5-20 repos each. I have real systems to fix. I don’t have time to make the project management system do a good job. This is such an obvious and basic feature.


#10

This whole topic seems to be described here:
https://secure.phabricator.com/T6973

That is why I gave that link in my OP. But in that link you will see that the OP wanted another feature. OP was already having success using the hashtag method.


#11

So here is something else, if you visit the Feed app and view All Stories

image

You’ll see the TestProject commit in the recent activity

image

However if you switch to Advanced search, and add your project tag

That commit will disappear, which is a clear indication the commit is not related with the project and hence it won’t turn up in the PhabricatorFeedQuery which the project uses to build a list of project related events.

In fact it seems almost impossible to do a Feed Advanced Search which actually pulls out commits other than in the case where tasks and commits are associated.

But what I noticed was that the commits on secure.phabricator.com have the projects at the bottom, where as the above test commit had nothing

But I see nothing in the contents of the commit’s message that would tie that commit to the project,Other than the indirection via the maniphest task

see https://secure.phabricator.com/rPee32c186dd822b90826514ff8fc61740ebc8bd68

Notice also the tags in the commit are actually “None”

image

Where as the tags in the Task matches those seen in the Feeds commit

image

What I also noticed in my test commit was that the Tags is also “None” despite me putting the Tags: in the commit message

It would appear that “Tags:” in the commit message does not add those tags directly to the commit,

Its hard to know if this is a bug, missing functionality or something that is still a TODO. But I cannot see how to add Tags directly to the commit. (I’ve tried commits with both git and arc)

But it does seem odd that you can’t use the “Diffusion,Commit,Advanced Search” in order to locate a commit for a given Project when that project was added to the commit message

But I guess whilst Tags is empty that is to be expected.


#12

Tags can be added to a commit after the fact, using the “Edit Commit”

image

This makes it appear in the Diffuion Commit Advanced Search

But only in the project Recent Activity, by the virtue of the manual addition

image

And only in the “Feed Advanced Search” by the same virtue

I guess the question for those that know, is should “Tags:” be able to be interpreted during the import of the commit


#13

@mydeveloperday: If you look closely at the feed image you attached, the wording is "added a commit to ", not “committed” - this is a feed event generated by the task, because it has a new activity (attached commit), not from the commit itself.

Commit: image
Commit added to task: image

That’s why it has a tag. There’s also some “feed event aggregation” going on, so you don’t see both events for the same commit.


As to syntax in commit messages - see https://secure.phabricator.com/T5132 - doesn’t look like “Tags:” is a thing.


#14

I’m fine with the limitations.

In a situation where your using Phabricator for everything (Source Control Hosting,Task Management,Project Management) then what we get works obviously very well and is excellent.
(I actually love the inter-connectedness of each issue, I tend to go on on huge walks through the code from task to task)

But Phabricator isn’t always being used to manage everything (especially as your trying to transition legacy groups to phabricator), bugs/tasks could be in external system, some are only using Differential for code review (and not even source code hosting).

In a situation where a commit is made without an associated task or even a code review (I know that’s bad) but its likely not to be tied to anything, even if the user does add good information in the commit message (and the audit is performed)

Of course not all our users are always using arcanist, some are committing from git on the command line or from within Visual Studio or a huge range of other tools, and establishing a good commit message template and getting that out there can be a difficult job for those of us managing/educating hundreds of our users.

Despite some good bits in the documentation I have to say I still get confused about what should be put in

Differential Revision: DXXX or URI

Should tasks be just TXXX or {TXXX} do I need to say Ref or Refs (do I need a colon?) and can this go anywhere or must it be in the Summary (is that just of the Differential or is it the Commit message if I have no review or both?)

To me it seems that sometimes things just don’t seem to link up the way it feels like it does when you come at it form another angle. Sometimes that linking seems almost automatic and sometimes that linking needs to be manual via the “Edit Related…”

I myself only recently have struggled with understanding how to make Commits appear in a task details and not just in the Mentions as demonstrated (https://secure.phabricator.com/T8168), and even now I’m not sure I truly understand.

Perhaps it is too much for everything to be automatically linked to everything, or perhaps it just needs one of us to propose it as an idea. Or maybe that would be just too much work for relatively little gain.

Regardless, I still think Phabricator is the best tool I’ve every used.


#15

That is not necessary. But there should at least be a manual way for having commits show up in the Project feed. have you found a way to do this?

Really? We had to stop using it because of this issue, and the fact that there is no easy way to create a custom form for Bugs. Honestly I think that Phabricator has potential to be excellent but as it stands now it is the least usable out of five different open source programs we tried. It is actually not possible for us to use it without fixes to this and other problems.


#16

Manual Connection is “sort of possible” via

Edit commit,

image

then add the tag

And you see this in the Projects Recent Activity


#17

Really? We had to stop using it because of this issue, and the fact that there is no easy way to create a custom form for Bugs. Honestly I think that Phabricator has potential to be excellent but as it stands now it is the least usable out of five different open source programs we tried. It is actually not possible for us to use it without fixes to this and other problems.

From what I’ve seen so far in the 2 years we’ve been using it, Phabricator gives a solid platform, but also give me the greatest potential to bend the system to my own will as long as I’m prepared to do a bit of php development.

The open development, the open source, the choice to run on-prem, plus there is such an amazing support community plus access to the main developers is hands down the winner for me…

The slightly closed system in terms of contributions could be seen as a limitation, but actually very few of us are qualified to really contribute safely to this project, without understanding all the ramifications. But I think if you had a good idea this would be the place to air it…

I’m sure the competition have more developers, can potentially move quicker, but I cannot recommend those solutions from my experience (some of which is limited), based on some of them being “Closed Source”

Phabricator is changing the way we work in not just our team but its also influencing the company. which has many 20+ year old projects with legacy code of many millions of lines in a mixture of languages, and Phabricator is handling the conversion like a dream!


#18

Manual Connection is “sort of possible” via

That option will not work. It would require every commit to be paired with a login to the GUI and that defeats the purpose of using something like Git which can be done in scripts or from a command line.


#19

I have not seen it’s platform being more solid than any of the others

I’m not. I’m not a PHP developer. I’m a Systems Administrator. And I have too many projects that I administer to also make deep, fundamental fixes to the platform I use to manage those projects.

Really? This has been my biggest disappointment. You are the only person who has tried to help with these issues and the issues are serious enough that I won’t be able to begin to use Phabricator until they are solved.

I don’t know anything about that. Do you mean Aviv? I didn’t know if he’s a developer but he is very defensive when you point out issues with the project. He is not at all helpful. Kind of a little baby really.

I do. I have an idea that makes the difference between Phabricator being useful for a development team and not being useful for a development team: allow repos to be children of or at least tied to Projects. And I have aired it. And no one cares.


#20

I’ve tried to write a “PhabricatorProjectCommitsController” controller to help, but I’m stuck…

The long and short is I’m unclear how it would be possible to extract those commits which have a project tag associated with them, and for this we’d need advice from the devs to determine if this is even possible

 private function buildCommitsView(PhabricatorProject $project) {
    $viewer = $this->getViewer();

    $commits = id(new DiffusionCommitQuery())
      ->setViewer($viewer)
      //  ->withPHIDs(array($project->getPHID()))  // this wouldn't work, because this is the phid of the commit not the project
      ->needCommitData(true)
      ->setLimit(100)
      ->execute();

    $list = id(new DiffusionCommitListView())
      ->setViewer($viewer)
      ->setCommits($commits)
      ->setNoDataString(pht('No recent commits.'));

    return $list;
  }