Add generalized repmat function as repeat
pkg2: add filter_prereleases
pkg2/resolve: move version pruning upstream

*) separated Query.dependencies_subset from Query.prune_versions
*) added an optional "fixed" field to Query.filter_prereleases
*) grouped dependencies manipulations into Query.prune_dependencies
*) moved dependencies manipulations from the Interface constructor
   to Pkg2.resolve and inside Pkg2.Resolve.sanity_check
*) minor cosmetic changes

This change is a prodromic to changing the solver's objective function
and have Pkg2.Resolve.resolve be independent of pruning.
pkg2: only use whole version numbers in require

*) Disregard all prerelease/build information in
   require files, e.g. 1.0.0-pre+0.a is parsed as 1.0.0
*) Only use whole version numbers in VersionInterval,
   therefore, if a requirement such as

   FooBar 1.3 2.0

   will be satisfied by FooBar version 1.3-pre2 and
   won't be satisfied by version 2.0-pre1.
pkg2/resolve: introduce VersionWeigths

This changes resolve's objective function such that
version pruning doesn't affect it. Therefore, equivalence
classes are no longer needed in resolve (they're still used
in sanity_check).

With this change, the objective function is defined such that:

1) requirements and dependencies are enforced
2) in case of multiple solutions, required packages versions
   are maximized:
   2a) the overall sum of required packages major versions is
       maximized
   2b) in case of a tie, minor versions are considered; if there
       are still ties, patch versions are considered
3) in case of multiple solutions under the above rules, non-required
   package versions are maximized, still counting major versions
   first, then minor, then patch, as for the required versions.
4) if there is still a tie between different solutions, dependants
   are maximized before dependencies
5) if there is still a tie, random noise is used to pick one

The change introduced by this commit is the major/minor/patch
count. Also, package installation is now considered "cheap", while before
the cost of installing a package was equivalent to that of downgrading
a package.
Document repeat function

Extend ind2sub and sub2ind to accept a reusable array of indices
Expose rem1 and fld1, defined by analogy with mod1
Restore basic ind2sub definition
Fix one readnotify I missed
Merge pull request #3692 from staticfloat/master

Add in missing colon in docs
state cleanup and exception for exited workers. fixes #3436
now the tests are able to complete and pass even if a worker exits,
  which we might not actually want!
closes #3050 (rmprocs)
fixes #2793 (hang when remote process exits)
Merge branch 'master' of github.com:JuliaLang/julia
throw an error when trying to use a deleted process ID. fixes #3685
documented note on gc finalization order
to prevent surprises and memory leaks, particularly while interfacing with native libraries.
docs: added entry for rmprocs
Merge pull request #3693 from tanmaykm/tanmaykm

documented a note on gc finalization order
Revert "Fix #3691"

This reverts commit 500d615f69899c1601af7e0e512754f957a9ef39.

Conflicts:
	base/task.jl
fix #3691 better
restore some libuv.state arbitrarily lost in bdb61666d106ffb859d1d672c7b4c79308601c00
moved repr from io.jl to string.jl
as it is used in pcre.jl
probably fix #3686