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
F15428895: D7520.id16956.diff
Sun, Mar 23, 11:07 PM
F15414099: D7520.id16963.diff
Wed, Mar 19, 11:10 PM
F15409756: D7520.diff
Wed, Mar 19, 5:06 AM
F15408079: D7520.diff
Tue, Mar 18, 9:15 PM
F15386943: D7520.id.diff
Sat, Mar 15, 1:33 AM
Unknown Object (File)
Mar 3 2025, 2:41 AM
Unknown Object (File)
Feb 26 2025, 4:59 AM
Unknown Object (File)
Feb 25 2025, 5:56 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".