satis icon indicating copy to clipboard operation
satis copied to clipboard

Adding vcs subversion support for target-branches, target-tags with multiple endpoints.

Open xylesoft opened this issue 9 years ago • 10 comments
trafficstars

We currently have a situation where a repository exists in the following structure:

src/
    branches/
        development/
        releases/
    tags/
        development/
        releases/
    trunk/

From my understanding the target-branches can only support a string to either branches/developmentor branches/releases, would it be feasible to add an array check on the target-branches configurations. For example:

{
    ...
    "target-branches": ["branches/releases","branches/development"],
    ...
}

Or is it possible to get all repository (containing a composer.json) end points recursively from just providing "taget-branches":"branches" ?

xylesoft avatar Mar 15 '16 11:03 xylesoft

Shouldn't it be branches-path? Or are the docs horribly outdated?

https://getcomposer.org/doc/05-repositories.md#subversion-options

alcohol avatar Mar 15 '16 11:03 alcohol

This seems to be the code that retrieves all branches from that path:

https://github.com/composer/composer/blob/15face5432d7b7334db6ac69fac0190971cafa6e/src/Composer/Repository/Vcs/SvnDriver.php#L230-L246

Perhaps you could specify the repository twice, and have a different branches-path for each instance? This does not seem like a suitable solution if you have many paths though. But it might suffice for just 2 or 3.

Or maybe svn ls already handles this gracefully and you can simply point it at the root path of your branches. I'm not sure, cause I haven't used svn in over 5 years.

alcohol avatar Mar 15 '16 11:03 alcohol

I am currently using branches path, but I think perhaps I didn't clarify the structure well enough.

in the branches/development/ directory, we also have other directories which are each of our development branches, so we have something like: branches/development/sto-new-feature, which is what we work in. development and releases are just containers for a number of branches.

xylesoft avatar Mar 15 '16 12:03 xylesoft

I understand that. I simply don't know what svn ls returns. I don't know how svn treats branches or determines them. So I'm not really in a position to provide much useful feedback here.

alcohol avatar Mar 15 '16 12:03 alcohol

Hence my alternative solution;

repositories: [
  { "type": "vcs", "url": "http://svn.example.org/projectA/", "branches-path": "branches/development" },
  { "type": "vcs", "url": "http://svn.example.org/projectA/", "branches-path": "branches/releases" }
]

alcohol avatar Mar 15 '16 12:03 alcohol

Your solution appears to work fine, thank you for the heads up. Do you think submitting a pull request to allow an array of paths as initially suggested would be considered useful to the composer/satis project? If so I can look into it over this week at some point, certainly would save having to create do repository configuration objects.

xylesoft avatar Mar 15 '16 12:03 xylesoft

i think if code change is not acceptable, then still pull request to update doc for @alcohol hint would be useful: https://github.com/composer/satis/issues/312#issuecomment-196798991

glensc avatar Mar 15 '16 13:03 glensc

@xylesoft you would have to submit the pull request to composer/composer. I think it would have merit. Not many people still use SVN, but for those that do it might definitely be a plus :-)

alcohol avatar Mar 15 '16 18:03 alcohol

@alcohol I will get on it :)

xylesoft avatar Mar 18 '16 10:03 xylesoft

And how would package manager behave, if branch/tag names collide under these paths? IMO, the solution with two VCS entries is less error-prone, and more clear on the intentions.

AnrDaemon avatar Apr 13 '18 14:04 AnrDaemon