Subscribe to proper project when nested projects exist

Submodule subscription would parse from the end of the url and return a
subscription to the first project it would find. Now, continue to parse
the url and subscribe to the project found with the most complete name.

Example:
Project "a/b" exists
Project "b" exists
Submodule subscription url = ../a/b

Old behaviour:
Would subscribe to project "b"

Expected:
Subscription to project "a/b"

Change-Id: I284b681d3098ff6ec2915fc90a047e2f329babfd
This commit is contained in:
Janice Agustin
2015-07-28 10:59:31 -04:00
committed by David Pursehouse
parent 77d5a0a7fb
commit 0573f65bff
2 changed files with 26 additions and 4 deletions

View File

@@ -74,6 +74,7 @@ public class SubmoduleSectionParser {
final String url = bbc.getString("submodule", id, "url");
final String path = bbc.getString("submodule", id, "path");
String branch = bbc.getString("submodule", id, "branch");
SubmoduleSubscription ss = null;
try {
if (url != null && url.length() > 0 && path != null && path.length() > 0
@@ -108,7 +109,7 @@ public class SubmoduleSectionParser {
}
if (repoManager.list().contains(new Project.NameKey(projectName))) {
return new SubmoduleSubscription(
ss = new SubmoduleSubscription(
superProjectBranch,
new Branch.NameKey(new Project.NameKey(projectName), branch),
path);
@@ -120,6 +121,6 @@ public class SubmoduleSectionParser {
// Error in url syntax (in fact it is uri syntax)
}
return null;
return ss;
}
}