Page MenuHomePhabricator

Mercurial Branches with Spaces Causes Problems
Closed, ResolvedPublic

Description

Trying to push a single branch close commit for a branch named "DialogUtils changes" causes the following failure. I've tried other branches in the repo and the unknown revisions '...' message always contains a word in the branch name, so I suspect the spaces are the issue.

pushing to <URL>
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 0 changes to 0 files
remote: No entry for terminal type "unknown";
remote: using dumb terminal settings.
remote: [2014-06-10 07:48:05] EXCEPTION: (CommandException) Command failed with error #255!
remote: COMMAND
remote: hg log --branch 'changes' --rev '(descendants('\''e7a666cac3762ab93a848f3954771d0be380107f'\'') and head())' --template '{node}\1'
remote:
remote: STDOUT
remote: (empty)
remote:
remote: STDERR
remote: abort: unknown revision 'changes'!
remote: at [<PATH>/libphutil/src/future/exec/ExecFuture.php:398]
remote: #0 ExecFuture::resolvex() called at [<PATH>/phabricator/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:778]
remote: #1 DiffusionCommitHookEngine::findMercurialChangegroupRefUpdates() called at [<PATH>/phabricator/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:666]
remote: #2 DiffusionCommitHookEngine::findMercurialRefUpdates() called at [<PATH>/phabricator/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:202]
remote: #3 DiffusionCommitHookEngine::findRefUpdates() called at [<PATH>/phabricator/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:124]
remote: #4 DiffusionCommitHookEngine::execute() called at [<PATH>/phabricator/scripts/repository/commit_hook.php:104]
remote: transaction abort!
remote: rollback completed
remote: abort: pretxnchangegroup.phabricator hook exited with status 255

Revisions and Commits

Event Timeline

rbanderton raised the priority of this task from to Needs Triage.
rbanderton updated the task description. (Show Details)
rbanderton added a project: Diffusion.
rbanderton added a subscriber: rbanderton.

Can you find a Mercurial command which unambiguously shows which branches a commit appears on?

We currently use something like this:

$ hg log --rev X --template '{branches}'

However, the output of this command (a b) is the same whether the commit appears on branches a and b, or appears on branch a b.

In theory, it seems like we should be able to use join() to select some other joiner. However, at least in my version of Mercurial, I can't get this to work:

$ hg log --template '{join(branches, "X")}\n'
** unknown exception encountered, please report by visiting
...
TypeError: 'NoneType' object is not iterable

In fact, the examples on the templates page (http://www.selenic.com/hg/help/templates) don't work for me:

$ hg log -r 0 --template "{ifeq(branch, 'default', 'on the main branch', 'on branch {branch}')}\n"
** unknown exception encountered, please report by visiting
...
TypeError: 'NoneType' object is not iterable

To my knowledge in mercurial a single commit can only have one branch, but in general you could do something like this:

$ hg log --rev X --template '{branches}\n'

to get the branch names, one per line

D9453 should resolve this.

(Mildly interesting: Mercurial branch names are permitted to contain newlines.)

epriestley triaged this task as Normal priority.
epriestley added a project: Mercurial.