Select the types of activity you want to include in your feed.
@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
···46464747 $branch = $this->getBranch();
48484949+ // TODO: Here, particularly, we should give the user a specific error
5050+ // message to indicate whether they've typed in some bogus branch and/or
5151+ // followed a bad link, or misconfigured the default branch in the
5252+ // Repository tool.
4953 execx(
5054 '(cd %s && git rev-parse --verify %s)',
5155 $local_path,
···11+<?php
22+33+/*
44+ * Copyright 2011 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+abstract class PhabricatorRepositoryCommitMessageDetailParser {
2020+2121+ private $commit;
2222+ private $commitData;
2323+2424+ final public function __construct(
2525+ PhabricatorRepositoryCommit $commit,
2626+ PhabricatorRepositoryCommitData $data) {
2727+ $this->commit = $commit;
2828+ $this->commitData = $data;
2929+ }
3030+3131+ final public function getCommit() {
3232+ return $this->commit;
3333+ }
3434+3535+ final public function getCommitData() {
3636+ return $this->commitData;
3737+ }
3838+3939+ public function resolveUserPHID($user_name) {
4040+ if (!strlen($user_name)) {
4141+ return null;
4242+ }
4343+4444+ $by_username = id(new PhabricatorUser())->loadOneWhere(
4545+ 'userName = %s',
4646+ $user_name);
4747+ if ($by_username) {
4848+ return $by_username->getPHID();
4949+ }
5050+5151+ // Note, real names are not guaranteed unique, which is why we do it this
5252+ // way.
5353+ $by_realname = id(new PhabricatorUser())->loadAllWhere(
5454+ 'realName = %s LIMIT 1',
5555+ $user_name);
5656+ if ($by_realname) {
5757+ $by_realname = reset($by_realname);
5858+ return $by_realname->getPHID();
5959+ }
6060+6161+ return null;
6262+ }
6363+6464+ abstract public function parseCommitDetails();
6565+6666+}
···11+<?php
22+/**
33+ * This file is automatically generated. Lint this module to rebuild it.
44+ * @generated
55+ */
66+77+88+99+phutil_require_module('phabricator', 'applications/people/storage/user');
1010+1111+phutil_require_module('phutil', 'utils');
1212+1313+1414+phutil_require_source('PhabricatorRepositoryCommitMessageDetailParser.php');
···11+<?php
22+33+/*
44+ * Copyright 2011 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+class PhabricatorRepositoryDefaultCommitMessageDetailParser
2020+ extends PhabricatorRepositoryCommitMessageDetailParser {
2121+2222+ public function parseCommitDetails() {
2323+ $commit = $this->getCommit();
2424+ $data = $this->getCommitData();
2525+2626+ $details = nonempty($data->getCommitDetails(), array());
2727+ $message = $data->getCommitMessage();
2828+ $author_name = $data->getAuthorName();
2929+3030+ $match = null;
3131+3232+ if (preg_match(
3333+ '/^\s*Differential Revision:\s*(\S+)\s*$/mi',
3434+ $message,
3535+ $match)) {
3636+3737+ $id = (int)$match[1];
3838+ if ($id) {
3939+ $details['differential.revisionID'] = (int)$match[1];
4040+ $revision = id(new DifferentialRevision())->load($id);
4141+ if ($revision) {
4242+ $details['differential.revisionPHID'] = $revision->getPHID();
4343+ }
4444+ }
4545+ }
4646+4747+ if (preg_match(
4848+ '/^\s*Reviewed By:\s*(\S+)\s*$/mi',
4949+ $message,
5050+ $match)) {
5151+ $details['reviewerName'] = $match[1];
5252+5353+ $reviewer_phid = $this->resolveUserPHID($details['reviewerName']);
5454+ if ($reviewer_phid) {
5555+ $details['reviewerPHID'] = $reviewer_phid;
5656+ }
5757+ }
5858+5959+ $author_phid = $this->resolveUserPHID($author_name);
6060+ if ($author_phid) {
6161+ $details['authorPHID'] = $author_phid;
6262+ }
6363+6464+ $data->setCommitDetails($details);
6565+ }
6666+6767+}
···11+<?php
22+/**
33+ * This file is automatically generated. Lint this module to rebuild it.
44+ * @generated
55+ */
66+77+88+99+phutil_require_module('phabricator', 'applications/repository/parser/base');
1010+1111+phutil_require_module('phutil', 'utils');
1212+1313+1414+phutil_require_source('PhabricatorRepositoryDefaultCommitMessageDetailParser.php');