Use of the "branch" attribute with "info" tag

View: New views
3 Messages — Rating Filter:   Alert me  

Use of the "branch" attribute with "info" tag

by Gareth Western-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What exactly is the branch attribute used for in the info tag in an
ivy descriptor?

In our development environment we have multiple modules and will soon
be dealing with multiple branches, so it is important that the modules
grab the intra-module dependencies for the right branches. Is it as
simple as specifying the correct branch in this attribute, or would it
be better to rename each module's revision to include the branch name?

Thanks,

Gareth

Re: Use of the "branch" attribute with "info" tag

by Mitch Gitman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Gareth, let me speak as someone who does not have experience using Ivy-based
branching because I have experience considering it and then thinking better
of it for my particular needs. I can tell you, branching is a really
sophisticated feature that demands the right use case.

If you don't have a serious dealbreaker or pain point with just
incorporating the branch name into the revision name, then that really
obviates Ivy-based branching. Using revision names like 3.0_alpha1 (where
alpha1 is your branch name) in a release repository is really an alternative
to Ivy-based branching.

The selling point of Ivy-based branching is that it gives a way for a
dependent ivy.xml to remain the same even when the branch of the dependency
changes. You just change the branch in the ivysettings.xml, and you don't
have to recursively edit a whole hierarchy of dependent ivy.xml files.

Note I said that you change the branch in your Ivy settings. This feature
only works in concert with specifying a branch in Ivy settings. The Ivy
settings might specify a pattern like
[organisation]/[module]/[branch]/[revision]/ivy.xml
or [organisation]/[module]/[branch]-[revision]/ivy.xml, or even reversing
the order of [branch] and [revision].

Someone feel free to correct a detail here. It should be apparent that this
is a topic I'm not entirely comfortable with. It's probably fair to say also
that branching is by and large a piece of unexplored terrain in the Ivy
feature set.

On Mon, Oct 26, 2009 at 5:01 AM, Gareth Western <gareth@...>wrote:

> What exactly is the branch attribute used for in the info tag in an
> ivy descriptor?
>
> In our development environment we have multiple modules and will soon
> be dealing with multiple branches, so it is important that the modules
> grab the intra-module dependencies for the right branches. Is it as
> simple as specifying the correct branch in this attribute, or would it
> be better to rename each module's revision to include the branch name?
>
> Thanks,
>
> Gareth
>

Re: Use of the "branch" attribute with "info" tag

by Juha Ranta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Gareth Western-3 wrote:
What exactly is the branch attribute used for in the info tag in an
ivy descriptor?

In our development environment we have multiple modules and will soon
be dealing with multiple branches, so it is important that the modules
grab the intra-module dependencies for the right branches. Is it as
simple as specifying the correct branch in this attribute, or would it
be better to rename each module's revision to include the branch name?

Thanks,

Gareth
We've used the branch attribute quite a lot. Here's some thoughts.

First of all, if you use branches in your SCM system (such as Subversion, CVS, etc), I think that when you publish your Ivy module, you should set the branch attribute. Simply set there the branch where the module came from. If it's the main branch, set it to "trunk" or "HEAD" or whatever. You may find it useful later, and if you don't ever need it, well, just don't use it.

About the revisions, if you use branches, you probably should set your revision numbers so that releases don't have the same revision number. For example, if you have branches "trunk" and "RELEASE_1", you shouldn't have revision 1.1 in both of these branches. If you use [branch] in your repository pattern, it's basically possible to publish 1.1 in both branches, but it's not a good idea because of some issues. One way to make sure the revisions are always different is to use the branch name in the revision. Another way is to figure out some other model for revision numbers, such as having versions 1.1, 1.2, 1.3, etc, in the main branch and versions 1.1.1, 1.1.2, 1.1.3, etc, in the release branch.

After you're publishing your modules with the branch attribute, you can use the branch attribute while using dependencies. For instance, if you have module A depending on module B, you can get the latest B from branch RELEASE_1 with this dependency in the ivy.xml of module A:

<dependency name="B" org="myorg" rev="latest.integration" branch="RELEASE_1"/>

If you don't put the branch attribute in the dependency, it will either get the latest from the default branch or the latest spanning branches... actually I think this will depend a bit on how you've set the repository and your latest resolvers.

One way we use this feature is that we branch several tightly coupled modules in a release branch such as RELEASE_1 and then these intercoupled modules in the release refer to each other with the branch attribute. When we make a fix in one of the modules in the release branch, the depending modules in the release branch automatically get that version. At the same time, new development changes in the main branch won't flow to the release branch.

So to sum it up, by using latest.* revisions and branch attributes together in the dependencies element, you can control from which branch to get your dependencies in a quite elegant way.

The branching patterns you use is a matter which is behind Ivy's scope.