MCPcopy Index your code
hub / github.com/bigcode-project/jupytercoder / applyPatches

Function applyPatches

src/diff.js:891–922  ·  view source on GitHub ↗
(uniDiff, options)

Source from the content-addressed store, hash-verified

889 } // Wrapper that supports multiple file patches via callbacks.
890
891 function applyPatches(uniDiff, options) {
892 if (typeof uniDiff === 'string') {
893 uniDiff = parsePatch(uniDiff);
894 }
895
896 var currentIndex = 0;
897
898 function processIndex() {
899 var index = uniDiff[currentIndex++];
900
901 if (!index) {
902 return options.complete();
903 }
904
905 options.loadFile(index, function (err, data) {
906 if (err) {
907 return options.complete(err);
908 }
909
910 var updatedContent = applyPatch(data, index, options);
911 options.patched(index, updatedContent, function (err) {
912 if (err) {
913 return options.complete(err);
914 }
915
916 processIndex();
917 });
918 });
919 }
920
921 processIndex();
922 }
923
924 function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
925 if (!options) {

Callers

nothing calls this directly

Calls 2

parsePatchFunction · 0.85
processIndexFunction · 0.85

Tested by

no test coverage detected