Feature #318

"Download this revision" in repository page

Added by Chris Cannam about 13 years ago. Updated almost 13 years ago.

Status:ClosedStart date:2012-02-02
Priority:HighDue date:
Assignee:Chris Cannam% Done:

100%

Category:-
Target version:-

Description

It would be nice to have a Github-style "download this as an archive" button in the Repository page.

This differs from feature #66 in that it wouldn't make any sort of additional "release" -- there would be no indication that it had passed any kind of acceptance -- it would just be a quicker way to grab the repository contents for people without version control clients.


Subtasks

Bug #371: Download link ignores branch, tag selectionClosedChris Cannam


Related issues

Related to Feature #66: Instant "package a file release" button New 2011-01-24

History

#1 Updated by Chris Cannam about 13 years ago

  • Description updated (diff)

#2 Updated by Chris Cannam about 13 years ago

We have archive downloads already through hgweb.

We want the following adjustments to httpd config:

  • Avoid redirecting to https in cases where a login is not required
  • Use content type discrimination to redirect to Redmine when hgweb pages are requested through a browser (this has been a desirable thing for a while, might as well roll them together)
  • Also any fixes required to avoid information leakage on nonexistent projects.

And then we need an extension (to the checkout plugin?) to synthesise an archive URL for a project based on its checkout URL and show it.

#3 Updated by Chris Cannam about 13 years ago

So, we need:

  1. Apache config stops redirecting all hg traffic to https
  2. hg auth Apache module redirects to https before auth, only if auth required
  3. also, hg auth Apache module insists on auth before revealing project is nonexistent
  4. Apache config redirects all /hg/X to /projects/X/repository when HTML is requested? How to deal with e.g. /hg/X/rev/Y or /hg/X/archive/Y?

#4 Updated by Chris Cannam about 13 years ago

OK, we have 1-3, more or less, in 897bc2b63bfe. But there's a catch.

The way it's now set up, hg connections initiated with an http URL are made through http until something requires authentication, and then the module redirects to https.

But if you are using a public project repository then the only things that require authentication will be the read-write methods (POST etc), so if you issue an hg push through an http URL, the first time the module will issue a redirect will be on the POST request that follows the initial fact-finding GETs. And that will fail, because (even with a 307) Mercurial refuses to redirect for POST. Result: push fails with the incomprehensible message "Abort: HTTP Error 307: Temporary Redirect" (or something else equally arcane depending on the server's choice of redirect code).

#5 Updated by Chris Cannam about 13 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 50

#6 Updated by Chris Cannam about 13 years ago

Sequence of HTTP requests for clone of public repo:

GET /hg/xx?cmd=capabilities
GET /hg/xx?cmd=heads
GET /hg/xx?cmd=changegroup&roots=yy
GET /hg/xx?cmd=listkeys&namespace=bookmarks

for pull of public repo, no changes to pull:

GET /hg/xx?cmd=capabilities
GET /hg/xx?cmd=heads
GET /hg/xx?cmd=listkeys&namespace=bookmarks

for push to public repo, auth required:

GET /hg/xx?pairs=yy&cmd=between
GET /hg/xx?cmd=capabilities
GET /hg/xx?cmd=heads
GET /hg/xx?cmd=branchmap
POST /hg/xx?cmd=unbundle&heads=yy

Do we always get a branchmap before the post, I wonder?

#7 Updated by Chris Cannam about 13 years ago

Branchmap-related hack now in 1d1b8170c2f7

#8 Updated by Chris Cannam about 13 years ago

N.B. we should also update the Checkout config so that it shows http:// URLs instead of https:// ones, at least for non logged-in users -- now that it is actually more efficient to use http where auth is not required.

#9 Updated by Chris Cannam about 13 years ago

  • % Done changed from 50 to 70

8873bc7c1af5 provides a simple download link -- the way it's done isn't exactly elegant but it works as a proof of concept.

#10 Updated by Chris Cannam about 13 years ago

  • % Done changed from 70 to 90

Better implementation in 496b3cfa2f36

#11 Updated by Chris Cannam almost 13 years ago

  • Status changed from In Progress to Closed

Working, live

#12 Updated by Luis Figueira almost 13 years ago

  • Status changed from Closed to In Progress

Looks like it's always downloading the repo tip.

#13 Updated by Chris Cannam almost 13 years ago

  • Status changed from In Progress to Closed

Also available in: Atom PDF