Skip to content

Commit

Permalink
feat: comp set for pulls
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Apr 25, 2022
1 parent 07fdd69 commit 4b361a4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/sourceTracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,34 @@ export class SourceTracking extends AsyncCreatable {
.filter((componentSet) => componentSet.size > 0);
}

public async remoteNonDeletesAsComponentSet(): Promise<ComponentSet> {
const [changeResults, sourceBackedComponents] = await Promise.all([
// all changes based on remote tracking
this.getChanges<ChangeResult>({
origin: 'remote',
state: 'nondelete',
format: 'ChangeResult',
}),
// only returns source-backed components (SBC)
this.getChanges<SourceComponent>({
origin: 'remote',
state: 'nondelete',
format: 'SourceComponent',
}),
]);
const componentSet = new ComponentSet(sourceBackedComponents);
// there may be remote adds not in the SBC. So we add those manually
changeResults.forEach((cr) => {
if (cr.type && cr.name && !componentSet.has({ type: cr.type, fullName: cr.name })) {
componentSet.add({
type: cr.type,
fullName: cr.name,
});
}
});

return componentSet;
}
/**
* Does most of the work for the force:source:status command.
* Outputs need a bit of massage since this aims to provide nice json.
Expand Down

0 comments on commit 4b361a4

Please sign in to comment.