1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 21:32:43 +01:00

Fix a Mercurial issue where split heads would be detected incorrectly

Summary: Ref T5197. When searching for split branch heads, we incorrectly consider descendant heads of other branches. This can cause us to detect a split tip when one does not exist (the old tip is the branch tip, but other descendant heads exist). Instead, consider only heads on the same branch.

Test Plan:
Repro is something like this:

  - `hg update default`
  - `hg branch branch1; hg commit ...`
  - `hg push`
  - `hg update default; hg commit ...`
  - `hg push` - Previously, we would find the head of `branch1` and incorrectly account for it as a head of `default`.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5197

Differential Revision: https://secure.phabricator.com/D9308
This commit is contained in:
epriestley 2014-06-03 17:07:49 -07:00
parent bad7f3d49b
commit 66af361f10

View file

@ -760,10 +760,15 @@ final class DiffusionCommitHookEngine extends Phobject {
// repository that's already full of garbage (strongly discouraged but // repository that's already full of garbage (strongly discouraged but
// not as inherently dangerous). These cases should be very uncommon. // not as inherently dangerous). These cases should be very uncommon.
// NOTE: We're only looking for heads on the same branch. The old
// tip of the branch may be the branchpoint for other branches, but that
// is OK.
$dfutures = array(); $dfutures = array();
foreach ($old_heads as $old_head) { foreach ($old_heads as $old_head) {
$dfutures[$old_head] = $repository->getLocalCommandFuture( $dfutures[$old_head] = $repository->getLocalCommandFuture(
'log --rev %s --template %s', 'log --branch %s --rev %s --template %s',
$ref,
hgsprintf('(descendants(%s) and head())', $old_head), hgsprintf('(descendants(%s) and head())', $old_head),
'{node}\1'); '{node}\1');
} }