From a524bfbac19e350a695e80a586a0e5bf5f4e95b2 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 27 Nov 2018 16:07:42 +0000 Subject: [PATCH] Minor cleanup --- .../uk/ac/ic/wlgitbridge/bridge/Bridge.java | 21 ++++++++----------- .../bridge/repo/FSGitRepoStore.java | 9 ++++---- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/Bridge.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/Bridge.java index cdbde1d1e4..0f97ac0221 100644 --- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/Bridge.java +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/Bridge.java @@ -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; } diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/FSGitRepoStore.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/FSGitRepoStore.java index 55ae573337..d32bb423fe 100644 --- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/FSGitRepoStore.java +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/FSGitRepoStore.java @@ -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) {