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

Expand abbreviated Mercurial hashes to full hashes

Summary:
If you go to `/rXnnnn` in Git, we expand the hash. If you go to `/rXnnnn` in Mercurial, we give you a confusing error message.

Reconcile Mercurial behavior with Git. Fixes T2265.

Test Plan: Viewed partial hash, full hash commit in Diffusion. Viewed very short hash, got reasonable behaviors.

Reviewers: btrahan, tido

Reviewed By: tido

CC: aran

Maniphest Tasks: T2265

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

+23
+23
src/applications/diffusion/request/DiffusionMercurialRequest.php
··· 16 16 $this->raiseCloneException(); 17 17 } 18 18 19 + // Expand abbreviated hashes to full hashes so "/rXnnnn" (i.e., fewer than 20 + // 40 characters) works correctly. 21 + if (!$this->commit) { 22 + return; 23 + } 24 + 25 + if (strlen($this->commit) == 40) { 26 + return; 27 + } 28 + 29 + list($full_hash) = $this->repository->execxLocalCommand( 30 + 'log --template=%s --rev %s', 31 + '{node}', 32 + $this->commit); 33 + 34 + $full_hash = explode("\n", trim($full_hash)); 35 + 36 + // TODO: Show "multiple matching commits" if count is larger than 1. For 37 + // now, pick the first one. 38 + 39 + $this->commit = head($full_hash); 40 + 41 + 19 42 return; 20 43 } 21 44