yes lots of logging and fix
This commit is contained in:
parent
e34b120a63
commit
c512330d84
@ -50,6 +50,8 @@ export const getLocalEntityList = async (
|
|||||||
} else {
|
} else {
|
||||||
throw Error(`unexpected ${entry}`);
|
throw Error(`unexpected ${entry}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local.push(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (syncConfigDir) {
|
if (syncConfigDir) {
|
||||||
|
|||||||
@ -240,7 +240,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
() => self.saveSettings()
|
() => self.saveSettings()
|
||||||
);
|
);
|
||||||
const remoteEntityList = await client.listAllFromRemote();
|
const remoteEntityList = await client.listAllFromRemote();
|
||||||
// log.debug(remoteEntityList);
|
log.debug(remoteEntityList);
|
||||||
|
|
||||||
if (this.settings.currLogLevel === "info") {
|
if (this.settings.currLogLevel === "info") {
|
||||||
// pass
|
// pass
|
||||||
@ -269,7 +269,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.app.vault.configDir,
|
this.app.vault.configDir,
|
||||||
this.manifest.id
|
this.manifest.id
|
||||||
);
|
);
|
||||||
// log.info(localEntityList);
|
log.debug(localEntityList);
|
||||||
|
|
||||||
if (this.settings.currLogLevel === "info") {
|
if (this.settings.currLogLevel === "info") {
|
||||||
// pass
|
// pass
|
||||||
@ -281,7 +281,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.db,
|
this.db,
|
||||||
this.vaultRandomID
|
this.vaultRandomID
|
||||||
);
|
);
|
||||||
// log.info(prevSyncEntityList);
|
log.debug(prevSyncEntityList);
|
||||||
|
|
||||||
if (this.settings.currLogLevel === "info") {
|
if (this.settings.currLogLevel === "info") {
|
||||||
// pass
|
// pass
|
||||||
|
|||||||
19
src/misc.ts
19
src/misc.ts
@ -76,17 +76,16 @@ export const getFolderLevels = (x: string, addEndingSlash: boolean = false) => {
|
|||||||
|
|
||||||
export const mkdirpInVault = async (thePath: string, vault: Vault) => {
|
export const mkdirpInVault = async (thePath: string, vault: Vault) => {
|
||||||
// log.info(thePath);
|
// log.info(thePath);
|
||||||
|
const foldersToBuild = getFolderLevels(thePath);
|
||||||
// as of 2020219,
|
// log.info(foldersToBuild);
|
||||||
// Obsidian can create the folder recursively
|
for (const folder of foldersToBuild) {
|
||||||
// but the path should not end with '/'
|
const r = await vault.adapter.exists(folder);
|
||||||
if (thePath === "/" || thePath === "") {
|
// log.info(r);
|
||||||
return;
|
if (!r) {
|
||||||
|
log.info(`mkdir ${folder}`);
|
||||||
|
await vault.adapter.mkdir(folder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let thePathNoEnding = thePath.endsWith("/")
|
|
||||||
? thePath.slice(0, thePath.length - 1)
|
|
||||||
: thePath;
|
|
||||||
await vault.adapter.mkdir(thePathNoEnding);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -442,6 +442,8 @@ export const getSyncPlanInplace = async (
|
|||||||
// folder
|
// folder
|
||||||
// folder doesn't worry about mtime and size, only check their existences
|
// folder doesn't worry about mtime and size, only check their existences
|
||||||
if (keptFolder.has(key)) {
|
if (keptFolder.has(key)) {
|
||||||
|
// parent should also be kept
|
||||||
|
keptFolder.add(getParentFolder(key));
|
||||||
// should fill the missing part
|
// should fill the missing part
|
||||||
if (local !== undefined && remote !== undefined) {
|
if (local !== undefined && remote !== undefined) {
|
||||||
mixedEntry.decisionBranch = 101;
|
mixedEntry.decisionBranch = 101;
|
||||||
@ -731,7 +733,9 @@ const splitThreeStepsOnEntityMappings = (
|
|||||||
val.decision === "folder_existed_remote" ||
|
val.decision === "folder_existed_remote" ||
|
||||||
val.decision === "folder_to_be_created"
|
val.decision === "folder_to_be_created"
|
||||||
) {
|
) {
|
||||||
|
log.debug(`splitting folder: key=${key},val=${JSON.stringify(val)}`);
|
||||||
const level = atWhichLevel(key);
|
const level = atWhichLevel(key);
|
||||||
|
log.debug(`atWhichLevel: ${level}`);
|
||||||
if (folderCreationOps[level - 1] === undefined) {
|
if (folderCreationOps[level - 1] === undefined) {
|
||||||
folderCreationOps[level - 1] = [val];
|
folderCreationOps[level - 1] = [val];
|
||||||
} else {
|
} else {
|
||||||
@ -891,6 +895,11 @@ export const doActualSync = async (
|
|||||||
log.debug(`concurrency === ${concurrency}`);
|
log.debug(`concurrency === ${concurrency}`);
|
||||||
const { folderCreationOps, deletionOps, uploadDownloads, realTotalCount } =
|
const { folderCreationOps, deletionOps, uploadDownloads, realTotalCount } =
|
||||||
splitThreeStepsOnEntityMappings(mixedEntityMappings);
|
splitThreeStepsOnEntityMappings(mixedEntityMappings);
|
||||||
|
log.debug(`folderCreationOps: ${JSON.stringify(folderCreationOps)}`);
|
||||||
|
log.debug(`deletionOps: ${JSON.stringify(deletionOps)}`);
|
||||||
|
log.debug(`uploadDownloads: ${JSON.stringify(uploadDownloads)}`);
|
||||||
|
log.debug(`realTotalCount: ${JSON.stringify(realTotalCount)}`);
|
||||||
|
|
||||||
const nested = [folderCreationOps, deletionOps, uploadDownloads];
|
const nested = [folderCreationOps, deletionOps, uploadDownloads];
|
||||||
const logTexts = [
|
const logTexts = [
|
||||||
`1. create all folders from shadowest to deepest, also check undefined decision`,
|
`1. create all folders from shadowest to deepest, also check undefined decision`,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user