Page MenuHomePhabricator

Error on first push to empty Mercurial repository
Closed, ResolvedPublic

Description

Hi,

I'm using the repository hosting features of Mercurial but I think i've encountered a bit of a show stopping bug. If I create a new hosted Mercurial repository, served via Read/Write HTTP, clone it, add some files, commit, and then push it back up, I get the following error:

remote: [2013-12-23 10:46:00] EXCEPTION: (CommandException) Command failed with error #1!
remote: COMMAND
remote: hg heads --template '{node}\1{branches}\2'
remote:
remote: STDOUT
remote: (empty)
remote:
remote: STDERR
remote: (empty) at [/root/phab/libphutil/src/future/exec/ExecFuture.php:398]
remote:   #0 ExecFuture::resolvex() called at [/root/phab/phabricator/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:586]
remote:   #1 DiffusionCommitHookEngine::findMercurialChangegroupRefUpdates() called at [/root/phab/phabricator/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:547]
remote:   #2 DiffusionCommitHookEngine::findMercurialRefUpdates() called at [/root/phab/phabricator/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:174]
remote:   #3 DiffusionCommitHookEngine::findRefUpdates() called at [/root/phab/phabricator/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:118]
remote:   #4 DiffusionCommitHookEngine::execute() called at [/root/phab/phabricator/scripts/repository/commit_hook.php:102]
remote: transaction abort!
remote: rollback completed
remote: abort: pretxnchangegroup.phabricator hook exited with status 255

I've done this a few times with different repos and it's the same everytime. Should be pretty each to replicate, my config is pretty simple. Ubuntu 12.04 with Apache 2.2.22.

Now, if I go into ExecFuture.php:398 and simply comment out where it returns an error, the push then goes ahead and works fine. But obviously this isn't a great solution - it's just what i've done for now so it works.

Event Timeline

squimmy raised the priority of this task from to High.
squimmy updated the task description. (Show Details)
squimmy added a subscriber: squimmy.
squimmy raised the priority of this task from High to Needs Triage.Dec 23 2013, 11:11 AM
squimmy added a project: Diffusion.

Thanks for the report. It looks like the expected behavior of hg heads in a repository with no heads is to exit with no output and an error code.

D7817 should resolve this. If you want to try testing it, you can apply it to your install with arc patch D7817. Otherwise, it should land in HEAD as soon as it gets reviewed. Normally that would be later today, but it might take a bit longer given that Christmas is in a couple days.

D7818 fixes an unrelated issue I hit while developing D7817, and makes it a little easier to test/debug this stuff.

This should be fixed in HEAD. Thanks for the thorough report, and let us know if you run into anything else.