FS#36841 - [makepkg] [PATCH] download_hg fetches more than requested ref

Attached to Project: Pacman
Opened by Devin J. Pohly (djpohly) - Monday, 09 September 2013, 17:49 GMT
Last edited by Eli Schwartz (eschwartz) - Wednesday, 10 January 2018, 20:30 GMT
Task Type Feature Request
Category makepkg
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 4.1.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:
For a Mercurial package with #branch=foo or similar specified in the source array, the entire repository is cloned/pulled when just that revision would do. While this would normally not cause a problem beyond extra downloading, there is a Mercurial design quirk that can cause a pull to fail (HTTP 414 Request-URI Too Large) when many branches exist but none is specified. So pulling a single branch would also work around this quirk in those cases.

Steps to Reproduce:
1. Create a PKGBUILD using (e.g.) hg+https://code.google.com/p/stepmania#branch=default as a source. (Huge repo warning!)
2. Run makepkg -o.
3. Note that the initial clone, if successful, downloads many active and closed branches other than default (hg branches -c).
4. Wait for a new commit on the project, or simulate it by stripping a revision from the clone (hg strip -r default).
5. Run makepkg -o again to pull the new revisions.

Expected behavior:
Both the clone and pull scenarios complete successfully, since the source URL only requests one branch.

Actual behavior:
Either scenario can fail with HTTP 414, and if it doesn't, it still downloads far more data than is necessary.

Patch is attached.
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Wednesday, 10 January 2018, 20:30 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Broken mercurial repos are not a makepkg problem, and this would break cherry-picking fixes from another branch.
Comment by Eli Schwartz (eschwartz) - Monday, 25 September 2017, 16:13 GMT
This seems like an anti-feature to me, mercurial should not be different from e.g. git which has the exact same "download all refs" behavior.

In some cases, you need those refs as the prepare() function may e.g. `git revert --no-commit` a commit, or more commonly cherry-pick backports. I'm sure the same would apply to mercurial as well (though I don't really use mercurial or PKGBUILDs that clone hg repos).

If mercurial has a bug when cloning, that is a problem with mercurial and should be fixed upstream rather than worked around to our detriment.

This should be closed as notabug.

Loading...