Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 279769 - mercurial.eclass: improved working directory creation with respect to dependent ebuilds
Summary: mercurial.eclass: improved working directory creation with respect to depende...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Christoph Junghans (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-31 08:23 UTC by Matthias K.
Modified: 2012-12-20 22:28 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch proposal (mercurial.eclass.diff,1.40 KB, text/plain)
2009-07-31 08:25 UTC, Matthias K.
Details
mercurial.eclass.diff (mercurial.eclass.diff,1.10 KB, patch)
2009-07-31 09:25 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details | Diff
mercurial.eclass.diff (mercurial.eclass.diff,1.23 KB, patch)
2009-07-31 09:30 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details | Diff
cleanup, additional --repository switch for archive (mercurial.eclass.diff,1.37 KB, patch)
2009-07-31 10:53 UTC, Matthias K.
Details | Diff
Fastest (use "hg update") (mercurial.eclass.diff,727 bytes, patch)
2010-02-26 12:43 UTC, Denis Kaganovich
Details | Diff
suggested patch (mercurial.eclass.patch,1.98 KB, patch)
2010-03-03 15:15 UTC, Denis Kaganovich
Details | Diff
removed default revision "tip" (vs. --date") (mercurial.eclass.patch,2.17 KB, patch)
2010-03-03 15:47 UTC, Denis Kaganovich
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias K. 2009-07-31 08:23:19 UTC
See 259898 for previous discussion.

Using hg archive -t files speeds up the working directory creation and reduces the amount of disk/ramdisk space used.

Cloning big Repositories like f.e. the Free Pascal hg repos, introduces several MB (current fpc trunk - approx 125MB in .hg/) of Revision/History which is not used for the Build process.

Since some ebuilds depend on the revision for the build process, it should be introduced as Optional, with default for cloning. 

Reproducible: Always

Steps to Reproduce:
1. Use mercurial.eclass for a big hg repository which does not use the history 
2. mercurial_src_unpack
Comment 1 Matthias K. 2009-07-31 08:25:26 UTC
Created attachment 199710 [details]
Patch proposal

Proposed Patch which has an additional Option for using hg archive instead of clone, using EHG_WC_OPT="nohistory".
Default is cloning.
Comment 2 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2009-07-31 09:25:57 UTC
Created attachment 199715 [details, diff]
mercurial.eclass.diff

Why do you duplicate the hg command when the only difference is the one defined via the EHG_WC_OPT variable? The attached patch avoids probably useless code duplication...
Comment 3 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2009-07-31 09:30:33 UTC
Created attachment 199717 [details, diff]
mercurial.eclass.diff

Sorry, I uploaded an early version of the diff...
Comment 4 Matthias K. 2009-07-31 10:53:48 UTC
Created attachment 199719 [details, diff]
cleanup, additional --repository switch for archive

thx for the cleanup, the reason for code duplication was/is a problem with the --repository switch, which is troublesome.
clone will issue a warning with it, archive will fail without it.

heres another patch, solving this problem
Comment 5 Denis Kaganovich 2010-02-26 12:43:25 UTC
Created attachment 221317 [details, diff]
Fastest (use "hg update")

I use "hg update" with symlinking ".hg" - this is fastest and avoid twice full repo cloning. This is my code part only, you may move it into any "case" or (IMHO better) adding useflag like "fast-update".

This method keeping "dirstate" file in master ".hg" repo, but I do not know problems from this point.
Comment 6 Denis Kaganovich 2010-03-03 15:15:14 UTC
Created attachment 221939 [details, diff]
suggested patch

I suggest this patch. IMHO it is compatible with "hg clone" (while I comment out symlink removing) and adding next features:

Useflags: release-branch, release-tag. Use latest named revision/"release" (branch or tag) instead of default/tip. May be used to try more stable last snapshot.

EHG_EXTRA_OPT variable (for "update" stage only): I use for "--date" roll-out (see "hd help dates"). ("archive" have no "--date" opt).
Comment 7 Dirkjan Ochtman (RETIRED) gentoo-dev 2010-03-03 15:27:54 UTC
This stuff is pretty crazy. If you want to update to a certain branch or tag, just hg update <branch> or hg update <tag>, instead of doing a complicated dance with sed and whatnot. Also, I'm not seeing where you add the date handling at all.
Comment 8 Denis Kaganovich 2010-03-03 15:47:43 UTC
Created attachment 221941 [details, diff]
removed default revision "tip" (vs. --date")

Removed default revision until really set. For EHG_EXTRA_OPT="--date ..." compatibility.
Comment 9 Christoph Junghans (RETIRED) gentoo-dev 2012-12-18 00:25:49 UTC
After reading all this history I don't actually see what this patch would be good for.

The original issue is actually not an issue as hg clone uses hardlinks if available, so no space is actually wasted.

Having a source from a certain date could be useful, but I would just make that a special EHG_REVISION, like data:XXX. That would also not collide with mercurial's internals as tag and branch names must not contain the ":" character.

[[ $EHG_REVISION = data:* ]] && rev="--data=\"${EHG_REVISION#date:}\"" || rev="--updaterev=\"${EHG_REVISION}\""
Comment 10 Christoph Junghans (RETIRED) gentoo-dev 2012-12-19 18:58:35 UTC
Actually it is slightly more complicated as only hg update, but not hg clone has the date option. So it will be more like
if [[ $EHG_REVISION = date:* ]]; then
  hg clone -r default
  hg up -r $EHG_REVISION
else
  hg clone -r $EHG_REVISION
fi

However, there is another catch, how do we define the branch from which we get the revision with the date.
Comment 11 Christoph Junghans (RETIRED) gentoo-dev 2012-12-20 22:28:54 UTC
(In reply to comment #10)
> However, there is another catch, how do we define the branch from which we
> get the revision with the date.
Instead of "date:" one could use the branch, i.e. default:12/12/12.

However as the ebuild policy states: "Snapshot cvs ebuilds are greatly preferred over "live" cvs.eclass cvs ebuilds." (this also applies to mercurial), I will close that bugs as WONTFIX.

In case the date logic is really needed one can always get it via:
src_unpack() {
  mercurial_fetch
  cd "${S}"
  hg update --date "${HG_DATE}"
}