1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-28 17:52:43 +01:00
phorge-phorge/src/applications/diffusion/query
epriestley 5660684d7f Never use "{branches}" in Mercurial
Summary:
Fixes T5304. Mercurial features a "{branches}" template keyword, documented as:

```
    branches      List of strings. The name of the branch on which the
                  changeset was committed. Will be empty if the branch name
                  was default.
```

At some time long in the past, I misinterpreted this to mean "list of branches where the branch head is a descendant of the commit". It is more like "list of zero or one elements, possibly containing the name of the branch the commit was originally made to, if that branch was not 'default'".

In fact, it seems like this is because a //very// long time in the past, Mercurial worked roughly like I expected:

> Ages ago (2005), we had a very different and ultimately unworkable
> approach to named branches that worked vaguely like .hgtags and allowed
> multiple branch names per revision.

http://marc.info/?l=mercurial-devel&m=129883069414855

This appears to be deprecated in modern Mercurial (it's not in the modern web documentation) although I can't find a commit about it so maybe that's just a documentation issue.

In any case, `{branches}` seems to never be useful: `{branch}` provides the same information without the awkward "default-if-empty" case.

Switch from `{branches}` to either `{branch}` (where that's good enough, notably in the hook engine) or `(descendants(%s) and head())`, which is equivalent to `--contains` in Git.

This fixes pushing to branches with spaces in their names, and makes the "Branches" / "Contains" queries moderately more consistent.

Test Plan:
  - Pushed to a Mercurial branch with a space in it.
  - Viewed list of branches in a Mercurial repository.
  - Viewed containing branches of a Mercurial commit in Diffusion.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5304

Differential Revision: https://secure.phabricator.com/D9453
2014-06-20 11:48:31 -07:00
..
__tests__ Allow parenthesis in author name 2014-03-06 11:28:46 -08:00
filecontent Change double quotes to single quotes. 2014-06-09 11:36:50 -07:00
lowlevel Never use "{branches}" in Mercurial 2014-06-20 11:48:31 -07:00
pathchange Don't show changes for commits which affect more than 1,000 files 2013-01-30 12:01:49 -08:00
pathid Various linter fixes. 2014-02-26 12:44:58 -08:00
rawdiff Change double quotes to single quotes. 2014-06-09 11:36:50 -07:00
DiffusionCommitQuery.php Change double quotes to single quotes. 2014-06-09 11:36:50 -07:00
DiffusionLintCountQuery.php Change double quotes to single quotes. 2014-06-09 11:36:50 -07:00
DiffusionPathQuery.php Delete license headers from files 2012-11-05 11:16:51 -08:00
DiffusionQuery.php Change double quotes to single quotes. 2014-06-09 11:36:50 -07:00
DiffusionRenameHistoryQuery.php Fix an issue with pulling Subversion blame data 2013-11-07 12:10:43 -08:00
DiffusionResolveUserQuery.php Provide a standalone query for resolution of commit author/committer into Phabricator users 2013-12-19 11:05:17 -08:00
DiffusionSymbolQuery.php Change double quotes to single quotes. 2014-06-09 11:36:50 -07:00