deps: repository dependencies extension (2nd try)

Aleix Conchillo Flaqué aleix at member.fsf.org
Mon Mar 17 06:12:53 CDT 2008


Hi,

for those interested in maintaining dependencies for external
repositories (Mercurial, CVS, Subversion...) or other files, I have
created the deps extension. I guess it can be used in conjunction with
the forest extension, but it also can be used with non-Mercurial
repositories, or even files, or whatever.

The extension is located here:

http://hg.hacks-galore.org/aleix/hgdeps

Below, I am pasting the help so you take a quick look. Probably this
can be done with other extensions, but I couldn't found them. Please,
if this is the case, I would really appreciate that someone can point
it.

Any suggestions, critics... would be welcome.


Aleix

------------------

create and manage repository dependencies

    This extension is useful when a repository might depend on some
    external dependencies: other repositories (Mercurial, CVS,
    Subversion...), files not handled by a SCM tool or some other
    dependencies.

    To enable this extension, add this to your global .hgrc file (or
    to your repository .hg/hgrc file):

    [extensions]
    hgext.deps =
    # or, if deps.py is not in the hgext dir:
    # deps = /path/to/deps.py

    In order to define these external dependencies, you need to add a
    section [deps] in you repository .hg/hgrc file (or in the global
    .hgrc) where you will define how to find them. As an example,
    let's say that our repository depends on two external libraries
    managed by different SCM tools: 'libfoo' managed by Mercurial and
    'libbar' managed by CVS.

    [deps]
    aliases = libfoo, libbar
    alias.libfoo = /path/to/libfoo
    alias.libbar = :pserver:anonymous at cvs.server.org:/sources/bar
    alias.libbar.command = cvs -z3 -d$source co -r $rev -d $dest bar

    Two aliases have been defined, one for each library, and also the
    sources where the libraries can be obtained. 'libbar' has two
    options: the library location and the CVS command to use in order
    to get the library. For 'libfoo' only a path to the Mercurial
    repository has been specified. $rev, $source, and $dest are
    substitution placeholders and will be explained later.

    Once the location of the depedencies have been defined, depedency
    lists can be created. A depedency list has an associated
    name. Following the example above, two depedency lists will be
    created, one for version 0.9.1 of our repository and another for
    version 1.0. 0.9.1 and 1.0 will be used as the name of the lists.

    [1.0]
    f24139319bdb    libfoo    lib/foo
    v0r8_0          libbar    lib/bar

    [0.9.1]
    3a9b061bada1    libfoo    lib/foo
    v0r7_8          libbar    lib/bar

    A dependency is defined by three fields: a revision name, the
    alias of the external dependency and a destination directory. The
    alias must be one of the aliases defined in the [deps] section
    (see above). The revision name will be substituted for the
    placeholder $rev also seen before. For Mercurial, the revision
    name will just be a Mercurial revision of the external
    repository. Finally, the destination directory will be substituted
    for $dest.

    To facilitate version control, distribution, and merging of
    dependencies, they are stored as a file named '.hgdeps' which is
    managed similarly to other project files and can be hand-edited if
    necessary.

   ----

    If no name is given to this command, a list of all dependencies
    will be shown. A given name will only display the dependencies for
    that name.

    To add a dependency for a given name, the external repository
    alias, a revision of that repository and a future destination path
    must be provided.

    To get the external dependencies for a given name, run the
    'depsclone' command.


More information about the Mercurial-devel mailing list