mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Minor cleanup
This commit is contained in:
parent
66fa946cb8
commit
a524bfbac1
2 changed files with 14 additions and 16 deletions
|
@ -354,34 +354,32 @@ public class Bridge {
|
|||
) throws IOException, GitUserException {
|
||||
ProjectRepo repo;
|
||||
ProjectState state = dbStore.getProjectState(projectName);
|
||||
Log.info(">>>> RepoStore {}", repoStore.getRepoStorePath());
|
||||
Log.info(
|
||||
">>>> getUpdatedRepoCritical, {} migratedFrom {}",
|
||||
projectName,
|
||||
doc.getMigratedFromID()
|
||||
);
|
||||
switch (state) {
|
||||
case NOT_PRESENT:
|
||||
Log.info(">>>> Not present {}", projectName);
|
||||
Log.info(">>>> [{}] Repo not present", projectName);
|
||||
String migratedFromID = doc.getMigratedFromID();
|
||||
if (migratedFromID != null) {
|
||||
Log.info(">>>> has a migratedFromId {} {}", projectName, migratedFromID);
|
||||
Log.info("[{}] Has a migratedFromId: {}", projectName, migratedFromID);
|
||||
ProjectState sourceState = dbStore.getProjectState(migratedFromID);
|
||||
try (LockGuard __ = lock.lockGuard(migratedFromID)) {
|
||||
switch (sourceState) {
|
||||
case NOT_PRESENT:
|
||||
// Normal init-repo
|
||||
Log.info(">>>> migrated-from-id not present, proceed as normal");
|
||||
Log.info("[{}] migrated-from project not present, proceed as normal",
|
||||
projectName
|
||||
);
|
||||
repo = repoStore.initRepo(projectName);
|
||||
break;
|
||||
case SWAPPED:
|
||||
// Swap back and then copy
|
||||
Log.info(">>>> migrated-from-id swapped, unswap and proceed");
|
||||
swapJob.restore(migratedFromID);
|
||||
/* Fallthrough */
|
||||
default:
|
||||
// Copy data, and set version to zero
|
||||
Log.info(">>>> migrated-from-id init from existing");
|
||||
Log.info("[{}] Init from other project: {}",
|
||||
projectName,
|
||||
migratedFromID
|
||||
);
|
||||
repo = repoStore.initRepoFromExisting(projectName, migratedFromID);
|
||||
dbStore.setLatestVersionForProject(migratedFromID, 0);
|
||||
dbStore.setLastAccessedTime(
|
||||
|
@ -393,7 +391,6 @@ public class Bridge {
|
|||
}
|
||||
break;
|
||||
} else {
|
||||
Log.info(">>>> no migrated-from-id {}", projectName);
|
||||
repo = repoStore.initRepo(projectName);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -80,13 +80,15 @@ public class FSGitRepoStore implements RepoStore {
|
|||
String project, String fromProject
|
||||
) throws IOException {
|
||||
GitProjectRepo ret = GitProjectRepo.fromName(project);
|
||||
// GitProjectRepo origin = GitProjectRepo.fromName(fromProject);
|
||||
ret.initRepo(this);
|
||||
Log.info(">>>> Copy from {} to {}", fromProject, project);
|
||||
String repoRoot = getRepoStorePath();
|
||||
String sourcePath = repoRoot + "/" + fromProject;
|
||||
String destinationPath = repoRoot + "/" + project;
|
||||
Log.info(">>>> paths from: {} and to: {}", sourcePath, destinationPath);
|
||||
Log.info("[{}] Init repo by copying data from: {}, to: {}",
|
||||
project,
|
||||
sourcePath,
|
||||
destinationPath
|
||||
);
|
||||
new ProcessBuilder(
|
||||
"rm", "-rf",
|
||||
destinationPath
|
||||
|
@ -96,7 +98,6 @@ public class FSGitRepoStore implements RepoStore {
|
|||
sourcePath,
|
||||
destinationPath + "/"
|
||||
).start();
|
||||
Log.info(">>>> done copy");
|
||||
try {
|
||||
copyProcess.waitFor();
|
||||
} catch (InterruptedException e) {
|
||||
|
|
Loading…
Reference in a new issue