Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions src/client/metadataApiRetrieve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,17 @@ export class MetadataApiRetrieve extends MetadataTransfer<
const localComp = partialDeleteComponents.get(comp.fullName);
if (localComp.contentPath && tree.isDirectory(comp.content)) {
const remoteContentList = tree.readDirectory(comp.content);
let deleteLocalComp = false;

const isForceIgnored = (filePath: string): boolean => {
const ignored = comp.getForceIgnore().denies(filePath);
if (ignored) {
this.logger.debug(
`Local component has ${filePath} while remote does not, but it is forceignored so ignoring.`
);
}
return ignored;
};

localComp.contentList.forEach((fileName) => {
if (!remoteContentList.includes(fileName)) {
// If fileName is forceignored it is not counted as a diff. If fileName is a directory
Expand All @@ -376,30 +386,27 @@ export class MetadataApiRetrieve extends MetadataTransfer<
const fileNameFullPath = path.join(localComp.contentPath, fileName);
if (fs.statSync(fileNameFullPath).isDirectory()) {
const nestedFiles = fs.readdirSync(fileNameFullPath);
if (nestedFiles.some((f) => comp.getForceIgnore().denies(path.join(fileNameFullPath, f)))) {
this.logger.debug(
`Local component has ${fileNameFullPath} while remote does not, but it is forceignored so ignoring.`
);
if (nestedFiles.some((f) => isForceIgnored(path.join(fileNameFullPath, f)))) {
return;
}
} else if (isForceIgnored(fileNameFullPath)) {
return;
}

this.logger.debug(
`Local component (${comp.fullName}) contains ${fileName} while remote component does not. This file is being removed.`
);
deleteLocalComp = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


const filePath = path.join(localComp.contentPath, fileName);
partialDeleteFileResponses.push({
fullName: comp.fullName,
type: comp.type.name,
state: ComponentStatus.Deleted,
filePath: path.join(localComp.contentPath, fileName),
filePath,
});
fs.rmSync(filePath, { recursive: true, force: true });
}
});
if (deleteLocalComp) {
this.logger.debug(`Replacing local component: ${localComp.contentPath} with same component from org`);
fs.rmSync(localComp.contentPath, { recursive: true, force: true });
}
}
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"name": "componentSetCreate",
"duration": 206.49349700001767
},
{
"name": "sourceToMdapi",
"duration": 5455.362960000028
},
{
"name": "sourceToZip",
"duration": 5237.455126999994
},
{
"name": "mdapiToSource",
"duration": 3759.678862999979
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"name": "componentSetCreate",
"duration": 407.67415299999993
},
{
"name": "sourceToMdapi",
"duration": 7544.196715999977
},
{
"name": "sourceToZip",
"duration": 6185.875728999992
},
{
"name": "mdapiToSource",
"duration": 4336.305462999997
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"name": "componentSetCreate",
"duration": 704.1282699999865
},
{
"name": "sourceToMdapi",
"duration": 10994.699290999997
},
{
"name": "sourceToZip",
"duration": 9647.811220000003
},
{
"name": "mdapiToSource",
"duration": 8051.59345700001
}
]