├── test ├── modules │ ├── patches-file-owner │ │ ├── patches.json │ │ └── composer.json │ ├── composer-patches-target1 │ │ ├── composer.json │ │ ├── src │ │ │ └── example.txt │ │ └── LICENSE_VAIMO.txt │ ├── composer-patches-target2 │ │ ├── composer.json │ │ ├── src │ │ │ └── example.txt │ │ └── LICENSE_VAIMO.txt │ ├── composer-patches-target3 │ │ ├── composer.json │ │ ├── src │ │ │ └── example.txt │ │ └── LICENSE_VAIMO.txt │ └── patches-search-owner │ │ └── composer.json ├── scenarios │ ├── remote-fail │ │ ├── .commands │ │ ├── .label │ │ ├── .filters │ │ ├── files │ │ │ └── patches.json │ │ ├── .output │ │ └── .output-v1 │ ├── remote-list-fail │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ └── patches.json │ │ └── .output │ ├── remote-sha1-fail │ │ ├── .commands │ │ ├── .label │ │ ├── .filters │ │ ├── files │ │ │ ├── patches │ │ │ │ └── single-package-single-file-no-version.patch │ │ │ └── patches.json │ │ └── .output │ ├── remote-success │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── single-package-single-file-no-version.patch │ │ ├── .output-v1 │ │ └── .output │ ├── apply-failure-simple │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── single-package-single-file-no-version.patch │ │ ├── .output-v1 │ │ └── .output │ ├── remote-bundle-success │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── multiple-packages-single-file.patch │ │ ├── .output-v1 │ │ └── .output │ ├── remote-sha1-success │ │ ├── .commands │ │ ├── .label │ │ ├── .output-v1 │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── single-package-single-file-no-version.patch │ │ └── .output │ ├── remote-unsecure-fail │ │ ├── .commands │ │ ├── .label │ │ ├── .filters │ │ ├── files │ │ │ └── patches.json │ │ └── .output │ ├── apply-single-success │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── first-change.patch │ │ ├── .output-v1 │ │ └── .output │ ├── levels │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── 2_patch-level-0.patch │ │ │ │ ├── 3_patch-no-level.patch │ │ │ │ ├── 0_patch-level-1.patch │ │ │ │ └── 1_patch-level-1.patch │ │ │ └── patches.json │ │ ├── .output-v1 │ │ └── .output │ ├── remote-validate-fail │ │ ├── .commands │ │ ├── .label │ │ ├── .output │ │ └── files │ │ │ └── patches.json │ ├── rename │ │ ├── .label │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ ├── 0_initial-change.patch │ │ │ │ └── 1_second-change.patch │ │ ├── .commands │ │ └── .output-v1 │ ├── sequence │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── 2_initial-change.patch │ │ │ │ ├── 3_third-change.patch │ │ │ │ ├── 1_second-change.patch │ │ │ │ └── 0_fourth-change.patch │ │ │ └── patches.json │ │ ├── .output-v1 │ │ └── .output │ ├── undo-all │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .output-v1 │ ├── apply-failure-corrupt-content │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── single-package-single-file-no-version.patch │ │ ├── .output-darwin │ │ ├── .output-v1 │ │ └── .output │ ├── list-items │ │ ├── .label │ │ ├── .commands │ │ └── files │ │ │ ├── patches │ │ │ ├── single-package-single-file-no-version.patch │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ ├── naming │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ ├── one-line-change.patch │ │ │ │ └── .patch │ │ │ │ └── one-line-change.patch.other │ │ ├── .output-v1 │ │ └── .output │ ├── skipped-patch │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── 1_second-change.patch │ │ │ │ └── 0_initial-change.patch │ │ │ └── patches.json │ │ ├── .output-v1 │ │ └── .output │ ├── validation-error-files │ │ ├── .commands │ │ ├── .label │ │ ├── .output │ │ └── files │ │ │ ├── patches │ │ │ ├── single-package-single-file-no-version.patch │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ └── single-package-single-file-non-matching-constraint.patch │ │ │ ├── patches.json │ │ │ └── patches2 │ │ │ └── multiple-packages-single-file.patch │ ├── validation-error-search │ │ ├── .commands │ │ ├── .label │ │ ├── .output │ │ └── files │ │ │ ├── patches │ │ │ ├── single-package-single-file-no-version.patch │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ └── single-package-single-file-non-matching-constraint.patch │ │ │ ├── patches.json │ │ │ └── patches2 │ │ │ └── multiple-packages-single-file.patch │ ├── content-change │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ ├── 0_initial-change.patch │ │ │ │ └── 1_second-change.patch │ │ ├── .output-v1 │ │ └── .output │ ├── default-event-install │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .output-v1 │ ├── default-event-update │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .output-v1 │ ├── patch-description │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── single-package-single-file.patch │ │ ├── .output-v1 │ │ └── .output │ ├── redo-all │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ ├── 0_first-change.patch │ │ │ │ └── 1_second-change.patch │ │ └── .output-v1 │ ├── redo-single │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ ├── 0_first-change.patch │ │ │ │ └── 1_second-change.patch │ │ ├── .output-v1 │ │ └── .output │ ├── reverted-patch │ │ ├── .commands │ │ ├── .label │ │ └── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ └── some-changes.patch │ ├── undo-single │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ ├── 1_second-change.patch │ │ │ │ └── 0_first-change.patch │ │ ├── .output-v1 │ │ └── .output │ ├── default-command-apply │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-matching-constraint.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .output-v1 │ ├── default-command-redo │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .output-v1 │ ├── apply-real-package-success │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── first-change.patch │ │ ├── .output-v1 │ │ └── .output │ ├── full-reset │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ ├── .commands │ │ └── .output-v1 │ ├── lock-persistence-install │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .commands │ ├── lock-persistence-update │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .commands │ ├── owner-remove-keep │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── one-line-change.patch │ │ ├── .output-v1 │ │ └── .output │ ├── lock-persistence-apply │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .output-v1 │ ├── root-branch-alias │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── first-change.patch │ │ ├── .output-v1 │ │ └── .output │ ├── lock-persistence-update-lock │ │ ├── .label │ │ └── files │ │ │ ├── patches │ │ │ ├── single-package-single-file-no-version.patch │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ ├── addition-direct │ │ ├── .label │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ ├── 0_initial-change.patch │ │ │ │ └── 1_second-change.patch │ │ ├── .commands │ │ ├── .output-v1 │ │ └── .output │ ├── removal-direct │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ ├── 1_second-change.patch │ │ │ │ └── 0_initial-change.patch │ │ ├── .output-v1 │ │ └── .output │ ├── strict-lock-update-no-patch-applied │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ ├── .commands │ │ ├── .output │ │ └── .output-v1 │ ├── default-event-update-partial-reapply │ │ ├── .label │ │ ├── .commands │ │ └── files │ │ │ ├── patches │ │ │ ├── single-package-single-file-no-version.patch │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ ├── lock-persistence-apply-redo-spam │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .commands │ ├── default-event-install-partial-reapply │ │ ├── .label │ │ ├── .commands │ │ └── files │ │ │ ├── patches │ │ │ ├── single-package-single-file-no-version.patch │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ ├── owner-remove-reset │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── one-line-change.patch │ │ ├── .output-v1 │ │ └── .output │ ├── depends │ │ ├── .label │ │ ├── .commands │ │ ├── files │ │ │ ├── patches.json │ │ │ └── patches │ │ │ │ └── change.patch │ │ └── .output-v1 │ ├── strict-lock-update-keep-patches-applied │ │ ├── .commands │ │ ├── .label │ │ ├── files │ │ │ ├── patches │ │ │ │ ├── single-package-single-file-no-version.patch │ │ │ │ ├── single-package-single-file-wildcard-version.patch │ │ │ │ ├── single-package-single-file-non-matching-constraint.patch │ │ │ │ └── multiple-packages-single-file.patch │ │ │ └── patches.json │ │ └── .output-v1 │ └── depends-negated │ │ ├── .label │ │ ├── .commands │ │ └── files │ │ ├── patches.json │ │ └── patches │ │ └── change.patch ├── installations │ ├── package-using-file │ │ ├── .target │ │ ├── .label │ │ └── .skip │ ├── package-using-search │ │ ├── .target │ │ ├── .label │ │ └── .skip │ ├── root-using-file │ │ ├── .label │ │ └── .skip │ └── root-using-search │ │ ├── .label │ │ └── .skip └── dependencies │ └── composer.json ├── .github └── ISSUE_TEMPLATE │ ├── custom.md │ ├── bug_report.md │ └── feature_request.md ├── bin ├── normalise ├── bootstrap ├── analyse └── bootstrap-test-env ├── .config └── phpcs │ ├── whitelist │ ├── loophp-phposinfo │ │ ├── default │ │ ├── version-1.7.2 │ │ ├── version-1.6.1.4 │ │ └── version-1.6.5 │ ├── drupol-phposinfo │ │ ├── default │ │ ├── version-1.6.2 │ │ └── version-1.6.5 │ └── symfony-console │ │ ├── version-v5.4.47 │ │ ├── version-v4.4.49 │ │ ├── version-v3.4.47 │ │ └── version-v6.4.21 │ └── vendor.xml ├── src ├── Composer │ ├── Constraint.php │ ├── Constants.php │ ├── Plugin │ │ └── Behaviour.php │ ├── ResetOperation.php │ ├── OutputUtils.php │ ├── Commands │ │ └── ApplyCommand.php │ └── CommandsProvider.php ├── Exceptions │ ├── ReadException.php │ ├── DecoderException.php │ ├── LoaderException.php │ ├── PackageNotFound.php │ ├── RuntimeException.php │ ├── PackageResetException.php │ ├── PackageResolverException.php │ ├── ConfigValidationException.php │ ├── ApplierFailure.php │ ├── OperationFailure.php │ └── PatchFailureException.php ├── Repository │ └── PatchesApplier │ │ ├── Operation.php │ │ └── ListResolvers │ │ └── DirectListResolver.php ├── Interfaces │ ├── PatchFailureHandlerInterface.php │ ├── PackageResetStrategyInterface.php │ ├── PatchPackagesResolverInterface.php │ ├── PatchSourceListInterface.php │ ├── PatchSourceLoaderInterface.php │ ├── DefinitionListLoaderComponentInterface.php │ ├── PackageConfigExtractorInterface.php │ ├── DefinitionNormalizerComponentInterface.php │ ├── DefinitionExploderComponentInterface.php │ ├── PatchesResetsResolverInterface.php │ └── ListResolverInterface.php ├── Patch │ ├── File │ │ └── Loader.php │ ├── SourceLoaders │ │ └── PatchList.php │ ├── Definition │ │ ├── NormalizerComponents │ │ │ └── PathComponent.php │ │ ├── Exploder │ │ │ └── ItemBuilder.php │ │ └── Value │ │ │ └── Analyser.php │ ├── FailureHandlers │ │ └── FatalHandler.php │ └── DefinitionList │ │ └── Sanitizer.php ├── Environment.php ├── Strategies │ └── Package │ │ └── ForcedResetStrategy.php ├── Utils │ ├── PackagePatchDataUtils.php │ ├── RuntimeUtils.php │ ├── PathUtils.php │ └── ConstraintUtils.php ├── Events.php ├── Package │ ├── ConfigExtractors │ │ ├── NamespaceConfigExtractor.php │ │ └── InstalledConfigExtractor.php │ ├── OperationAnalyser.php │ └── PatchApplier │ │ └── StatusConfig.php └── Sources │ └── ProjectSource.php ├── .gitignore ├── modules └── proxy-plugin │ └── composer.json ├── phpcs.xml ├── .travis.yml └── phpmd.xml /test/modules/patches-file-owner/patches.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /test/scenarios/remote-fail/.commands: -------------------------------------------------------------------------------- 1 | !patch:apply 2 | -------------------------------------------------------------------------------- /test/scenarios/remote-list-fail/.commands: -------------------------------------------------------------------------------- 1 | patch:list -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-fail/.commands: -------------------------------------------------------------------------------- 1 | !patch:apply -------------------------------------------------------------------------------- /test/scenarios/remote-success/.commands: -------------------------------------------------------------------------------- 1 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/apply-failure-simple/.commands: -------------------------------------------------------------------------------- 1 | !patch:apply -------------------------------------------------------------------------------- /test/scenarios/remote-bundle-success/.commands: -------------------------------------------------------------------------------- 1 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-success/.commands: -------------------------------------------------------------------------------- 1 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/remote-unsecure-fail/.commands: -------------------------------------------------------------------------------- 1 | !patch:apply -------------------------------------------------------------------------------- /test/scenarios/apply-single-success/.label: -------------------------------------------------------------------------------- 1 | one patch applied -------------------------------------------------------------------------------- /test/scenarios/levels/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/remote-validate-fail/.commands: -------------------------------------------------------------------------------- 1 | !patch:validate -------------------------------------------------------------------------------- /test/scenarios/rename/.label: -------------------------------------------------------------------------------- 1 | re-apply patch when file renamed -------------------------------------------------------------------------------- /test/scenarios/sequence/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/undo-all/.label: -------------------------------------------------------------------------------- 1 | two patches applied, both undo'ed -------------------------------------------------------------------------------- /test/scenarios/apply-failure-corrupt-content/.commands: -------------------------------------------------------------------------------- 1 | !patch:apply -------------------------------------------------------------------------------- /test/scenarios/list-items/.label: -------------------------------------------------------------------------------- 1 | patches get listed without issues -------------------------------------------------------------------------------- /test/scenarios/naming/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | -------------------------------------------------------------------------------- /test/scenarios/skipped-patch/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/validation-error-files/.commands: -------------------------------------------------------------------------------- 1 | !patch:validate 2 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-search/.commands: -------------------------------------------------------------------------------- 1 | !patch:validate 2 | -------------------------------------------------------------------------------- /test/scenarios/content-change/.label: -------------------------------------------------------------------------------- 1 | re-apply patch when content changes -------------------------------------------------------------------------------- /test/scenarios/default-event-install/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | install -------------------------------------------------------------------------------- /test/scenarios/default-event-update/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | update -------------------------------------------------------------------------------- /test/scenarios/patch-description/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/redo-all/.label: -------------------------------------------------------------------------------- 1 | redoing all patches should not cause issues -------------------------------------------------------------------------------- /test/scenarios/redo-single/.label: -------------------------------------------------------------------------------- 1 | two patches present, one gets redo'ed -------------------------------------------------------------------------------- /test/scenarios/remote-success/.label: -------------------------------------------------------------------------------- 1 | remote patch apply should not fail -------------------------------------------------------------------------------- /test/scenarios/reverted-patch/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | !patch:apply -------------------------------------------------------------------------------- /test/scenarios/undo-single/.label: -------------------------------------------------------------------------------- 1 | two patches applied, one gets undo'ed -------------------------------------------------------------------------------- /test/installations/package-using-file/.target: -------------------------------------------------------------------------------- 1 | vendor/vaimo/patches-file-owner -------------------------------------------------------------------------------- /test/scenarios/apply-single-success/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/default-command-apply/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/default-command-redo/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:redo -------------------------------------------------------------------------------- /test/scenarios/undo-all/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | patch:undo -------------------------------------------------------------------------------- /test/installations/package-using-search/.target: -------------------------------------------------------------------------------- 1 | vendor/vaimo/patches-search-owner -------------------------------------------------------------------------------- /test/scenarios/redo-all/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | patch:redo 4 | -------------------------------------------------------------------------------- /test/scenarios/redo-single/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:redo --filter second -------------------------------------------------------------------------------- /test/scenarios/apply-real-package-success/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | 3 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/remote-fail/.label: -------------------------------------------------------------------------------- 1 | remote patch should fail to download due to bad path -------------------------------------------------------------------------------- /test/scenarios/sequence/.label: -------------------------------------------------------------------------------- 1 | patches that are forced to be applied in certain sequence -------------------------------------------------------------------------------- /test/scenarios/skipped-patch/.label: -------------------------------------------------------------------------------- 1 | first change is skipped due to explicit skip flag -------------------------------------------------------------------------------- /test/scenarios/full-reset/.label: -------------------------------------------------------------------------------- 1 | removal of all patches should cause all packages to be reset -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-install/.label: -------------------------------------------------------------------------------- 1 | lock should remain without changes on install -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update/.label: -------------------------------------------------------------------------------- 1 | lock should remain without changes on update -------------------------------------------------------------------------------- /test/scenarios/owner-remove-keep/.label: -------------------------------------------------------------------------------- 1 | keeps patches when package removed with no-plugins -------------------------------------------------------------------------------- /test/scenarios/patch-description/.label: -------------------------------------------------------------------------------- 1 | unusual patch description should not cause a failure -------------------------------------------------------------------------------- /test/scenarios/remote-bundle-success/.label: -------------------------------------------------------------------------------- 1 | remote patch that applied on multiple packages -------------------------------------------------------------------------------- /test/scenarios/remote-list-fail/.label: -------------------------------------------------------------------------------- 1 | remote patch should fail to download due to bad path -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-fail/.label: -------------------------------------------------------------------------------- 1 | remote patch apply should fail on checksum validation -------------------------------------------------------------------------------- /test/scenarios/validation-error-files/.label: -------------------------------------------------------------------------------- 1 | patch validation fails dues to multiple issues -------------------------------------------------------------------------------- /test/scenarios/validation-error-search/.label: -------------------------------------------------------------------------------- 1 | patch validation fails dues to multiple issues -------------------------------------------------------------------------------- /test/scenarios/apply-failure-simple/.label: -------------------------------------------------------------------------------- 1 | patch apply should encounter a failure and report causes -------------------------------------------------------------------------------- /test/scenarios/apply-real-package-success/.label: -------------------------------------------------------------------------------- 1 | real (downloaded from packagist) package installed -------------------------------------------------------------------------------- /test/scenarios/default-command-apply/.label: -------------------------------------------------------------------------------- 1 | simple set of single and multi-line patches using apply -------------------------------------------------------------------------------- /test/scenarios/default-command-redo/.label: -------------------------------------------------------------------------------- 1 | simple set of single and multi-line patches using redo -------------------------------------------------------------------------------- /test/scenarios/default-event-update/.label: -------------------------------------------------------------------------------- 1 | simple set of single and multi-line patches with update -------------------------------------------------------------------------------- /test/scenarios/list-items/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:list 3 | patch:apply 4 | patch:list -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply/.label: -------------------------------------------------------------------------------- 1 | lock should remain without changes on patch:apply -------------------------------------------------------------------------------- /test/scenarios/naming/.label: -------------------------------------------------------------------------------- 1 | can deal with folders and files names that contain the name: .patch -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-success/.label: -------------------------------------------------------------------------------- 1 | remote patch apply should not fail checksum validation -------------------------------------------------------------------------------- /test/scenarios/remote-unsecure-fail/.label: -------------------------------------------------------------------------------- 1 | remote patch should fail to download due to bad path -------------------------------------------------------------------------------- /test/scenarios/remote-validate-fail/.label: -------------------------------------------------------------------------------- 1 | remote patch should fail to download due to bad path -------------------------------------------------------------------------------- /test/scenarios/root-branch-alias/.label: -------------------------------------------------------------------------------- 1 | one patch applied for root package that has branch alias -------------------------------------------------------------------------------- /test/scenarios/undo-single/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | patch:undo --filter second -------------------------------------------------------------------------------- /test/scenarios/default-event-install/.label: -------------------------------------------------------------------------------- 1 | simple set of single and multi-line patches with install -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update-lock/.label: -------------------------------------------------------------------------------- 1 | lock should remain without changes on lock update -------------------------------------------------------------------------------- /test/installations/root-using-file/.label: -------------------------------------------------------------------------------- 1 | Using patches.json that has been defined in the ROOT composer.json -------------------------------------------------------------------------------- /test/installations/package-using-file/.label: -------------------------------------------------------------------------------- 1 | Using patches.json that has been defined in the PACKAGE composer.json -------------------------------------------------------------------------------- /test/installations/root-using-search/.label: -------------------------------------------------------------------------------- 1 | Using patches-search that has been defined in the ROOT composer.json -------------------------------------------------------------------------------- /test/scenarios/addition-direct/.label: -------------------------------------------------------------------------------- 1 | patches get reapplied when one patch gets added (directly for one package) -------------------------------------------------------------------------------- /test/scenarios/apply-failure-corrupt-content/.label: -------------------------------------------------------------------------------- 1 | patch apply should encounter a failure (no file reference) -------------------------------------------------------------------------------- /test/scenarios/removal-direct/.label: -------------------------------------------------------------------------------- 1 | patches get reapplied when one patch is removed (directly from one package) -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-no-patch-applied/.label: -------------------------------------------------------------------------------- 1 | should not apply patches when user only updating lock -------------------------------------------------------------------------------- /test/installations/package-using-file/.skip: -------------------------------------------------------------------------------- 1 | removal-direct 2 | addition-direct 3 | rename 4 | validation-error-search -------------------------------------------------------------------------------- /test/installations/package-using-search/.label: -------------------------------------------------------------------------------- 1 | Using patches.json that has been defined in the PACKAGE composer.json -------------------------------------------------------------------------------- /test/scenarios/default-event-update-partial-reapply/.label: -------------------------------------------------------------------------------- 1 | simple set of single and multi-line patches with re-update -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply-redo-spam/.label: -------------------------------------------------------------------------------- 1 | lock should remain without changes on several patch commands -------------------------------------------------------------------------------- /test/scenarios/reverted-patch/.label: -------------------------------------------------------------------------------- 1 | reverted changes should not be applied when patcher detects already applied patch -------------------------------------------------------------------------------- /test/scenarios/default-event-install-partial-reapply/.label: -------------------------------------------------------------------------------- 1 | simple set of single and multi-line patches with re-install -------------------------------------------------------------------------------- /test/scenarios/levels/.label: -------------------------------------------------------------------------------- 1 | patch specific level configuration must work regardless of the order the fields are defined in -------------------------------------------------------------------------------- /test/scenarios/owner-remove-reset/.label: -------------------------------------------------------------------------------- 1 | reverts the content of patched packages to original when patches owner uninstalled -------------------------------------------------------------------------------- /test/scenarios/depends/.label: -------------------------------------------------------------------------------- 1 | should not apply patch when patch dependency is not fulfilled and should apply the patch when it is -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-keep-patches-applied/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | 4 | update --lock 5 | 6 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-keep-patches-applied/.label: -------------------------------------------------------------------------------- 1 | should keep patches applied when updating lock or re-installing package -------------------------------------------------------------------------------- /test/scenarios/removal-direct/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | >rm {{OWNER-ROOT}}/patches/1_second-change.patch 4 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/depends-negated/.label: -------------------------------------------------------------------------------- 1 | should apply patch when negated patch dependency is fulfilled and should not apply the patch when it is not -------------------------------------------------------------------------------- /test/installations/root-using-file/.skip: -------------------------------------------------------------------------------- 1 | removal-direct 2 | addition-direct 3 | rename 4 | validation-error-search 5 | owner-remove-keep 6 | owner-remove-reset -------------------------------------------------------------------------------- /test/scenarios/root-branch-alias/.commands: -------------------------------------------------------------------------------- 1 | @config version "dev-master" 2 | @config extra/branch-alias/dev-master "1.0-dev" 3 | patch:validate 4 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-fail/.filters: -------------------------------------------------------------------------------- 1 | s/In FileDownloader.php line .*:/In FileDownloader.php:/g 2 | /^#/d 3 | /^Stack trace/d 4 | /^Unhandled promise rejection/d -------------------------------------------------------------------------------- /test/scenarios/content-change/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | >sed -i.org 's/\+valueX/+valueZ/' {{OWNER-ROOT}}/patches/1_second-change.patch 4 | patch:apply -------------------------------------------------------------------------------- /test/scenarios/naming/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "patches/one-line-change.patch" 4 | } 5 | } -------------------------------------------------------------------------------- /test/scenarios/reverted-patch/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "patches/some-changes.patch" 4 | } 5 | } -------------------------------------------------------------------------------- /test/scenarios/remote-unsecure-fail/.filters: -------------------------------------------------------------------------------- 1 | s/In TransportErrorHandler.php line .*:/In TransportErrorHandler.php:/g 2 | /^#/d 3 | /^Stack trace/d 4 | /^Unhandled promise rejection/d -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | 3 | patch:apply 4 | 5 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 6 | -------------------------------------------------------------------------------- /test/scenarios/owner-remove-reset/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | remove {{PATCHES-OWNER}} --no-update 4 | update 5 | @assert vaimo/composer-patches-target1,value8,value8 6 | -------------------------------------------------------------------------------- /test/scenarios/root-branch-alias/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueX": "patches/first-change.patch" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/scenarios/apply-single-success/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueX": "patches/first-change.patch" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/scenarios/apply-real-package-success/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/topological-sort": { 3 | "Change: Dependency => The cool thing": "patches/first-change.patch" 4 | } 5 | } -------------------------------------------------------------------------------- /test/scenarios/validation-error-search/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | - {{PATCHES-OWNER}} 3 | ~ patches2/multiple-packages-single-file.patch [NO CONFIG] 4 | Orphans found! 5 | -------------------------------------------------------------------------------- /test/scenarios/owner-remove-keep/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | remove --no-plugins {{PATCHES-OWNER}} --no-update 4 | update --no-plugins 5 | @assert vaimo/composer-patches-target1,value8,valueC -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/scenarios/apply-failure-simple/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/scenarios/apply-failure-corrupt-content/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/scenarios/depends/.commands: -------------------------------------------------------------------------------- 1 | remove vaimo/composer-patches-target2 --no-update 2 | update 3 | require vaimo/composer-patches-target2 --no-update 4 | update 5 | remove vaimo/composer-patches-target2 --no-update 6 | update -------------------------------------------------------------------------------- /test/scenarios/owner-remove-keep/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC (expecting revert on owner removal)": "patches/one-line-change.patch" 4 | } 5 | } -------------------------------------------------------------------------------- /test/scenarios/owner-remove-reset/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC (expecting revert on owner removal)": "patches/one-line-change.patch" 4 | } 5 | } -------------------------------------------------------------------------------- /bin/normalise: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | : <<'COPYRIGHT' 3 | Copyright (c) Vaimo Group. All rights reserved. 4 | See LICENSE_VAIMO.txt for license details. 5 | COPYRIGHT 6 | 7 | vendor/bin/phpcbf -p src 8 | 9 | exit 0 10 | -------------------------------------------------------------------------------- /test/scenarios/depends-negated/.commands: -------------------------------------------------------------------------------- 1 | remove vaimo/composer-patches-target2 --no-update 2 | update 3 | require vaimo/composer-patches-target2 --no-update 4 | update 5 | remove vaimo/composer-patches-target2 --no-update 6 | update -------------------------------------------------------------------------------- /test/scenarios/patch-description/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC with some corrupting %s description %1 %s": "patches/single-package-single-file.patch" 4 | } 5 | } -------------------------------------------------------------------------------- /.config/phpcs/whitelist/loophp-phposinfo/default: -------------------------------------------------------------------------------- 1 | Incorrect error: src/OsInfo.php,103,25,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 2 | Incorrect error: src/OsInfo.php,133,23,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 3 | -------------------------------------------------------------------------------- /test/installations/package-using-search/.skip: -------------------------------------------------------------------------------- 1 | remote-success 2 | remote-fail 3 | validation-error-files 4 | remote-bundle-success 5 | remote-sha1-success 6 | remote-sha1-fail 7 | remote-unsecure-fail 8 | remote-validate-fail 9 | remote-list-fail -------------------------------------------------------------------------------- /test/scenarios/redo-all/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueX": "patches/0_first-change.patch", 4 | "Change: valueX => valueY": "patches/1_second-change.patch" 5 | } 6 | } -------------------------------------------------------------------------------- /test/scenarios/rename/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "patches/0_initial-change.patch", 4 | "Change: valueC => valueX": "patches/1_second-change.patch" 5 | } 6 | } -------------------------------------------------------------------------------- /test/scenarios/remote-fail/.filters: -------------------------------------------------------------------------------- 1 | s/(.* 404 .*)/(404)/g 2 | s/In CurlDownloader.php line .*:/In CurlDownloader.php:/g 3 | s/In RemoteFilesystem.php line .*:/In RemoteFilesystem.php:/g 4 | /^#/d 5 | /^Stack trace/d 6 | /^Unhandled promise rejection/d -------------------------------------------------------------------------------- /test/scenarios/undo-single/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueX": "patches/0_first-change.patch", 4 | "Change: valueX => valueY": "patches/1_second-change.patch" 5 | } 6 | } -------------------------------------------------------------------------------- /.config/phpcs/whitelist/loophp-phposinfo/version-1.7.2: -------------------------------------------------------------------------------- 1 | Incorrect error: src/OsInfo.php,103,25,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 2 | Incorrect error: src/OsInfo.php,133,23,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 3 | -------------------------------------------------------------------------------- /test/scenarios/addition-direct/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "patches/0_initial-change.patch", 4 | "Change: valueC => valueX": "patches/1_second-change.patch" 5 | } 6 | } -------------------------------------------------------------------------------- /test/scenarios/content-change/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "patches/0_initial-change.patch", 4 | "Change: valueC => valueX": "patches/1_second-change.patch" 5 | } 6 | } -------------------------------------------------------------------------------- /test/scenarios/redo-single/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueX": "patches/0_first-change.patch", 4 | "Change: valueX => valueY": "patches/1_second-change.patch" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/scenarios/removal-direct/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "patches/0_initial-change.patch", 4 | "Change: valueC => valueX": "patches/1_second-change.patch" 5 | } 6 | } -------------------------------------------------------------------------------- /test/scenarios/rename/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | >mv {{OWNER-ROOT}}/patches/1_second-change.patch {{OWNER-ROOT}}/patches/1_renamed-patch.patch 4 | >sed -i.org 's/valueX/valueZ/' {{OWNER-ROOT}}/patches/1_renamed-patch.patch 5 | patch:apply -------------------------------------------------------------------------------- /test/modules/composer-patches-target1/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vaimo/composer-patches-target1", 3 | "type": "library", 4 | "version": "1.0.0", 5 | "description": "Mock module for testing the patch applier", 6 | "license": "MIT" 7 | } 8 | -------------------------------------------------------------------------------- /test/modules/composer-patches-target2/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vaimo/composer-patches-target2", 3 | "type": "library", 4 | "version": "1.2.0", 5 | "description": "Mock module for testing the patch applier", 6 | "license": "MIT" 7 | } 8 | -------------------------------------------------------------------------------- /test/modules/composer-patches-target3/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vaimo/composer-patches-target3", 3 | "type": "library", 4 | "version": "1.2.3", 5 | "description": "Mock module for testing the patch applier", 6 | "license": "MIT" 7 | } 8 | -------------------------------------------------------------------------------- /test/scenarios/remote-fail/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "https://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/Composer/Constraint.php: -------------------------------------------------------------------------------- 1 | valueC": "http://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/Exceptions/ReadException.php: -------------------------------------------------------------------------------- 1 | mv {{OWNER-ROOT}}/patches/1_second-change.patch {{OWNER-ROOT}}/patches/1_second-change.bak 3 | patch:apply 4 | >mv {{OWNER-ROOT}}/patches/1_second-change.bak {{OWNER-ROOT}}/patches/1_second-change.patch 5 | patch:apply 6 | -------------------------------------------------------------------------------- /test/scenarios/remote-bundle-success/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: multiple": "https://raw.githubusercontent.com/vaimo/composer-patches/release/3/test/scenarios/remote-bundle-success/files/patches/multiple-packages-single-file.patch" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/Exceptions/DecoderException.php: -------------------------------------------------------------------------------- 1 | valueC": "https://raw.githubusercontent.com/vaimo/composer-patches/release/3/test/scenarios/remote-success/files/patches/single-package-single-file-no-version.patch" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/scenarios/depends/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change": { 4 | "source": "patches/change.patch", 5 | "depends": { 6 | "vaimo/composer-patches-target2": ">=1.0.0" 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/scenarios/remote-fail/.output-v1: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | 3 | In RemoteFilesystem.php: 4 | 5 | The "https://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url 6 | /single-package-single-file-no-version.patch" file could not be downloaded 7 | (404) 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Repository/PatchesApplier/Operation.php: -------------------------------------------------------------------------------- 1 | =1.0.0" 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/scenarios/levels/files/patches/2_patch-level-0.patch: -------------------------------------------------------------------------------- 1 | Change: valueX => valueY 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -valueX 12 | +valueY 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/levels/files/patches/3_patch-no-level.patch: -------------------------------------------------------------------------------- 1 | Change: valueY => valueZ 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -valueY 12 | +valueZ 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/naming/files/patches/one-line-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/redo-all/files/patches/0_first-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueX 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/rename/files/patches/0_initial-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/levels/files/patches/0_patch-level-1.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- a/src/example.txt.org 6 | +++ b/src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/levels/files/patches/1_patch-level-1.patch: -------------------------------------------------------------------------------- 1 | Change: valueC => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- a/src/example.txt.org 6 | +++ b/src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -valueC 12 | +valueX 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/redo-single/files/patches/0_first-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueX 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/reverted-patch/files/patches/some-changes.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -valueC 12 | +value8 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/sequence/files/patches/2_initial-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/skipped-patch/files/patches/1_second-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueC => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueX 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/undo-single/files/patches/1_second-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueX => valueY 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -valueX 12 | +valueY 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/addition-direct/files/patches/0_initial-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/content-change/files/patches/0_initial-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/removal-direct/files/patches/1_second-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueC => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -valueC 12 | +valueX 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/naming/files/patches/.patch/one-line-change.patch.other: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueY 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/skipped-patch/files/patches/0_initial-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @skip 4 | @package vaimo/composer-patches-target1 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -5,7 +5,7 @@ 9 | value5 10 | value6 11 | value7 12 | -value8 13 | +valueC 14 | value9 15 | value10 16 | value11 17 | -------------------------------------------------------------------------------- /.config/phpcs/whitelist/drupol-phposinfo/default: -------------------------------------------------------------------------------- 1 | Incorrect error: src/OsInfo.php,124,25,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 2 | Graceful usage: src/OsInfo.php,179,23,PHPCompatibility.Constants.NewConstants.php_os_familyFound 3 | Graceful usage: src/OsInfo.php,180,50,PHPCompatibility.Constants.NewConstants.php_os_familyFound 4 | -------------------------------------------------------------------------------- /test/scenarios/depends/files/patches/change.patch: -------------------------------------------------------------------------------- 1 | Change 2 | 3 | @package vaimo/composer-patches-target1 4 | @depends vaimo/composer-patches-target2:>=1.0.0 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -5,7 +5,7 @@ 9 | value5 10 | value6 11 | value7 12 | -value8 13 | +valueX 14 | value9 15 | value10 16 | value11 17 | -------------------------------------------------------------------------------- /test/scenarios/sequence/files/patches/3_third-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueX => valueY 2 | 3 | @package vaimo/composer-patches-target1 4 | @after second-change 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -5,7 +5,7 @@ 9 | value5 10 | value6 11 | value7 12 | -valueX 13 | +valueY 14 | value9 15 | value10 16 | value11 17 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-files/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | - {{PATCHES-OWNER}} 3 | ~ patches/single-package-single-file-non-matching-constraint.patch [NO CONFIG] 4 | ~ patches2/multiple-packages-single-file.patch [NO CONFIG] 5 | ~ patches/multiple-packages-single-file.patch [NO FILE] 6 | Orphans found! 7 | -------------------------------------------------------------------------------- /.config/phpcs/whitelist/drupol-phposinfo/version-1.6.2: -------------------------------------------------------------------------------- 1 | Incorrect error: src/OsInfo.php,126,25,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 2 | Graceful usage: src/OsInfo.php,181,23,PHPCompatibility.Constants.NewConstants.php_os_familyFound 3 | Graceful usage: src/OsInfo.php,182,50,PHPCompatibility.Constants.NewConstants.php_os_familyFound 4 | -------------------------------------------------------------------------------- /.config/phpcs/whitelist/loophp-phposinfo/version-1.6.1.4: -------------------------------------------------------------------------------- 1 | Incorrect error: src/OsInfo.php,124,25,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 2 | Graceful usage: src/OsInfo.php,179,23,PHPCompatibility.Constants.NewConstants.php_os_familyFound 3 | Graceful usage: src/OsInfo.php,180,50,PHPCompatibility.Constants.NewConstants.php_os_familyFound 4 | -------------------------------------------------------------------------------- /test/scenarios/naming/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (1) 5 | ~ {{PATCHES-OWNER}}: patches/one-line-change.patch [NEW] 6 | Change: value8 => valueC 7 | 8 | Writing patch info to install file 9 | -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-fail/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/sequence/files/patches/1_second-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueC => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @after initial-change 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -5,7 +5,7 @@ 9 | value5 10 | value6 11 | value7 12 | -valueC 13 | +valueX 14 | value9 15 | value10 16 | value11 17 | -------------------------------------------------------------------------------- /test/scenarios/depends-negated/files/patches/change.patch: -------------------------------------------------------------------------------- 1 | Change 2 | 3 | @package vaimo/composer-patches-target1 4 | @depends !vaimo/composer-patches-target2:>=1.0.0 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -5,7 +5,7 @@ 9 | value5 10 | value6 11 | value7 12 | -value8 13 | +valueX 14 | value9 15 | value10 16 | value11 17 | -------------------------------------------------------------------------------- /test/scenarios/redo-single/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (2) 5 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [MATCH] 6 | Change: valueX => valueY 7 | 8 | Writing patch info to install file 9 | -------------------------------------------------------------------------------- /test/scenarios/skipped-patch/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (1) 5 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 6 | Change: valueC => valueX 7 | 8 | Writing patch info to install file 9 | -------------------------------------------------------------------------------- /test/scenarios/apply-single-success/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (1) 5 | ~ {{PATCHES-OWNER}}: patches/first-change.patch [NEW] 6 | Change: value8 => valueX 7 | 8 | Writing patch info to install file 9 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-install/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/root-branch-alias/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (1) 5 | ~ {{PATCHES-OWNER}}: patches/first-change.patch [NEW] 6 | Change: value8 => valueX 7 | 8 | Writing patch info to install file 9 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-files/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-search/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update-lock/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/owner-remove-keep/files/patches/one-line-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC (expecting revert on owner removal) 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/apply-real-package-success/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/topological-sort (1) 5 | ~ {{PATCHES-OWNER}}: patches/first-change.patch [NEW] 6 | Change: Dependency => The cool thing 7 | 8 | Writing patch info to install file 9 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply-redo-spam/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/owner-remove-reset/files/patches/one-line-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC (expecting revert on owner removal) 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | --- src/example.txt.org 6 | +++ src/example.txt 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value8 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/apply-failure-corrupt-content/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,value8 6 | 7 | @@ -5,7 +5,7 @@ 8 | value5 9 | value6 10 | value7 11 | -value100 12 | +valueC 13 | value9 14 | value10 15 | value11 16 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueX 14 | value18 15 | value19 16 | value20 -------------------------------------------------------------------------------- /test/scenarios/validation-error-files/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueX 14 | value18 15 | value19 16 | value20 -------------------------------------------------------------------------------- /src/Composer/Plugin/Behaviour.php: -------------------------------------------------------------------------------- 1 | valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @assert vaimo/composer-patches-target1,valueC,valueX 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -5,7 +5,7 @@ 9 | value5 10 | value6 11 | value7 12 | -valueC 13 | +valueX 14 | value9 15 | value10 16 | value11 17 | -------------------------------------------------------------------------------- /test/scenarios/default-event-update-partial-reapply/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | 4 | @queue_update vaimo/composer-patches-target2 5 | 6 | update 7 | 8 | @queue_update vaimo/composer-patches-target1 9 | 10 | update 11 | 12 | @queue_install vaimo/composer-patches-target2 13 | 14 | update 15 | 16 | @queue_install vaimo/composer-patches-target1 17 | 18 | update -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-install/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueX 14 | value18 15 | value19 16 | value20 -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueX 14 | value18 15 | value19 16 | value20 -------------------------------------------------------------------------------- /test/scenarios/redo-all/files/patches/1_second-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueX => valueY 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueY 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -valueX 14 | +valueY 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-fail/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": { 4 | "source": "https://raw.githubusercontent.com/vaimo/composer-patches/release/3/test/scenarios/remote-success/files/patches/single-package-single-file-no-version.patch", 5 | "sha1": "wrong-hash" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/scenarios/rename/files/patches/1_second-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueC => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueZ 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -valueC 14 | +valueX 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/root-branch-alias/files/patches/first-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @assert vaimo/composer-patches-target1,value8,valueX 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -5,7 +5,7 @@ 9 | value5 10 | value6 11 | value7 12 | -value8 13 | +valueX 14 | value9 15 | value10 16 | value11 17 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-search/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueX 14 | value18 15 | value19 16 | value20 -------------------------------------------------------------------------------- /test/scenarios/apply-single-success/files/patches/first-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @assert vaimo/composer-patches-target1,value8,valueX 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -5,7 +5,7 @@ 9 | value5 10 | value6 11 | value7 12 | -value8 13 | +valueX 14 | value9 15 | value10 16 | value11 17 | -------------------------------------------------------------------------------- /test/scenarios/content-change/files/patches/1_second-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueC => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueZ 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -valueC 14 | +valueX 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install-partial-reapply/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | patch:apply 3 | 4 | @queue_update vaimo/composer-patches-target2 5 | 6 | install 7 | 8 | @queue_update vaimo/composer-patches-target1 9 | 10 | install 11 | 12 | @queue_install vaimo/composer-patches-target2 13 | 14 | install 15 | 16 | @queue_install vaimo/composer-patches-target1 17 | 18 | install -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply-redo-spam/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueX 14 | value18 15 | value19 16 | value20 -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update-lock/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueX 14 | value18 15 | value19 16 | value20 -------------------------------------------------------------------------------- /test/scenarios/redo-single/files/patches/1_second-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueX => valueY 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,valueX,valueY 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -valueX 14 | +valueY 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/undo-single/files/patches/0_first-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueX 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueX 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/remote-validate-fail/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | - {{PATCHES-OWNER}} 3 | ~ https://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch [ERROR 404] 4 | ~ http://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch [UNSECURE] 5 | Orphans found! 6 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueB 14 | value18 15 | value19 16 | value20 17 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-install/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueB 14 | value18 15 | value19 16 | value20 17 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueB 14 | value18 15 | value19 16 | value20 17 | -------------------------------------------------------------------------------- /test/scenarios/remote-bundle-success/.output-v1: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | - Applying patches for vaimo/composer-patches-sandbox (1) 3 | ~ {{PATCHES-OWNER}}: https://raw.githubusercontent.com/vaimo/composer-patches/release/3/test/scenarios/remote-bundle-success/files/patches/multiple-packages-single-file.patch [NEW] 4 | Change: multiple 5 | 6 | Writing patch info to install file 7 | -------------------------------------------------------------------------------- /test/scenarios/removal-direct/files/patches/0_initial-change.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -5,7 +5,7 @@ 11 | value5 12 | value6 13 | value7 14 | -value8 15 | +valueC 16 | value9 17 | value10 18 | value11 19 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-files/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueB 14 | value18 15 | value19 16 | value20 17 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-search/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueB 14 | value18 15 | value19 16 | value20 17 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update-lock/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueB 14 | value18 15 | value19 16 | value20 17 | -------------------------------------------------------------------------------- /test/scenarios/remote-success/.output-v1: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | - Applying patches for vaimo/composer-patches-target1 (1) 3 | ~ {{PATCHES-OWNER}}: https://raw.githubusercontent.com/vaimo/composer-patches/release/3/test/scenarios/remote-success/files/patches/single-package-single-file-no-version.patch [NEW] 4 | Change: value8 => valueC 5 | 6 | Writing patch info to install file 7 | -------------------------------------------------------------------------------- /test/scenarios/full-reset/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/list-items/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply-redo-spam/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | --- src/example.txt.org 7 | +++ src/example.txt 8 | @@ -14,7 +14,7 @@ 9 | value14 10 | value15 11 | value16 12 | -value17 13 | +valueB 14 | value18 15 | value19 16 | value20 17 | -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-success/.output-v1: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | - Applying patches for vaimo/composer-patches-target1 (1) 3 | ~ {{PATCHES-OWNER}}: https://raw.githubusercontent.com/vaimo/composer-patches/release/3/test/scenarios/remote-success/files/patches/single-package-single-file-no-version.patch [NEW] 4 | Change: value8 => valueC 5 | 6 | Writing patch info to install file 7 | -------------------------------------------------------------------------------- /test/scenarios/sequence/files/patches/0_fourth-change.patch: -------------------------------------------------------------------------------- 1 | Change: valueY => valueZ 2 | 3 | @package vaimo/composer-patches-target1 4 | @after third-change 5 | 6 | @assert vaimo/composer-patches-target1,valueY,valueZ 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -5,7 +5,7 @@ 11 | value5 12 | value6 13 | value7 14 | -valueY 15 | +valueZ 16 | value9 17 | value10 18 | value11 19 | -------------------------------------------------------------------------------- /test/scenarios/undo-all/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,value8 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/patch-description/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (1) 5 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file.patch [NEW] 6 | Change: value8 => valueC with some corrupting %s description %1 %s 7 | 8 | Writing patch info to install file 9 | -------------------------------------------------------------------------------- /test/scenarios/remote-success/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/default-command-apply/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/default-command-redo/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/default-event-update/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-success/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": { 4 | "source": "https://raw.githubusercontent.com/vaimo/composer-patches/release/3/test/scenarios/remote-success/files/patches/single-package-single-file-no-version.patch", 5 | "sha1": "87988617be3960fc62369aeba29cf0f8aebefeac" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/scenarios/remote-sha1-success/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/full-reset/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | 3 | patch:apply 4 | 5 | >rm {{OWNER-ROOT}}/patches/* 6 | >echo '{}' > {{OWNER-ROOT}}/patches.json 7 | 8 | patch:apply 9 | 10 | @assert vaimo/composer-patches-target2,value17,value17 11 | @assert vaimo/composer-patches-target3,value5,value5 12 | @assert vaimo/composer-patches-target1,value8,value8 13 | @assert vaimo/composer-patches-target1,value17,value17 14 | -------------------------------------------------------------------------------- /test/scenarios/remote-list-fail/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "https://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch", 4 | "Change: value9 => valueD": "http://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/scenarios/remote-validate-fail/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": "https://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch", 4 | "Change: value9 => valueD": "http://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install-partial-reapply/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/default-event-update-partial-reapply/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/full-reset/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/scenarios/list-items/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,valueX 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-no-patch-applied/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,value8 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/undo-all/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /src/Interfaces/PatchFailureHandlerInterface.php: -------------------------------------------------------------------------------- 1 | valueC (inline skip)": "patches/0_initial-change.patch#skip", 4 | "Change: value8 => valueC (explicit skip)": { 5 | "source": "patches/0_initial-change.patch", 6 | "skip": true 7 | }, 8 | "Change: valueC => valueX": "patches/1_second-change.patch" 9 | } 10 | } -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-keep-patches-applied/files/patches/single-package-single-file-no-version.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/default-command-apply/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,valueX 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/scenarios/default-command-redo/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,valueX 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/scenarios/default-event-install/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,valueX 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/scenarios/default-event-update/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,valueX 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/scenarios/remote-list-fail/.output: -------------------------------------------------------------------------------- 1 | vaimo/composer-patches-target1 2 | ~ {{PATCHES-OWNER}}: https://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch [ERROR 404] 3 | Change: value8 => valueC 4 | ~ {{PATCHES-OWNER}}: http://raw.githubusercontent.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-version.patch [UNSECURE] 5 | Change: value9 => valueD 6 | 7 | -------------------------------------------------------------------------------- /test/scenarios/apply-real-package-success/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/topological-sort (2.0.0): Extracting archive 5 | - Applying patches for vaimo/topological-sort (1) 6 | ~ {{PATCHES-OWNER}}: patches/first-change.patch [NEW] 7 | Change: Dependency => The cool thing 8 | 9 | Writing patch info to install file 10 | -------------------------------------------------------------------------------- /test/scenarios/patch-description/files/patches/single-package-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value8 => valueC with some corrupting %s description %1 %s 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,valueC 6 | 7 | --- src/example.txt.org 8 | +++ src/example.txt 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value8 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /src/Composer/ResetOperation.php: -------------------------------------------------------------------------------- 1 | package->getPrettyName(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Patch/File/Loader.php: -------------------------------------------------------------------------------- 1 | valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /test/scenarios/default-command-apply/files/patches/single-package-single-file-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value18 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version <=1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value18,valueB 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | value17 15 | -value18 16 | +valueB 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install-partial-reapply/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,valueX 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/scenarios/default-event-update-partial-reapply/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,valueX 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-no-patch-applied/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/scenarios/default-command-apply/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /test/scenarios/default-command-redo/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /test/scenarios/default-event-update/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /test/scenarios/naming/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (1) 6 | ~ {{PATCHES-OWNER}}: patches/one-line-change.patch [NEW] 7 | Change: value8 => valueC 8 | 9 | Writing patch info to install file 10 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-keep-patches-applied/files/patches/single-package-single-file-wildcard-version.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueX 2 | 3 | @package vaimo/composer-patches-target1 4 | @version * 5 | 6 | @assert vaimo/composer-patches-target1,value17,valueX 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueX 16 | value18 17 | value19 18 | value20 -------------------------------------------------------------------------------- /test/modules/patches-search-owner/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vaimo/patches-search-owner", 3 | "type": "library", 4 | "version": "1.0.0", 5 | "description": "Mock module that is used to test applying patches from a dependency", 6 | "license": "MIT", 7 | "require": { 8 | "vaimo/composer-patches-local": "@dev" 9 | }, 10 | "extra": { 11 | "patches-search": "patches", 12 | "hello": "there" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/scenarios/redo-single/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (2) 6 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [MATCH] 7 | Change: valueX => valueY 8 | 9 | Writing patch info to install file 10 | -------------------------------------------------------------------------------- /test/scenarios/root-branch-alias/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (1) 6 | ~ {{PATCHES-OWNER}}: patches/first-change.patch [NEW] 7 | Change: value8 => valueX 8 | 9 | Writing patch info to install file 10 | -------------------------------------------------------------------------------- /test/scenarios/skipped-patch/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (1) 6 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 7 | Change: valueC => valueX 8 | 9 | Writing patch info to install file 10 | -------------------------------------------------------------------------------- /test/scenarios/apply-single-success/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (1) 6 | ~ {{PATCHES-OWNER}}: patches/first-change.patch [NEW] 7 | Change: value8 => valueX 8 | 9 | Writing patch info to install file 10 | -------------------------------------------------------------------------------- /src/Patch/SourceLoaders/PatchList.php: -------------------------------------------------------------------------------- 1 | valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /test/scenarios/default-event-update-partial-reapply/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /test/scenarios/full-reset/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-no-patch-applied/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /test/scenarios/undo-all/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-keep-patches-applied/files/patches/single-package-single-file-non-matching-constraint.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB 2 | 3 | @package vaimo/composer-patches-target3 4 | @version >1.2.3 5 | 6 | @assert vaimo/composer-patches-target3,value17,value17 7 | 8 | --- src/example.txt.org 9 | +++ src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | -------------------------------------------------------------------------------- /.config/phpcs/whitelist/symfony-console/version-v5.4.47: -------------------------------------------------------------------------------- 1 | Graceful usage: Completion/CompletionInput.php,120,74,PHPCompatibility.FunctionUse.NewFunctions.array_key_lastFound 2 | Graceful usage: Helper/ProgressBar.php,301,31,PHPCompatibility.FunctionUse.NewFunctions.is_countableFound 3 | Graceful usage: Helper/Table.php,810,51,PHPCompatibility.FunctionUse.NewFunctions.mb_str_splitFound 4 | Graceful usage: Input/ArgvInput.php,176,47,PHPCompatibility.FunctionUse.NewFunctions.array_key_firstFound -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | vendor/ 3 | test/modules/composer-patches/ 4 | report-* 5 | output.txt 6 | output.out 7 | test/**/composer.lock 8 | test/installations/**/modules 9 | test/installations/**/patches 10 | test/installations/**/patches.json 11 | test/dependencies/modules 12 | test/dependencies/phpcs.xml 13 | test/dependencies/composer.json 14 | *.org 15 | .history 16 | output.exp 17 | .devcontainer 18 | bin/phpcs 19 | bin/phpcbf 20 | Dockerfile 21 | mutagen* 22 | docker-compose.yml -------------------------------------------------------------------------------- /test/scenarios/validation-error-files/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Environment.php: -------------------------------------------------------------------------------- 1 | valueC 2 | 3 | @package vaimo/composer-patches-target1 4 | 5 | @assert vaimo/composer-patches-target1,value8,value8 6 | 7 | --- src/example.txt.org 2018-10-12 02:16:43.285930514 +0200 8 | +++ src/example.txt 2018-10-12 02:16:43.285930514 +0200 9 | @@ -5,7 +5,7 @@ 10 | value5 11 | value6 12 | value7 13 | -value100 14 | +valueC 15 | value9 16 | value10 17 | value11 18 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-search/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Interfaces/PatchPackagesResolverInterface.php: -------------------------------------------------------------------------------- 1 | valueC (expecting revert on owner removal) 7 | 8 | Writing patch info to install file 9 | Package operations: 0 installs, 0 updates, 1 removal 10 | - Removing {{PATCHES-OWNER}} (1.0.0) -------------------------------------------------------------------------------- /bin/bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | : <<'COPYRIGHT' 3 | Copyright (c) Vaimo Group. All rights reserved. 4 | See LICENSE_VAIMO.txt for license details. 5 | COPYRIGHT 6 | 7 | # Setup static code analysis 8 | vendor/bin/phpcs --config-set installed_paths 'vendor/phpcompatibility/php-compatibility' 2>/dev/null 9 | vendor/bin/phpcs --config-set error_severity 1 2>/dev/null 10 | vendor/bin/phpcs --config-set default_standard 'LOCAL' 2>/dev/null 11 | vendor/bin/phpcs --config-set parallel 1 2>/dev/null -------------------------------------------------------------------------------- /src/Utils/PackagePatchDataUtils.php: -------------------------------------------------------------------------------- 1 | valueC 6 | 7 | Writing patch info to install file 8 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-no-patch-applied/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | 3 | update --lock 4 | 5 | @assert_changes 6 | 7 | @queue_update vaimo/composer-patches-target2 8 | update --lock 9 | 10 | @assert_changes 11 | 12 | @queue_update vaimo/composer-patches-target1 13 | update --lock 14 | 15 | @assert_changes 16 | 17 | @queue_install vaimo/composer-patches-target2 18 | update --lock 19 | 20 | @assert_changes 21 | 22 | @queue_install vaimo/composer-patches-target1 23 | update --lock 24 | -------------------------------------------------------------------------------- /.config/phpcs/vendor.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | PHP CodeSniffer rules for Composer Patches 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Interfaces/PatchSourceListInterface.php: -------------------------------------------------------------------------------- 1 | valueC 6 | 7 | Writing patch info to install file 8 | -------------------------------------------------------------------------------- /src/Interfaces/PatchSourceLoaderInterface.php: -------------------------------------------------------------------------------- 1 | errors = $output; 15 | } 16 | 17 | public function getErrors() 18 | { 19 | return $this->errors; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/scenarios/patch-description/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (1) 6 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file.patch [NEW] 7 | Change: value8 => valueC with some corrupting %s description %1 %s 8 | 9 | Writing patch info to install file 10 | -------------------------------------------------------------------------------- /src/Interfaces/DefinitionListLoaderComponentInterface.php: -------------------------------------------------------------------------------- 1 | valueC 5 | Failed to apply the patch. Halting execution! 6 | Probable causes for the failure: 7 | 8 | > PATCH 9 | @ src/example.txt 10 | ! Hunk #1 FAILED at 5. 11 | 12 | (For full, unfiltered details please use: composer patch:apply -vvv) 13 | -------------------------------------------------------------------------------- /.config/phpcs/whitelist/drupol-phposinfo/version-1.6.5: -------------------------------------------------------------------------------- 1 | Graceful usage: src/OsInfo.php,18,11,PHPCompatibility.Constants.NewConstants.php_os_familyFound 2 | Incorrect error: src/OsInfo.php,134,25,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 3 | Incorrect error: src/OsInfo.php,170,23,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 4 | Graceful usage: src/OsInfo.php,238,21,PHPCompatibility.Constants.NewConstants.php_os_familyFound 5 | Graceful usage: src/OsInfo.php,239,49,PHPCompatibility.Constants.NewConstants.php_os_familyFound 6 | -------------------------------------------------------------------------------- /.config/phpcs/whitelist/loophp-phposinfo/version-1.6.5: -------------------------------------------------------------------------------- 1 | Graceful usage: src/OsInfo.php,18,11,PHPCompatibility.Constants.NewConstants.php_os_familyFound 2 | Incorrect error: src/OsInfo.php,134,25,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 3 | Incorrect error: src/OsInfo.php,170,23,PHPCompatibility.Extensions.RemovedExtensions.famRemoved 4 | Graceful usage: src/OsInfo.php,238,21,PHPCompatibility.Constants.NewConstants.php_os_familyFound 5 | Graceful usage: src/OsInfo.php,239,49,PHPCompatibility.Constants.NewConstants.php_os_familyFound 6 | -------------------------------------------------------------------------------- /test/scenarios/apply-failure-corrupt-content/.output-darwin: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | - Applying patches for vaimo/composer-patches-target1 (1) 3 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 4 | Change: value8 => valueC 5 | Failed to apply the patch. Halting execution! 6 | Probable causes for the failure: 7 | 8 | > PATCH 9 | ! can't find file to patch at input line 7 10 | 11 | (For full, unfiltered details please use: composer patch:apply -vvv) 12 | -------------------------------------------------------------------------------- /test/scenarios/apply-failure-corrupt-content/.output-v1: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | - Applying patches for vaimo/composer-patches-target1 (1) 3 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 4 | Change: value8 => valueC 5 | Failed to apply the patch. Halting execution! 6 | Probable causes for the failure: 7 | 8 | > PATCH 9 | ! Hmm... I can't seem to find a patch in there anywhere. 10 | 11 | (For full, unfiltered details please use: composer patch:apply -vvv) 12 | -------------------------------------------------------------------------------- /src/Interfaces/DefinitionNormalizerComponentInterface.php: -------------------------------------------------------------------------------- 1 | output = $output; 18 | 19 | return $this; 20 | } 21 | 22 | public function getOutput() 23 | { 24 | return $this->output; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/scenarios/remote-bundle-success/.output: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | - Installing vaimo/composer-patches-target2 (1.2.0): Mirroring from modules/composer-patches-target2 3 | - Installing vaimo/composer-patches-target3 (1.2.3): Mirroring from modules/composer-patches-target3 4 | - Applying patches for vaimo/composer-patches-sandbox (1) 5 | ~ {{PATCHES-OWNER}}: https://raw.githubusercontent.com/vaimo/composer-patches/release/3/test/scenarios/remote-bundle-success/files/patches/multiple-packages-single-file.patch [NEW] 6 | Change: multiple 7 | 8 | Writing patch info to install file 9 | -------------------------------------------------------------------------------- /test/scenarios/addition-direct/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (1) 5 | ~ {{PATCHES-OWNER}}: patches/0_initial-change.patch [NEW] 6 | Change: value8 => valueC 7 | 8 | Writing patch info to install file 9 | Processing patches configuration 10 | - Applying patches for vaimo/composer-patches-target1 (2) 11 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 12 | Change: valueC => valueX 13 | 14 | Writing patch info to install file 15 | -------------------------------------------------------------------------------- /.config/phpcs/whitelist/symfony-console/version-v4.4.49: -------------------------------------------------------------------------------- 1 | Graceful usage: Terminal.php,106,66,PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound 2 | Graceful usage: Helper/ProgressBar.php,276,31,PHPCompatibility.FunctionUse.NewFunctions.is_countableFound 3 | Graceful usage: Helper/QuestionHelper.php,488,49,PHPCompatibility.FunctionUse.NewFunctions.stream_isattyFound 4 | Graceful usage: Output/StreamOutput.php,107,21,PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound 5 | Graceful usage: Output/StreamOutput.php,114,21,PHPCompatibility.FunctionUse.NewFunctions.stream_isattyFound 6 | -------------------------------------------------------------------------------- /src/Events.php: -------------------------------------------------------------------------------- 1 | output->getVerbosity(); 13 | 14 | if ($appIO->isVerbose()) { 15 | return $oldValue; 16 | } 17 | 18 | $appIO->output->setVerbosity($verbosity); 19 | 20 | return $oldValue; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Interfaces/DefinitionExploderComponentInterface.php: -------------------------------------------------------------------------------- 1 | valueC (expecting revert on owner removal) 7 | 8 | Writing patch info to install file 9 | Package operations: 0 installs, 0 updates, 1 removal 10 | - Removing {{PATCHES-OWNER}} (1.0.0) 11 | Processing patches configuration 12 | - Resetting patches for vaimo/composer-patches-target1 (1) 13 | Writing patch info to install file -------------------------------------------------------------------------------- /.config/phpcs/whitelist/symfony-console/version-v3.4.47: -------------------------------------------------------------------------------- 1 | Graceful usage: Terminal.php,106,66,PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound 2 | Graceful usage: Helper/QuestionHelper.php,163,14,PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_cp_setFound 3 | Graceful usage: Output/StreamOutput.php,102,21,PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound 4 | Graceful usage: Output/StreamOutput.php,109,21,PHPCompatibility.FunctionUse.NewFunctions.stream_isattyFound 5 | Incorrect error: Tests/Command/CommandTest.php,428,26,PHPCompatibility.FunctionDeclarations.NewClosure.ThisFoundOutsideClass 6 | -------------------------------------------------------------------------------- /modules/proxy-plugin/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vaimo/composer-patches-proxy", 3 | "version": "1.0.0", 4 | "type": "composer-plugin", 5 | "description": "Proxy package to be able to use plugin commands provided by vaimo/composer-patches when having vaimo/composer-patches as the ROOT package", 6 | "license": "MIT", 7 | "require": { 8 | "composer-plugin-api": "^1.0 || ^2.0" 9 | }, 10 | "extra": { 11 | "class": "Vaimo\\ComposerPatchesProxy\\Plugin" 12 | }, 13 | "autoload": { 14 | "psr-4": { 15 | "Vaimo\\ComposerPatchesProxy\\": "src" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /test/scenarios/apply-failure-simple/.output: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 3 | - Applying patches for vaimo/composer-patches-target1 (1) 4 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 5 | Change: value8 => valueC 6 | Failed to apply the patch. Halting execution! 7 | Probable causes for the failure: 8 | 9 | > PATCH 10 | @ src/example.txt 11 | ! Hunk #1 FAILED at 5. 12 | 13 | (For full, unfiltered details please use: composer patch:apply -vvv) 14 | -------------------------------------------------------------------------------- /src/Interfaces/PatchesResetsResolverInterface.php: -------------------------------------------------------------------------------- 1 | valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | --- vaimo/composer-patches-target2/src/example.txt.org 6 | +++ vaimo/composer-patches-target2/src/example.txt 7 | @@ -14,7 +14,7 @@ 8 | value14 9 | value15 10 | value16 11 | -value17 12 | +valueB 13 | value18 14 | value19 15 | value20 16 | --- vaimo/composer-patches-target3/src/example.txt.org 17 | +++ vaimo/composer-patches-target3/src/example.txt 18 | @@ -2,7 +2,7 @@ 19 | value2 20 | value3 21 | value4 22 | -value5 23 | +valueA 24 | value6 25 | value7 26 | value8 27 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-install/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | --- vaimo/composer-patches-target2/src/example.txt.org 6 | +++ vaimo/composer-patches-target2/src/example.txt 7 | @@ -14,7 +14,7 @@ 8 | value14 9 | value15 10 | value16 11 | -value17 12 | +valueB 13 | value18 14 | value19 15 | value20 16 | --- vaimo/composer-patches-target3/src/example.txt.org 17 | +++ vaimo/composer-patches-target3/src/example.txt 18 | @@ -2,7 +2,7 @@ 19 | value2 20 | value3 21 | value4 22 | -value5 23 | +valueA 24 | value6 25 | value7 26 | value8 27 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | --- vaimo/composer-patches-target2/src/example.txt.org 6 | +++ vaimo/composer-patches-target2/src/example.txt 7 | @@ -14,7 +14,7 @@ 8 | value14 9 | value15 10 | value16 11 | -value17 12 | +valueB 13 | value18 14 | value19 15 | value20 16 | --- vaimo/composer-patches-target3/src/example.txt.org 17 | +++ vaimo/composer-patches-target3/src/example.txt 18 | @@ -2,7 +2,7 @@ 19 | value2 20 | value3 21 | value4 22 | -value5 23 | +valueA 24 | value6 25 | value7 26 | value8 27 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-files/files/patches2/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | --- vaimo/composer-patches-target2/src/example.txt.org 6 | +++ vaimo/composer-patches-target2/src/example.txt 7 | @@ -14,7 +14,7 @@ 8 | value14 9 | value15 10 | value16 11 | -value17 12 | +valueB 13 | value18 14 | value19 15 | value20 16 | --- vaimo/composer-patches-target3/src/example.txt.org 17 | +++ vaimo/composer-patches-target3/src/example.txt 18 | @@ -2,7 +2,7 @@ 19 | value2 20 | value3 21 | value4 22 | -value5 23 | +valueA 24 | value6 25 | value7 26 | value8 27 | -------------------------------------------------------------------------------- /test/scenarios/validation-error-search/files/patches2/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | --- vaimo/composer-patches-target2/src/example.txt.org 6 | +++ vaimo/composer-patches-target2/src/example.txt 7 | @@ -14,7 +14,7 @@ 8 | value14 9 | value15 10 | value16 11 | -value17 12 | +valueB 13 | value18 14 | value19 15 | value20 16 | --- vaimo/composer-patches-target3/src/example.txt.org 17 | +++ vaimo/composer-patches-target3/src/example.txt 18 | @@ -2,7 +2,7 @@ 19 | value2 20 | value3 21 | value4 22 | -value5 23 | +valueA 24 | value6 25 | value7 26 | value8 27 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update-lock/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | --- vaimo/composer-patches-target2/src/example.txt.org 6 | +++ vaimo/composer-patches-target2/src/example.txt 7 | @@ -14,7 +14,7 @@ 8 | value14 9 | value15 10 | value16 11 | -value17 12 | +valueB 13 | value18 14 | value19 15 | value20 16 | --- vaimo/composer-patches-target3/src/example.txt.org 17 | +++ vaimo/composer-patches-target3/src/example.txt 18 | @@ -2,7 +2,7 @@ 19 | value2 20 | value3 21 | value4 22 | -value5 23 | +valueA 24 | value6 25 | value7 26 | value8 27 | -------------------------------------------------------------------------------- /test/scenarios/apply-failure-corrupt-content/.output: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 3 | - Applying patches for vaimo/composer-patches-target1 (1) 4 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 5 | Change: value8 => valueC 6 | Failed to apply the patch. Halting execution! 7 | Probable causes for the failure: 8 | 9 | > PATCH 10 | ! Hmm... I can't seem to find a patch in there anywhere. 11 | 12 | (For full, unfiltered details please use: composer patch:apply -vvv) 13 | -------------------------------------------------------------------------------- /test/scenarios/levels/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (4) 5 | ~ {{PATCHES-OWNER}}: patches/0_patch-level-1.patch [NEW] 6 | Change: value8 => valueC 7 | ~ {{PATCHES-OWNER}}: patches/1_patch-level-1.patch [NEW] 8 | Change: valueC => valueX 9 | ~ {{PATCHES-OWNER}}: patches/2_patch-level-0.patch [NEW] 10 | Change: valueX => valueY 11 | ~ {{PATCHES-OWNER}}: patches/3_patch-no-level.patch [NEW] 12 | Change: valueY => valueZ 13 | 14 | Writing patch info to install file 15 | -------------------------------------------------------------------------------- /test/scenarios/levels/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: value8 => valueC": { 4 | "source": "patches/0_patch-level-1.patch", 5 | "level": "1" 6 | }, 7 | "Change: valueC => valueX": { 8 | "level": "1", 9 | "source": "patches/1_patch-level-1.patch" 10 | }, 11 | "Change: valueX => valueY": { 12 | "source": "patches/2_patch-level-0.patch", 13 | "level": "0" 14 | }, 15 | "Change: valueY => valueZ": { 16 | "source": "patches/3_patch-no-level.patch" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply-redo-spam/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | --- vaimo/composer-patches-target2/src/example.txt.org 6 | +++ vaimo/composer-patches-target2/src/example.txt 7 | @@ -14,7 +14,7 @@ 8 | value14 9 | value15 10 | value16 11 | -value17 12 | +valueB 13 | value18 14 | value19 15 | value20 16 | --- vaimo/composer-patches-target3/src/example.txt.org 17 | +++ vaimo/composer-patches-target3/src/example.txt 18 | @@ -2,7 +2,7 @@ 19 | value2 20 | value3 21 | value4 22 | -value5 23 | +valueA 24 | value6 25 | value7 26 | value8 27 | -------------------------------------------------------------------------------- /test/scenarios/sequence/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (4) 5 | ~ {{PATCHES-OWNER}}: patches/2_initial-change.patch [NEW] 6 | Change: value8 => valueC 7 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 8 | Change: valueC => valueX 9 | ~ {{PATCHES-OWNER}}: patches/3_third-change.patch [NEW] 10 | Change: valueX => valueY 11 | ~ {{PATCHES-OWNER}}: patches/0_fourth-change.patch [NEW] 12 | Change: valueY => valueZ 13 | 14 | Writing patch info to install file 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | A clear and concise description of what the bug is. 11 | 12 | **Pre-requisites** 13 | 1. Use this ... 14 | 2. Have that 15 | 16 | **To Reproduce** 17 | Steps to reproduce the behavior: 18 | 1. Do this 19 | 2. Do that ... 20 | 3. ... 21 | 22 | **Expected** 23 | A clear and concise description of what you expected to happen. 24 | 25 | **Actual** 26 | A clear and concise description of what actually happened. 27 | 28 | **Notes** 29 | (Optional) Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /src/Patch/Definition/NormalizerComponents/PathComponent.php: -------------------------------------------------------------------------------- 1 | $data[PatchDefinition::SOURCE] 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/scenarios/list-items/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bin/analyse: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | : <<'COPYRIGHT' 3 | Copyright (c) Vaimo Group. All rights reserved. 4 | See LICENSE_VAIMO.txt for license details. 5 | COPYRIGHT 6 | 7 | type=${1} 8 | 9 | if [ "${type}" == "" ] || [ "${type}" == "phpcs" ] ; then 10 | echo ">>> phpcs" 11 | vendor/bin/phpcs -p src 12 | 13 | result=${?} 14 | 15 | if [ ${result} -gt 0 ] ; then 16 | exit 1 17 | fi 18 | fi 19 | 20 | if [ "${type}" == "" ] || [ "${type}" == "phpmd" ] ; then 21 | echo ">>> phpmd" 22 | vendor/bin/phpmd src text phpmd.xml --suffixes php 23 | 24 | result=${?} 25 | 26 | if [ ${result} -gt 0 ] ; then 27 | exit 1 28 | fi 29 | fi 30 | -------------------------------------------------------------------------------- /bin/bootstrap-test-env: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | : <<'COPYRIGHT' 3 | Copyright (c) Vaimo Group. All rights reserved. 4 | See LICENSE_VAIMO.txt for license details. 5 | COPYRIGHT 6 | 7 | # Setup sandbox 8 | name='composer-patches' 9 | rm -rf test/modules/${name} 2>/dev/null 10 | mkdir -p test/modules/${name} 2>/dev/null 11 | 12 | if [ ! -L test/modules/${name}/src ] ; then 13 | ln -s $(cd src &>/dev/null && pwd) test/modules/${name}/src 2>/dev/null 14 | fi 15 | 16 | cp composer.json test/modules/${name} 2>/dev/null 17 | 18 | sed -i.org 's|'${name}'"|'${name}'-local"|g' test/modules/${name}/composer.json 19 | rm test/modules/${name}/composer.json.org 2>/dev/null 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /test/scenarios/default-command-redo/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/default-event-update/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/sequence/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "vaimo/composer-patches-target1": { 3 | "Change: valueY => valueZ": { 4 | "source": "patches/0_fourth-change.patch", 5 | "after": "third-change" 6 | }, 7 | "Change: valueC => valueX": { 8 | "source": "patches/1_second-change.patch", 9 | "after": "initial-change" 10 | }, 11 | "Change: value8 => valueC": { 12 | "source": "patches/2_initial-change.patch" 13 | }, 14 | "Change: valueX => valueY": { 15 | "source": "patches/3_third-change.patch", 16 | "after": "second-change" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-install/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update-lock/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Patch/FailureHandlers/FatalHandler.php: -------------------------------------------------------------------------------- 1 | valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply-redo-spam/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-no-patch-applied/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install-partial-reapply/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-keep-patches-applied/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/scenarios/undo-single/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (2) 5 | ~ {{PATCHES-OWNER}}: patches/0_first-change.patch [NEW] 6 | Change: value8 => valueX 7 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 8 | Change: valueX => valueY 9 | 10 | Writing patch info to install file 11 | Processing patches configuration 12 | - Applying patches for vaimo/composer-patches-target1 (1) 13 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [REMOVED] 14 | Change: valueX => valueY 15 | 16 | Writing patch info to install file 17 | -------------------------------------------------------------------------------- /test/scenarios/content-change/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (2) 5 | ~ {{PATCHES-OWNER}}: patches/0_initial-change.patch [NEW] 6 | Change: value8 => valueC 7 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 8 | Change: valueC => valueX 9 | 10 | Writing patch info to install file 11 | Processing patches configuration 12 | - Applying patches for vaimo/composer-patches-target1 (2) 13 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [CHANGED] 14 | Change: valueC => valueX 15 | 16 | Writing patch info to install file 17 | -------------------------------------------------------------------------------- /test/scenarios/removal-direct/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (2) 5 | ~ {{PATCHES-OWNER}}: patches/0_initial-change.patch [NEW] 6 | Change: value8 => valueC 7 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 8 | Change: valueC => valueX 9 | 10 | Writing patch info to install file 11 | Processing patches configuration 12 | - Applying patches for vaimo/composer-patches-target1 (1) 13 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [REMOVED] 14 | Change: valueC => valueX 15 | 16 | Writing patch info to install file 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /test/scenarios/default-event-update/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-sandbox (1) 5 | ~ {{PATCHES-OWNER}}: patches/multiple-packages-single-file.patch [NEW] 6 | Change: value17 => valueB; value5 => valueA 7 | 8 | - Applying patches for vaimo/composer-patches-target1 (2) 9 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 10 | Change: value8 => valueC 11 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-wildcard-version.patch [NEW] 12 | Change: value17 => valueX 13 | 14 | Writing patch info to install file 15 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-sandbox (1) 5 | ~ {{PATCHES-OWNER}}: patches/multiple-packages-single-file.patch [NEW] 6 | Change: value17 => valueB; value5 => valueA 7 | 8 | - Applying patches for vaimo/composer-patches-target1 (2) 9 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 10 | Change: value8 => valueC 11 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-wildcard-version.patch [NEW] 12 | Change: value17 => valueX 13 | 14 | Writing patch info to install file 15 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-sandbox (1) 5 | ~ {{PATCHES-OWNER}}: patches/multiple-packages-single-file.patch [NEW] 6 | Change: value17 => valueB; value5 => valueA 7 | 8 | - Applying patches for vaimo/composer-patches-target1 (2) 9 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 10 | Change: value8 => valueC 11 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-wildcard-version.patch [NEW] 12 | Change: value17 => valueX 13 | 14 | Writing patch info to install file 15 | -------------------------------------------------------------------------------- /test/scenarios/default-command-redo/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-sandbox (1) 5 | ~ {{PATCHES-OWNER}}: patches/multiple-packages-single-file.patch [MATCH] 6 | Change: value17 => valueB; value5 => valueA 7 | 8 | - Applying patches for vaimo/composer-patches-target1 (2) 9 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [MATCH] 10 | Change: value8 => valueC 11 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-wildcard-version.patch [MATCH] 12 | Change: value17 => valueX 13 | 14 | Writing patch info to install file 15 | -------------------------------------------------------------------------------- /test/scenarios/owner-remove-keep/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (1) 6 | ~ {{PATCHES-OWNER}}: patches/one-line-change.patch [NEW] 7 | Change: value8 => valueC (expecting revert on owner removal) 8 | 9 | Writing patch info to install file 10 | ./composer.json has been updated 11 | Lock file operations: 0 installs, 0 updates, 1 removal 12 | - Removing {{PATCHES-OWNER}} (1.0.0) 13 | Package operations: 0 installs, 0 updates, 1 removal 14 | - Removing {{PATCHES-OWNER}} (1.0.0) -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-keep-patches-applied/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-sandbox (1) 5 | ~ {{PATCHES-OWNER}}: patches/multiple-packages-single-file.patch [NEW] 6 | Change: value17 => valueB; value5 => valueA 7 | 8 | - Applying patches for vaimo/composer-patches-target1 (2) 9 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 10 | Change: value8 => valueC 11 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-wildcard-version.patch [NEW] 12 | Change: value17 => valueX 13 | 14 | Writing patch info to install file 15 | -------------------------------------------------------------------------------- /test/scenarios/apply-real-package-success/files/patches/first-change.patch: -------------------------------------------------------------------------------- 1 | Change: Dependency => The cool thing 2 | 3 | @package vaimo/topological-sort 4 | @assert vaimo/topological-sort,,The cool thing,src/ElementNotFoundException.php 5 | 6 | --- src/ElementNotFoundException.php.org 7 | +++ src/ElementNotFoundException.php 8 | @@ -39,7 +39,7 @@ 9 | */ 10 | public static function create($source, $target) 11 | { 12 | - $message = sprintf('Dependency `%s` not found, required by `%s`', $target, $source); 13 | + $message = sprintf('The cool thing `%s` not found, required by `%s`', $target, $source); 14 | $exception = new static($message, 0, null, $source, $target); 15 | 16 | return $exception; 17 | -------------------------------------------------------------------------------- /test/scenarios/full-reset/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/list-items/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/undo-all/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,value17 6 | @assert vaimo/composer-patches-target3,value5,value5 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/levels/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (4) 6 | ~ {{PATCHES-OWNER}}: patches/0_patch-level-1.patch [NEW] 7 | Change: value8 => valueC 8 | ~ {{PATCHES-OWNER}}: patches/1_patch-level-1.patch [NEW] 9 | Change: valueC => valueX 10 | ~ {{PATCHES-OWNER}}: patches/2_patch-level-0.patch [NEW] 11 | Change: valueX => valueY 12 | ~ {{PATCHES-OWNER}}: patches/3_patch-no-level.patch [NEW] 13 | Change: valueY => valueZ 14 | 15 | Writing patch info to install file 16 | -------------------------------------------------------------------------------- /test/scenarios/sequence/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (4) 6 | ~ {{PATCHES-OWNER}}: patches/2_initial-change.patch [NEW] 7 | Change: value8 => valueC 8 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 9 | Change: valueC => valueX 10 | ~ {{PATCHES-OWNER}}: patches/3_third-change.patch [NEW] 11 | Change: valueX => valueY 12 | ~ {{PATCHES-OWNER}}: patches/0_fourth-change.patch [NEW] 13 | Change: valueY => valueZ 14 | 15 | Writing patch info to install file 16 | -------------------------------------------------------------------------------- /test/scenarios/default-command-apply/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/default-command-redo/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/default-event-update/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/remote-bundle-success/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /src/Repository/PatchesApplier/ListResolvers/DirectListResolver.php: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | PHP CodeSniffer rules for Composer Patches 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 5 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Composer/Commands/ApplyCommand.php: -------------------------------------------------------------------------------- 1 | setName('patch:apply'); 15 | 16 | $this->setDescription('Apply a patch or patches for certain package(s)'); 17 | 18 | $definition = $this->getDefinition(); 19 | $options = $definition->getOptions(); 20 | 21 | unset($options['redo'], $options['undo']); 22 | 23 | $definition->setOptions($options); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Utils/RuntimeUtils.php: -------------------------------------------------------------------------------- 1 | $value) { 13 | putenv($name . '=' . $value); 14 | } 15 | } 16 | 17 | public function executeWithPostAction($action, $postAction) 18 | { 19 | try { 20 | $result = $action(); 21 | } catch (\Exception $exception) { 22 | $postAction(); 23 | 24 | throw $exception; 25 | } 26 | 27 | $postAction(); 28 | 29 | return $result; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/scenarios/default-event-install-partial-reapply/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/default-event-update-partial-reapply/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-no-patch-applied/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,value17 6 | @assert vaimo/composer-patches-target3,value5,value5 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-keep-patches-applied/files/patches/multiple-packages-single-file.patch: -------------------------------------------------------------------------------- 1 | Change: value17 => valueB; value5 => valueA 2 | 3 | @type bundle 4 | 5 | @assert vaimo/composer-patches-target2,value17,valueB 6 | @assert vaimo/composer-patches-target3,value5,valueA 7 | 8 | --- vaimo/composer-patches-target2/src/example.txt.org 9 | +++ vaimo/composer-patches-target2/src/example.txt 10 | @@ -14,7 +14,7 @@ 11 | value14 12 | value15 13 | value16 14 | -value17 15 | +valueB 16 | value18 17 | value19 18 | value20 19 | --- vaimo/composer-patches-target3/src/example.txt.org 20 | +++ vaimo/composer-patches-target3/src/example.txt 21 | @@ -2,7 +2,7 @@ 22 | value2 23 | value3 24 | value4 25 | -value5 26 | +valueA 27 | value6 28 | value7 29 | value8 30 | -------------------------------------------------------------------------------- /.config/phpcs/whitelist/symfony-console/version-v6.4.21: -------------------------------------------------------------------------------- 1 | Incorrect error: Output/AnsiColorMode.php,63,23,PHPCompatibility.Variables.ForbiddenThisUseContexts.OutsideObjectContext 2 | Incorrect error: Output/AnsiColorMode.php,64,37,PHPCompatibility.Variables.ForbiddenThisUseContexts.OutsideObjectContext 3 | Incorrect error: Output/AnsiColorMode.php,65,45,PHPCompatibility.Variables.ForbiddenThisUseContexts.OutsideObjectContext 4 | Incorrect error: Output/AnsiColorMode.php,72,23,PHPCompatibility.Variables.ForbiddenThisUseContexts.OutsideObjectContext 5 | Incorrect error: Output/AnsiColorMode.php,73,28,PHPCompatibility.Variables.ForbiddenThisUseContexts.OutsideObjectContext 6 | Incorrect error: Output/AnsiColorMode.php,74,28,PHPCompatibility.Variables.ForbiddenThisUseContexts.OutsideObjectContext 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Vaimo Group. All rights reserved. 2 | # See LICENSE_VAIMO.txt for license details. 3 | language: php 4 | 5 | addons: 6 | apt: 7 | update: true 8 | 9 | git: 10 | depth: 1 11 | 12 | before_install: 13 | - sudo apt-get -y install git 14 | 15 | env: 16 | jobs: 17 | - COMPOSER_VERSION=1.10.20 18 | - COMPOSER_VERSION=2.0.9 19 | 20 | script: 21 | # removed to allow GIT applier to trigger as well (tests output does cover it) 22 | - rm -rf .git 23 | - composer self-update ${COMPOSER_VERSION} 24 | - cp test/files/composer-v${COMPOSER_VERSION:0:1}.json composer.json 2>/dev/null || true 25 | - cp test/files/composer-v${COMPOSER_VERSION:0:1}.lock composer.lock 2>/dev/null || true 26 | - composer install 27 | - composer ci:build 28 | -------------------------------------------------------------------------------- /test/scenarios/remote-unsecure-fail/.output: -------------------------------------------------------------------------------- 1 | Processing patches configuration 2 | 3 | In TransportErrorHandler.php: 4 | 5 | Your configuration does not allow connections to http://raw.githubuserconte 6 | nt.com/vaimo/composer-patches/bad/patch/url/single-package-single-file-no-v 7 | ersion.patch. Override the 'secure-http' to allow: https://github.com/vaimo 8 | /composer-patches/blob/master/docs/CONFIGURATION.md#allow-downloads-from-un 9 | secure-locations 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/scenarios/strict-lock-update-no-patch-applied/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Package operations: 0 installs, 1 update, 0 removals 4 | - Upgrading vaimo/composer-patches-target2 (0.0.0 => 1.2.0): Mirroring from modules/composer-patches-target2 5 | Package operations: 0 installs, 1 update, 0 removals 6 | - Upgrading vaimo/composer-patches-target1 (0.0.0 => 1.0.0): Mirroring from modules/composer-patches-target1 7 | Package operations: 1 install, 0 updates, 0 removals 8 | - Installing vaimo/composer-patches-target2 (1.2.0): Mirroring from modules/composer-patches-target2 9 | Package operations: 1 install, 0 updates, 0 removals 10 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 11 | -------------------------------------------------------------------------------- /src/Package/ConfigExtractors/NamespaceConfigExtractor.php: -------------------------------------------------------------------------------- 1 | getAutoload(); 15 | 16 | if (!isset($autoload[ComposerConfig::PSR4_CONFIG])) { 17 | return array(); 18 | } 19 | 20 | return array_keys($autoload[ComposerConfig::PSR4_CONFIG]); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Utils/PathUtils.php: -------------------------------------------------------------------------------- 1 | valueX 7 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 8 | Change: valueX => valueY 9 | 10 | Writing patch info to install file 11 | Processing patches configuration 12 | - Applying patches for vaimo/composer-patches-target1 (2) 13 | ~ {{PATCHES-OWNER}}: patches/0_first-change.patch [MATCH] 14 | Change: value8 => valueX 15 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [MATCH] 16 | Change: valueX => valueY 17 | 18 | Writing patch info to install file 19 | -------------------------------------------------------------------------------- /test/scenarios/rename/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-target1 (2) 5 | ~ {{PATCHES-OWNER}}: patches/0_initial-change.patch [NEW] 6 | Change: value8 => valueC 7 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 8 | Change: valueC => valueX 9 | 10 | Writing patch info to install file 11 | Processing patches configuration 12 | - Applying patches for vaimo/composer-patches-target1 (2) 13 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [REMOVED] 14 | Change: valueC => valueX 15 | ~ {{PATCHES-OWNER}}: patches/1_renamed-patch.patch [NEW] 16 | Change: valueC => valueZ 17 | 18 | Writing patch info to install file 19 | -------------------------------------------------------------------------------- /src/Interfaces/ListResolverInterface.php: -------------------------------------------------------------------------------- 1 | 1.2.0): Mirroring from modules/composer-patches-target2 5 | 6 | Package operations: 0 installs, 1 update, 0 removals 7 | - Updating vaimo/composer-patches-target1 (0.0.0 => 1.0.0): Mirroring from modules/composer-patches-target1 8 | 9 | Package operations: 1 install, 0 updates, 0 removals 10 | - Installing vaimo/composer-patches-target2 (1.2.0): Mirroring from modules/composer-patches-target2 11 | Package operations: 1 install, 0 updates, 0 removals 12 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 13 | -------------------------------------------------------------------------------- /src/Package/ConfigExtractors/InstalledConfigExtractor.php: -------------------------------------------------------------------------------- 1 | $methodName(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Patch/Definition/Exploder/ItemBuilder.php: -------------------------------------------------------------------------------- 1 | $subItem) { 23 | $items[] = $this->createItem($label, $subItem, array($keyName => $source)); 24 | } 25 | 26 | return $items; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/scenarios/addition-direct/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (1) 6 | ~ {{PATCHES-OWNER}}: patches/0_initial-change.patch [NEW] 7 | Change: value8 => valueC 8 | 9 | Writing patch info to install file 10 | Processing patches configuration 11 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 12 | - Applying patches for vaimo/composer-patches-target1 (2) 13 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 14 | Change: valueC => valueX 15 | 16 | Writing patch info to install file 17 | -------------------------------------------------------------------------------- /test/scenarios/default-command-apply/files/patches.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "Change: value17 => valueB; value5 => valueA": "patches/multiple-packages-single-file.patch" 4 | }, 5 | "vaimo/composer-patches-target1": { 6 | "Change: value8 => valueC": "patches/single-package-single-file-no-version.patch", 7 | "Change: value17 => valueX": { 8 | "*": "patches/single-package-single-file-wildcard-version.patch" 9 | } 10 | }, 11 | "vaimo/composer-patches-target3": { 12 | "Change: value17 => valueB": { 13 | ">1.2.3": "patches/single-package-single-file-non-matching-constraint.patch" 14 | }, 15 | "Change: value18 => valueB": { 16 | "<=1.2.3": "patches/single-package-single-file-matching-constraint.patch" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-update/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | 3 | update 4 | 5 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 6 | 7 | @queue_update vaimo/composer-patches-target2 8 | update 9 | 10 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 11 | 12 | @queue_update vaimo/composer-patches-target1 13 | update 14 | 15 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 16 | 17 | @queue_install vaimo/composer-patches-target2 18 | update 19 | 20 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 21 | 22 | @queue_install vaimo/composer-patches-target1 23 | update 24 | 25 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 26 | -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-install/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | 3 | install 4 | 5 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 6 | 7 | @queue_update vaimo/composer-patches-target2 8 | install 9 | 10 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 11 | 12 | @queue_update vaimo/composer-patches-target1 13 | install 14 | 15 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 16 | 17 | @queue_install vaimo/composer-patches-target2 18 | install 19 | 20 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 21 | 22 | @queue_install vaimo/composer-patches-target1 23 | install 24 | 25 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 26 | -------------------------------------------------------------------------------- /src/Exceptions/PatchFailureException.php: -------------------------------------------------------------------------------- 1 | failedPatchPath = $failedPatchPath; 25 | } 26 | 27 | public function getFailedPatchPath() 28 | { 29 | return $this->failedPatchPath; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Sources/ProjectSource.php: -------------------------------------------------------------------------------- 1 | rootPackage = $rootPackage; 22 | } 23 | 24 | public function getItems(\Composer\Repository\WritableRepositoryInterface $repository) 25 | { 26 | return array($this->rootPackage); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Composer/CommandsProvider.php: -------------------------------------------------------------------------------- 1 | =9.1.1", 11 | "squizlabs/php_codesniffer": ">=2.9.2" 12 | }, 13 | "repositories": [ 14 | { 15 | "type": "path", 16 | "url": "modules/composer-patches" 17 | } 18 | ], 19 | "config": { 20 | "platform": { 21 | "php": "7.4.33" 22 | }, 23 | "allow-plugins": { 24 | "vaimo/composer-patches-local": true, 25 | "vaimo/composer-patches-proxy": true 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Patch/Definition/Value/Analyser.php: -------------------------------------------------------------------------------- 1 | versionParser = new \Composer\Semver\VersionParser(); 18 | } 19 | 20 | public function isConstraint($value) 21 | { 22 | if (is_array($value)) { 23 | return false; 24 | } 25 | 26 | try { 27 | $this->versionParser->parseConstraints($value); 28 | } catch (\UnexpectedValueException $exception) { 29 | return false; 30 | } 31 | 32 | return true; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Patch/DefinitionList/Sanitizer.php: -------------------------------------------------------------------------------- 1 | dataUtils = new \Vaimo\ComposerPatches\Utils\DataUtils(); 18 | } 19 | 20 | public function getSanitizedList(array $patches) 21 | { 22 | $dataUtils = $this->dataUtils; 23 | 24 | return $this->dataUtils->walkArrayNodes( 25 | $patches, 26 | function (array $value) use ($dataUtils) { 27 | return $dataUtils->removeKeysByPrefix($value, '_'); 28 | } 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/scenarios/undo-single/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (2) 6 | ~ {{PATCHES-OWNER}}: patches/0_first-change.patch [NEW] 7 | Change: value8 => valueX 8 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 9 | Change: valueX => valueY 10 | 11 | Writing patch info to install file 12 | Processing patches configuration 13 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 14 | - Applying patches for vaimo/composer-patches-target1 (1) 15 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [REMOVED] 16 | Change: valueX => valueY 17 | 18 | Writing patch info to install file 19 | -------------------------------------------------------------------------------- /test/scenarios/content-change/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (2) 6 | ~ {{PATCHES-OWNER}}: patches/0_initial-change.patch [NEW] 7 | Change: value8 => valueC 8 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 9 | Change: valueC => valueX 10 | 11 | Writing patch info to install file 12 | Processing patches configuration 13 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 14 | - Applying patches for vaimo/composer-patches-target1 (2) 15 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [CHANGED] 16 | Change: valueC => valueX 17 | 18 | Writing patch info to install file 19 | -------------------------------------------------------------------------------- /test/scenarios/default-command-apply/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-sandbox (1) 5 | ~ {{PATCHES-OWNER}}: patches/multiple-packages-single-file.patch [NEW] 6 | Change: value17 => valueB; value5 => valueA 7 | 8 | - Applying patches for vaimo/composer-patches-target1 (2) 9 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 10 | Change: value8 => valueC 11 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-wildcard-version.patch [NEW] 12 | Change: value17 => valueX 13 | 14 | - Applying patches for vaimo/composer-patches-target3 (1) 15 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-matching-constraint.patch [NEW] 16 | Change: value18 => valueB 17 | 18 | Writing patch info to install file 19 | -------------------------------------------------------------------------------- /test/scenarios/removal-direct/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (2) 6 | ~ {{PATCHES-OWNER}}: patches/0_initial-change.patch [NEW] 7 | Change: value8 => valueC 8 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [NEW] 9 | Change: valueC => valueX 10 | 11 | Writing patch info to install file 12 | Processing patches configuration 13 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 14 | - Applying patches for vaimo/composer-patches-target1 (1) 15 | ~ {{PATCHES-OWNER}}: patches/1_second-change.patch [REMOVED] 16 | Change: valueC => valueX 17 | 18 | Writing patch info to install file 19 | -------------------------------------------------------------------------------- /test/scenarios/depends/.output-v1: -------------------------------------------------------------------------------- 1 | Package operations: 0 installs, 0 updates, 1 removal 2 | - Removing vaimo/composer-patches-target2 (1.2.0) 3 | Processing patches configuration 4 | Nothing to patch 5 | Using version ^1.2 for vaimo/composer-patches-target2 6 | ./composer.json has been updated 7 | Package operations: 1 install, 0 updates, 0 removals 8 | - Installing vaimo/composer-patches-target2 (1.2.0): Mirroring from modules/composer-patches-target2 9 | Processing patches configuration 10 | - Applying patches for vaimo/composer-patches-target1 (1) 11 | ~ {{PATCHES-OWNER}}: patches/change.patch [NEW] 12 | Change 13 | 14 | Writing patch info to install file 15 | Package operations: 0 installs, 0 updates, 1 removal 16 | - Removing vaimo/composer-patches-target2 (1.2.0) 17 | Processing patches configuration 18 | - Resetting patches for vaimo/composer-patches-target1 (1) 19 | Writing patch info to install file -------------------------------------------------------------------------------- /test/scenarios/lock-persistence-apply-redo-spam/.commands: -------------------------------------------------------------------------------- 1 | patch:validate 2 | 3 | patch:apply 4 | 5 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 6 | 7 | patch:redo 8 | 9 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 10 | 11 | patch:apply 12 | patch:apply 13 | 14 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 15 | 16 | patch:undo 17 | 18 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 19 | 20 | patch:apply 21 | 22 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 23 | 24 | patch:redo 25 | patch:redo 26 | 27 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # 28 | 29 | patch:undo 30 | 31 | > test "$(cat composer.lock|grep '\"patches_applied\"')" == "" # Scanning lock contents # -------------------------------------------------------------------------------- /src/Package/OperationAnalyser.php: -------------------------------------------------------------------------------- 1 | configAnalyser = new \Vaimo\ComposerPatches\Package\ConfigAnalyser(); 20 | } 21 | 22 | public function isPatcherUninstallOperation(OperationInterface $operation) 23 | { 24 | if (!$operation instanceof \Composer\DependencyResolver\Operation\UninstallOperation) { 25 | return false; 26 | } 27 | 28 | return $this->configAnalyser->ownsNamespace($operation->getPackage(), __NAMESPACE__); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /phpmd.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | PHP CodeSniffer rules for PhpMd 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/modules/composer-patches-target1/LICENSE_VAIMO.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2009-2019 Vaimo Group. 2 | 3 | Vaimo reserves all rights in the Program as delivered. The Program 4 | or any portion thereof may not be reproduced in any form whatsoever without 5 | the written consent of Vaimo, except as provided by licence. A licence 6 | under Vaimo's rights in the Program may be available directly from 7 | Vaimo. 8 | 9 | Disclaimer: 10 | THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF. 11 | THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS 17 | IN THE PROGRAM. -------------------------------------------------------------------------------- /test/modules/composer-patches-target2/LICENSE_VAIMO.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2009-2019 Vaimo Group. 2 | 3 | Vaimo reserves all rights in the Program as delivered. The Program 4 | or any portion thereof may not be reproduced in any form whatsoever without 5 | the written consent of Vaimo, except as provided by licence. A licence 6 | under Vaimo's rights in the Program may be available directly from 7 | Vaimo. 8 | 9 | Disclaimer: 10 | THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF. 11 | THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS 17 | IN THE PROGRAM. -------------------------------------------------------------------------------- /test/modules/composer-patches-target3/LICENSE_VAIMO.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2009-2019 Vaimo Group. 2 | 3 | Vaimo reserves all rights in the Program as delivered. The Program 4 | or any portion thereof may not be reproduced in any form whatsoever without 5 | the written consent of Vaimo, except as provided by licence. A licence 6 | under Vaimo's rights in the Program may be available directly from 7 | Vaimo. 8 | 9 | Disclaimer: 10 | THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF. 11 | THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS 17 | IN THE PROGRAM. -------------------------------------------------------------------------------- /test/scenarios/undo-all/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-sandbox (1) 5 | ~ {{PATCHES-OWNER}}: patches/multiple-packages-single-file.patch [NEW] 6 | Change: value17 => valueB; value5 => valueA 7 | 8 | - Applying patches for vaimo/composer-patches-target1 (2) 9 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 10 | Change: value8 => valueC 11 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-wildcard-version.patch [NEW] 12 | Change: value17 => valueX 13 | 14 | Writing patch info to install file 15 | Processing patches configuration 16 | - Resetting patches for vaimo/composer-patches-target1 (2) 17 | - Resetting patches for vaimo/composer-patches-target2 (1) 18 | - Resetting patches for vaimo/composer-patches-target3 (1) 19 | Writing patch info to install file 20 | -------------------------------------------------------------------------------- /test/scenarios/full-reset/.output-v1: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Applying patches for vaimo/composer-patches-sandbox (1) 5 | ~ {{PATCHES-OWNER}}: patches/multiple-packages-single-file.patch [NEW] 6 | Change: value17 => valueB; value5 => valueA 7 | 8 | - Applying patches for vaimo/composer-patches-target1 (2) 9 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-no-version.patch [NEW] 10 | Change: value8 => valueC 11 | ~ {{PATCHES-OWNER}}: patches/single-package-single-file-wildcard-version.patch [NEW] 12 | Change: value17 => valueX 13 | 14 | Writing patch info to install file 15 | Processing patches configuration 16 | - Resetting patches for vaimo/composer-patches-target1 (2) 17 | - Resetting patches for vaimo/composer-patches-target2 (1) 18 | - Resetting patches for vaimo/composer-patches-target3 (1) 19 | Writing patch info to install file 20 | -------------------------------------------------------------------------------- /test/scenarios/owner-remove-reset/.output: -------------------------------------------------------------------------------- 1 | Scanning packages for orphan patches 2 | Validation completed successfully 3 | Processing patches configuration 4 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 5 | - Applying patches for vaimo/composer-patches-target1 (1) 6 | ~ {{PATCHES-OWNER}}: patches/one-line-change.patch [NEW] 7 | Change: value8 => valueC (expecting revert on owner removal) 8 | 9 | Writing patch info to install file 10 | ./composer.json has been updated 11 | Lock file operations: 0 installs, 0 updates, 1 removal 12 | - Removing {{PATCHES-OWNER}} (1.0.0) 13 | Package operations: 0 installs, 0 updates, 1 removal 14 | - Removing {{PATCHES-OWNER}} (1.0.0) 15 | Processing patches configuration 16 | - Resetting patches for vaimo/composer-patches-target1 (1) 17 | - Installing vaimo/composer-patches-target1 (1.0.0): Mirroring from modules/composer-patches-target1 18 | Writing patch info to install file -------------------------------------------------------------------------------- /src/Utils/ConstraintUtils.php: -------------------------------------------------------------------------------- 1 | versionParser = new \Composer\Semver\VersionParser(); 18 | } 19 | 20 | public function isConstraint($value) 21 | { 22 | if (is_array($value)) { 23 | return false; 24 | } 25 | 26 | try { 27 | $this->versionParser->parseConstraints($value); 28 | } catch (\UnexpectedValueException $exception) { 29 | return false; 30 | } 31 | 32 | return true; 33 | } 34 | 35 | public function isDevConstraint($value) 36 | { 37 | return strpos($value, 'dev-') === 0; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Package/PatchApplier/StatusConfig.php: -------------------------------------------------------------------------------- 1 | 'NEW', 16 | Patch::STATUS_ERRORS => '%s', 17 | Patch::STATUS_CHANGED => 'CHANGED', 18 | Patch::STATUS_MATCH => 'MATCH', 19 | Patch::STATUS_AFFECTED => 'AFFECTED', 20 | Patch::STATUS_APPLIED => 'APPLIED', 21 | Patch::STATUS_REMOVED => 'REMOVED', 22 | Patch::STATUS_EXCLUDED => 'EXCLUDED', 23 | Patch::STATUS_UNKNOWN => 'UNKNOWN' 24 | ); 25 | } 26 | } 27 | --------------------------------------------------------------------------------