@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.

Consider identifier types when sorting clone URIs

Summary:
Fixes T11082. Currently, the `/123/` and `/CALLSIGN/` versions of the URI get the same score.

Also the scores are backwards.

Test Plan:
- Added `getPublicCloneURI()` output to repository listing.
- Before patch, saw a repository with a callsign list a less-preferred ID-based URI.
- After patch, saw the repository list the more-preferred callsign-based URI.

Reviewers: chad

Reviewed By: chad

Subscribers: nikolay.metchev

Maniphest Tasks: T11082

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

+16 -6
+4 -1
src/applications/repository/storage/PhabricatorRepository.php
··· 2061 2061 $clone[] = $uri; 2062 2062 } 2063 2063 2064 - return msort($clone, 'getURIScore'); 2064 + $clone = msort($clone, 'getURIScore'); 2065 + $clone = array_reverse($clone); 2066 + 2067 + return $clone; 2065 2068 } 2066 2069 2067 2070
+12 -5
src/applications/repository/storage/PhabricatorRepositoryURI.php
··· 598 598 $score = 0; 599 599 600 600 $io_points = array( 601 - self::IO_READWRITE => 20, 602 - self::IO_READ => 10, 601 + self::IO_READWRITE => 200, 602 + self::IO_READ => 100, 603 603 ); 604 604 $score += idx($io_points, $this->getEffectiveIoType(), 0); 605 605 606 606 $protocol_points = array( 607 - self::BUILTIN_PROTOCOL_SSH => 3, 608 - self::BUILTIN_PROTOCOL_HTTPS => 2, 609 - self::BUILTIN_PROTOCOL_HTTP => 1, 607 + self::BUILTIN_PROTOCOL_SSH => 30, 608 + self::BUILTIN_PROTOCOL_HTTPS => 20, 609 + self::BUILTIN_PROTOCOL_HTTP => 10, 610 610 ); 611 611 $score += idx($protocol_points, $this->getBuiltinProtocol(), 0); 612 + 613 + $identifier_points = array( 614 + self::BUILTIN_IDENTIFIER_SHORTNAME => 3, 615 + self::BUILTIN_IDENTIFIER_CALLSIGN => 2, 616 + self::BUILTIN_IDENTIFIER_ID => 1, 617 + ); 618 + $score += idx($identifier_points, $this->getBuiltinIdentifier(), 0); 612 619 613 620 return $score; 614 621 }