Page MenuHomePhabricator

Allow Phabricator to serve Mercurial repositories over HTTP
ClosedPublic

Authored by epriestley on Nov 7 2013, 12:56 AM.
Tags
None
Referenced Files
F14837647: D7520.id16964.diff
Fri, Jan 31, 10:33 AM
Unknown Object (File)
Sat, Jan 25, 10:40 AM
Unknown Object (File)
Fri, Jan 17, 3:16 PM
Unknown Object (File)
Dec 28 2024, 3:40 PM
Unknown Object (File)
Dec 22 2024, 5:54 PM
Unknown Object (File)
Dec 21 2024, 4:26 PM
Unknown Object (File)
Dec 19 2024, 7:03 PM
Unknown Object (File)
Dec 14 2024, 1:32 AM

Details

Reviewers
asherkin
btrahan
Maniphest Tasks
Restricted Maniphest Task
Commits
Restricted Diffusion Commit
rP632466974837: Allow Phabricator to serve Mercurial repositories over HTTP
Summary

Ref T2230. This is easily the worst thing I've had to write in a while. I'll leave some notes inline.

Test Plan

Ran hg clone http://... on a hosted repo. Ran hg push on the same. Changed sync'd both ways.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

src/applications/diffusion/controller/DiffusionServeController.php
410–412

This is used only for "unbundle".

426–427

Magic!

433–434

This discards a length header on commands other than "bundle" and "unbundle".

440–456

Mercurial passes arguments in HTTP headers. :/

458

This whole thing is completely insane.

src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php
6

We must know the arguments each command takes in order to issue the command. The protocol is actually ten different protocols in one.

src/applications/diffusion/response/DiffusionGitResponse.php
33

This just gets the X-Nosniff-IE-SEcurity header back into the response.

Wow, that Mercurial...

Can you give me an unbundle example end to end? Sort of like my inline but expanded. Unbundle seems to be a way to push a set of local revs to some server?

src/applications/diffusion/controller/DiffusionServeController.php
430–431

so how does this end up presenting to the user? if at all of course. :D

We can remove that message safely, but we can't echo stdout through or the user gets

remote: 1
remote: 1

...at the bottom instead of lovely duck facts. $body = ""; works fine though and just doesn't echo anything.

src/applications/diffusion/controller/DiffusionServeController.php
430–431
$ hg push
pushing to http://local.aphront.com:8080/diffusion/HGTEST/
searching for changes
http authorization required
realm: Phabricator Repositories
user: epriestley
password: 
remote: Ducks like to eat bread.
>>> orbital ~/devtools/phabricator/HGTEST $

My day feels brighter already, thanks to these valuable duck facts.

Sadly I think I am going to remove duck facts -- @asherkin notes that tooling expects other things and possibly commit hooks emit stuff, so we probably need a faithful parser. ;_;

epriestley updated this revision to Unknown Object (????).Nov 7 2013, 1:43 AM

Instead of valuable and interesting duck facts, emit stderr in response to unbundle.

Notably, this shows commit hook output to the user, as well as some other diagnostic/status information.

Some day if we have managed hooks we can restore DUCK FACTS.

epriestley updated this revision to Unknown Object (????).Nov 7 2013, 1:58 AM

Also compress "changegroup" and "changegroupsubset", the old versions of "getbundle".