MCPcopy Create free account
hub / github.com/decaporg/decap-cms / getDifferences

Method getDifferences

packages/decap-cms-backend-gitlab/src/API.ts:775–809  ·  view source on GitHub ↗
(to: string, from = this.branch)

Source from the content-addressed store, hash-verified

773 }
774
775 async getDifferences(to: string, from = this.branch) {
776 if (to === from) {
777 return [];
778 }
779 const result: { diffs: GitLabCommitDiff[] } = await this.requestJSON({
780 url: `${this.repoURL}/repository/compare`,
781 params: {
782 from,
783 to,
784 },
785 });
786
787 if (result.diffs.length >= 1000) {
788 throw new APIError('Diff limit reached', null, API_NAME);
789 }
790
791 return result.diffs.map(d => {
792 let status = 'modified';
793 if (d.new_file) {
794 status = 'added';
795 } else if (d.deleted_file) {
796 status = 'deleted';
797 } else if (d.renamed_file) {
798 status = 'renamed';
799 }
800 return {
801 status,
802 oldPath: d.old_path,
803 newPath: d.new_path,
804 newFile: d.new_file,
805 path: d.new_path || d.old_path,
806 binary: d.diff.startsWith('Binary') || /.svg$/.test(d.new_path),
807 };
808 });
809 }
810
811 async retrieveUnpublishedEntryData(contentKey: string) {
812 const { collection, slug } = parseContentKey(contentKey);

Callers 3

editorialWorkflowGitMethod · 0.95
allEntriesByFolderMethod · 0.45

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected