MergeOpRepoManager: Remove abortIfOpen argument
This was only used once in MergeOp, and hasn't really helped us avoid
any programmer error. We want to encourage wider use of
MergeOpRepoManager within the merge process, and we won't always be
able to assume the repos won't be open by that point.
Change-Id: Ibee928fd50df40d130c888692260ae9a736429dc
(cherry picked from commit 53144d2267)
This commit is contained in:
@@ -67,7 +67,7 @@ public class GitModules {
|
||||
logDebug("Loading .gitmodules of {} for project {}", branch, project);
|
||||
OpenRepo or;
|
||||
try {
|
||||
or = orm.openRepo(project, false);
|
||||
or = orm.openRepo(project);
|
||||
} catch (NoSuchProjectException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
||||
@@ -727,7 +727,7 @@ public class MergeOp implements AutoCloseable {
|
||||
throws IntegrationException {
|
||||
for (Project.NameKey project : projects) {
|
||||
try {
|
||||
orm.openRepo(project, true);
|
||||
orm.openRepo(project);
|
||||
} catch (NoSuchProjectException noProject) {
|
||||
logWarn("Project " + noProject.project() + " no longer exists, "
|
||||
+ "abandoning open changes");
|
||||
|
||||
@@ -187,13 +187,8 @@ public class MergeOpRepoManager implements AutoCloseable {
|
||||
return or;
|
||||
}
|
||||
|
||||
public OpenRepo openRepo(Project.NameKey project, boolean abortIfOpen)
|
||||
public OpenRepo openRepo(Project.NameKey project)
|
||||
throws NoSuchProjectException, IOException {
|
||||
if (abortIfOpen) {
|
||||
checkState(!openRepos.containsKey(project),
|
||||
"repo already opened: %s", project);
|
||||
}
|
||||
|
||||
if (openRepos.containsKey(project)) {
|
||||
return openRepos.get(project);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ public class SubmoduleOp {
|
||||
}
|
||||
OpenRepo or;
|
||||
try {
|
||||
or = orm.openRepo(s.getProject(), false);
|
||||
or = orm.openRepo(s.getProject());
|
||||
} catch (NoSuchProjectException e) {
|
||||
// A project listed a non existent project to be allowed
|
||||
// to subscribe to it. Allow this for now, i.e. no exception is
|
||||
@@ -290,7 +290,7 @@ public class SubmoduleOp {
|
||||
for (Branch.NameKey targetBranch : branches) {
|
||||
Project.NameKey targetProject = targetBranch.getParentKey();
|
||||
try {
|
||||
OpenRepo or = orm.openRepo(targetProject, false);
|
||||
OpenRepo or = orm.openRepo(targetProject);
|
||||
ObjectId id = or.repo.resolve(targetBranch.get());
|
||||
if (id == null) {
|
||||
logDebug("The branch " + targetBranch + " doesn't exist.");
|
||||
@@ -327,7 +327,7 @@ public class SubmoduleOp {
|
||||
if (dst.containsKey(project)) {
|
||||
superProjects.add(project);
|
||||
// get a new BatchUpdate for the super project
|
||||
OpenRepo or = orm.openRepo(project, false);
|
||||
OpenRepo or = orm.openRepo(project);
|
||||
for (Branch.NameKey branch : dst.get(project)) {
|
||||
addOp(or.getUpdate(), branch);
|
||||
}
|
||||
@@ -348,7 +348,7 @@ public class SubmoduleOp {
|
||||
throws IOException, SubmoduleException {
|
||||
OpenRepo or;
|
||||
try {
|
||||
or = orm.openRepo(subscriber.getParentKey(), false);
|
||||
or = orm.openRepo(subscriber.getParentKey());
|
||||
} catch (NoSuchProjectException | IOException e) {
|
||||
throw new SubmoduleException("Cannot access superproject", e);
|
||||
}
|
||||
@@ -404,7 +404,7 @@ public class SubmoduleOp {
|
||||
throws IOException, SubmoduleException {
|
||||
OpenRepo or;
|
||||
try {
|
||||
or = orm.openRepo(subscriber.getParentKey(), false);
|
||||
or = orm.openRepo(subscriber.getParentKey());
|
||||
} catch (NoSuchProjectException | IOException e) {
|
||||
throw new SubmoduleException("Cannot access superproject", e);
|
||||
}
|
||||
@@ -444,7 +444,7 @@ public class SubmoduleOp {
|
||||
throws SubmoduleException, IOException {
|
||||
OpenRepo subOr;
|
||||
try {
|
||||
subOr = orm.openRepo(s.getSubmodule().getParentKey(), false);
|
||||
subOr = orm.openRepo(s.getSubmodule().getParentKey());
|
||||
} catch (NoSuchProjectException | IOException e) {
|
||||
throw new SubmoduleException("Cannot access submodule", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user