Steps to Reproduce
- With hosted Mercurial repository, ensure local clone is in matching state (local master bookmark points to same changeset upstream)
- Ensure master bookmark is active (hg up master)
- Modify some file, commit
- Attempt to push the changeset upstream using the SSH protocol
cspeckrun@specktop ~/P/n/hgtest> hg pus --debug --traceback -v no terminfo entry for sitm no terminfo entry for dim pushing to ssh://phab-devel.code/diffusion/HGTEST/hgtest/ running ssh phab-devel.code 'hg -R diffusion/HGTEST/hgtest/ serve --stdio' sending hello command sending between command remote: 271 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 remote: 1 query 1; heads sending batch command searching for changes all remote heads known locally preparing listkeys for "phases" sending listkeys command received listkey for "phases": 15 bytes checking for updated bookmarks preparing listkeys for "bookmarks" sending listkeys command received listkey for "bookmarks": 47 bytes sending branchmap command sending branchmap command preparing listkeys for "bookmarks" sending listkeys command received listkey for "bookmarks": 47 bytes 1 changesets found list of changesets: 1cb56b0576fbf0cb40b908453f8ff5d8032ac743 sending unbundle command bundle2-output-bundle: "HG20", 5 parts total bundle2-output-part: "replycaps" 155 bytes payload bundle2-output-part: "check:heads" streamed payload bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload bundle2-input-bundle: with-transaction bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported bundle2-input-part: "output" (advisory) (params: 0 advisory) supported bundle2-input-part: total payload size 100 remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files bundle2-input-part: "reply:pushkey" (params: 0 advisory) supported bundle2-input-part: "reply:pushkey" (params: 0 advisory) supported bundle2-input-part: "output" (advisory) (params: 0 advisory) supported bundle2-input-part: total payload size 1433 remote: [2016-01-18 22:08:23] EXCEPTION: (CommandException) Command failed with error #255! remote: COMMAND remote: hg log --template '{node}' --rev 'ancestor('\''cfd5b1ce30b509b88e520f54579bce7c48a237c1'\'', '\''1cb56b0576fbf0cb40b908453f8ff5d8032ac743'\'')' remote: remote: STDOUT remote: (empty) remote: remote: STDERR remote: abort: unknown revision '1cb56b0576fbf0cb40b908453f8ff5d8032ac743'! remote: at [<phutil>/src/future/exec/ExecFuture.php:416] remote: arcanist(head=master, ref.master=b87138356a9c), phabricator(head=master, ref.master=7ab970d1a7d3), phutil(head=master, ref.master=c3fd3a8bb2c3) remote: #0 ExecFuture::resolvex() called at [<phabricator>/src/applications/repository/storage/PhabricatorRepository.php:443] remote: #1 PhabricatorRepository::execxLocalCommand(string, string, string) called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:973] remote: #2 DiffusionCommitHookEngine::findMercurialPushKeyRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:698] remote: #3 DiffusionCommitHookEngine::findMercurialRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:222] remote: #4 DiffusionCommitHookEngine::findRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:124] remote: #5 DiffusionCommitHookEngine::execute() called at [<phabricator>/scripts/repository/commit_hook.php:133] remote: pushkey-abort: prepushkey.phabricator hook exited with status 255 bundle2-input-part: "output" (advisory) supported bundle2-input-bundle: 5 parts total updating bookmark master failed! preparing listkeys for "phases" sending listkeys command received listkey for "phases": 15 bytes
According to the output, the two arguments passed into the ancestor revset are
- e924773ad453bceb5122c5ac67f1fd5859f3e609 is the current master upstream, prior to any updates
- fb1da8a86b9ca51cb9f201b52edd0470ee808eda is the new changeset being pushed.
It looks like the prepushkey Mercurial hook might be running prior to the commit/changeset being applied, but from what I can tell this execution path is the first thing it does when the hook is executed, and hasn't changed recently.
As a precaution to the recent bundle2 changes, I tried commenting out these lines (and restarting services) - however that did not seem to affect anything:
https://secure.phabricator.com/diffusion/P/browse/master/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php;cea633f698daad27d5e2b781124198d9f0767878$112-113
phabricator | cea633f698daad27d5e2b781124198d9f0767878 |
arcanist | 3308da5f8fbe9de8c9c2a25646a5704eca323851 |
libphutil | d5b4421792e5829b7a760c55dbf9adbc70669455 |
server hg | Mercurial Distributed SCM (version 3.5.1) |
client hg | Mercurial Distributed SCM (version 3.5.2) |
Workaround
- Align the master bookmark with server: hg book -r xxx master -f
- Push outgoing commits: hg pus
- Update master to now-public changeset: hg book -r tip master
- Push just the bookmark: hg pus -r master
What's weird is that pushing over http seems to work fine:
cspeckrun@specktop ~/P/n/hgtest> hg pus http pushing to http://Administrator:***@192.168.0.133/diffusion/HGTEST/hgtest searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files updating bookmark master
Testing on rHGTEST
This is reproducible on rHGTEST using hg 3.6.3 - the error output is a little different from above, which was done using an earlier version of hg on the client.
cspeckrun@specktop ~/P/p/hg-test> hg pus --debug --traceback -v no terminfo entry for sitm no terminfo entry for dim pushing to ssh://dweller@secure.phabricator.com/diffusion/HGTEST/hg-test/ running ssh dweller@secure.phabricator.com 'hg -R diffusion/HGTEST/hg-test/ serve --stdio' sending hello command sending between command remote: 145 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 remote: 1 query 1; heads sending batch command searching for changes all remote heads known locally preparing listkeys for "phases" sending listkeys command received listkey for "phases": 15 bytes checking for updated bookmarks preparing listkeys for "bookmarks" sending listkeys command received listkey for "bookmarks": 47 bytes sending branchmap command sending branchmap command preparing listkeys for "bookmarks" sending listkeys command received listkey for "bookmarks": 47 bytes 1 changesets found list of changesets: 2a4fde99cf721d394a19f75208ff6c3b6d94e4bd sending unbundle command remote: abort: stream ended unexpectedly (got 0 bytes, expected 6) Traceback (most recent call last): File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/dispatch.py", line 187, in _runcatch return _dispatch(req) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/dispatch.py", line 920, in _dispatch cmdpats, cmdoptions) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/dispatch.py", line 679, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/extensions.py", line 183, in closure return func(*(args + a), **kw) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/hgext/pager.py", line 139, in pagecmd return orig(ui, options, cmd, cmdfunc) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/extensions.py", line 183, in closure return func(*(args + a), **kw) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/hgext/color.py", line 525, in colorcmd return orig(ui_, opts, cmd, cmdfunc) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/dispatch.py", line 1051, in _runcommand return checkargs() File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/dispatch.py", line 1011, in checkargs return cmdfunc() File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/dispatch.py", line 917, in <lambda> d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/util.py", line 801, in check return func(*args, **kwargs) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/extensions.py", line 183, in closure return func(*(args + a), **kw) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/util.py", line 801, in check return func(*args, **kwargs) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/hgext/mq.py", line 3528, in mqcommand return orig(ui, repo, *args, **kwargs) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/util.py", line 801, in check return func(*args, **kwargs) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/commands.py", line 5428, in push opargs=opts.get('opargs')) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/exchange.py", line 373, in push _pushchangeset(pushop) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/exchange.py", line 854, in _pushchangeset pushop.repo.url()) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/wireproto.py", line 351, in unbundle ret, output = self._callpush("unbundle", cg, heads=heads) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/sshpeer.py", line 271, in _callpush r = self._recv() File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/sshpeer.py", line 299, in _recv self._abort(error.ResponseError(_("unexpected response:"), l)) File "/usr/local/Cellar/mercurial/3.6.3/lib/python2.7/site-packages/mercurial/sshpeer.py", line 212, in _abort raise exception ResponseError: ('unexpected response:', '') abort: unexpected response: empty string