Skip to content
Permalink
Browse files

ShipIt now HSL'ed to heck (#77)

Summary:
Pull Request resolved: #77

No more `ImmVector` or `Vector`.

No more `ImmSet` or `Set`.

No more `ImmMap` or `Map`.

Just pure HSL bliss

perfection

Reviewed By: yns88

Differential Revision: D16530151

fbshipit-source-id: 199e13cd41e621e2e1a1a70166b706f3ff12d447
  • Loading branch information
bigfootjon authored and facebook-github-bot committed Jul 30, 2019
1 parent 96d93c9 commit 2fce6abb0870cd575fc2aca8503ddf3249c0c749
Showing with 933 additions and 928 deletions.
  1. +12 −12 README.md
  2. +70 −68 fb-examples/lib/config/FBShipItConfig.php-example
  3. +2 −2 fb-examples/lib/config/FBWWWBasePlugin.php-example
  4. +3 −3 fb-examples/lib/config/HslBasePlugin.php-example
  5. +1 −1 fb-examples/lib/importit/FBImportItBranchResolutionPhase.php-example
  6. +6 −6 fb-examples/lib/importit/FBImportItCLI.php-example
  7. +8 −7 fb-examples/lib/importit/FBRepoInitPhase.php-example
  8. +8 −9 fb-examples/lib/importit/ImportItRustPathFilters.php-example
  9. +3 −3 fb-examples/lib/shipit/BuckPushDocsPhase.php-example
  10. +3 −3 fb-examples/lib/shipit/BuckUpdateInternalMirrorPhase.php-example
  11. +3 −3 fb-examples/lib/shipit/BuckVerifyNoMoeOccurrencesPhase.php-example
  12. +4 −4 fb-examples/lib/shipit/BuildAndTestPhase.php-example
  13. +3 −3 fb-examples/lib/shipit/EnvironmentCheckPhase.php-example
  14. +18 −24 fb-examples/lib/shipit/FBCodeBuilder.php-example
  15. +49 −40 fb-examples/lib/shipit/FBCommonFilters.php-example
  16. +1 −1 fb-examples/lib/shipit/FBDumpShipItMetadata.php-example
  17. +42 −42 fb-examples/lib/shipit/FBRepoInitPhase.php-example
  18. +14 −11 fb-examples/lib/shipit/FBShipItBranchResolutionPhase.php-example
  19. +2 −2 fb-examples/lib/shipit/FBShipItCLITrait.php-example
  20. +5 −4 fb-examples/lib/shipit/FBShipItPreview.php-example
  21. +24 −21 fb-examples/lib/shipit/FBShipItProjectRunner.php-example
  22. +6 −6 fb-examples/lib/shipit/FBShipItPublicizeSyncScriptsPhase.php-example
  23. +2 −2 fb-examples/lib/shipit/OSTeamFilters.php-example
  24. +9 −8 fb-examples/tests/importit/FBProjectBaseTest.php-example
  25. +28 −28 fb-examples/tests/shipit/FBCommonFiltersTest.php-example
  26. +27 −26 fb-examples/tests/shipit/FBProjectBaseTest.php-example
  27. +33 −33 fb-examples/tests/shipit/FBShipItFilterSubmoduleChangesetsTest.php-example
  28. +4 −4 fb-examples/tests/shipit/FBShipItPreviewTest.php-example
  29. +4 −4 fb-examples/tests/shipit/FBShipItProjectRunnerTest.php-example
  30. +1 −1 src/config/IShipItConfig.php
  31. +1 −1 src/importit/ImportItPathMappings.php
  32. +1 −1 src/importit/ImportItSubmoduleMappings.php
  33. +8 −9 src/importit/filter/ImportItPathFilters.php
  34. +2 −2 src/importit/filter/ImportItSubmoduleFilter.php
  35. +3 −3 src/importit/phase/ImportItSyncPhase.php
  36. +1 −1 src/importit/repo/ImportItRepoGIT.php
  37. +3 −3 src/shipit/ShipItBaseConfig.php
  38. +10 −10 src/shipit/ShipItChangeset.php
  39. +8 −7 src/shipit/ShipItGitHubUtils.php
  40. +11 −7 src/shipit/ShipItShellCommand.php
  41. +20 −22 src/shipit/ShipItSync.php
  42. +12 −12 src/shipit/ShipItSyncConfig.php
  43. +1 −1 src/shipit/ShipItUtil.php
  44. +2 −2 src/shipit/filter/ShipItConditionalLinesFilter.php
  45. +6 −6 src/shipit/filter/ShipItMentions.php
  46. +10 −10 src/shipit/filter/ShipItMessageSections.php
  47. +15 −14 src/shipit/filter/ShipItPathFilters.php
  48. +2 −2 src/shipit/filter/ShipItSubmoduleFilter.php
  49. +3 −3 src/shipit/phase/ShipItCleanPhase.php
  50. +14 −14 src/shipit/phase/ShipItCreateNewRepoPhase.php
  51. +8 −8 src/shipit/phase/ShipItDeleteCorruptedRepoPhase.php
  52. +12 −12 src/shipit/phase/ShipItFilterSanityCheckPhase.php
  53. +3 −3 src/shipit/phase/ShipItGitHubInitPhase.php
  54. +2 −2 src/shipit/phase/ShipItPhase.php
  55. +18 −18 src/shipit/phase/ShipItPhaseRunner.php
  56. +5 −5 src/shipit/phase/ShipItPullPhase.php
  57. +3 −3 src/shipit/phase/ShipItPushLfsPhase.php
  58. +3 −3 src/shipit/phase/ShipItPushPhase.php
  59. +4 −4 src/shipit/phase/ShipItSaveConfigPhase.php
  60. +6 −6 src/shipit/phase/ShipItSyncPhase.php
  61. +4 −4 src/shipit/phase/ShipItVerifyRepoPhase.php
  62. +1 −1 src/shipit/repo/ShipItDestinationRepo.php
  63. +1 −1 src/shipit/repo/ShipItRepo.php
  64. +31 −32 src/shipit/repo/ShipItRepoGIT.php
  65. +35 −37 src/shipit/repo/ShipItRepoHG.php
  66. +2 −2 src/shipit/repo/ShipItSourceRepo.php
  67. +27 −30 tests/importit/PathFiltersTest.php
  68. +4 −4 tests/importit/SubmoduleTest.php
  69. +8 −5 tests/shipit/BaseTest.php
  70. +9 −8 tests/shipit/ConditionalLinesFilterTest.php
  71. +2 −2 tests/shipit/FakeShipItRepo.php
  72. +19 −15 tests/shipit/FilterSanityCheckPhaseTest.php
  73. +24 −24 tests/shipit/MessageSectionsTest.php
  74. +3 −3 tests/shipit/NewlinesTest.php
  75. +75 −97 tests/shipit/PathFiltersTest.php
  76. +4 −2 tests/shipit/PathsWithSpacesTest.php
  77. +9 −8 tests/shipit/RenameFileTest.php
  78. +5 −5 tests/shipit/ShipItShellCommandTest.php
  79. +3 −3 tests/shipit/ShipItUtilTest.php
  80. +6 −4 tests/shipit/SubmoduleTest.php
  81. +48 −45 tests/shipit/SymlinkTest.php
  82. +7 −7 tests/shipit/SyncTrackingTest.php
  83. +4 −4 tests/shipit/UnicodeTest.php
  84. +4 −4 tests/shipit/UnusualContentTest.php
  85. +6 −6 tests/shipit/UserFiltersTest.php
@@ -71,8 +71,8 @@ You need to construct:
- a pipeline of filters, assuming you are using the `ShipItSyncPhase`

Filters are provided for common operations - the most frequent are:
- `ShipItPathFilters::moveDirectories(string $changeset, ImmMap<string, string> $mapping)`: apply patches to a different directory in the destination repository
- `ShipItPathFilters::stripPaths(string $changeset, ImmVector<string> $patterns, ImmVector<string> $exception_patterns = ImmVector { })`: remove any modifications to paths matching `$patterns`, unless they match something in `$exception_patterns`.
- `ShipItPathFilters::moveDirectories(string $changeset, dict<string, string> $mapping)`: apply patches to a different directory in the destination repository
- `ShipItPathFilters::stripPaths(string $changeset, vec<string> $patterns, vec<string> $exception_patterns = vec[])`: remove any modifications to paths matching `$patterns`, unless they match something in `$exception_patterns`.

## Example

@@ -84,10 +84,10 @@ namespace Facebook\ShipIt;
class ShipMyProject
implements \Facebook\ImportIt\ImportItPathMappings {
public static function getPathMappings(): ImmMap<string, string> {
return ImmMap {
public static function getPathMappings(): dict<string, string> {
return dict[
'myproject/' => '',
};
];
}
public static function filterChangeset(
@@ -96,11 +96,11 @@ class ShipMyProject
return $changeset
|> ShipItPathFilters::stripPaths(
$$,
ImmVector {
vec[
'@^(?!myproject/)@',
'@^myproject(/[^/]+)*/MY_PRIVATE_STUFF$@',
'@/non[-_]?public/@',
},
],
)
|> ShipItPathFilters::moveDirectories(
$$,
@@ -115,7 +115,7 @@ class ShipMyProject
'dest_dir_name',
);
$phases = ImmVector {
$phases = vec[
new MySourceRepoInitPhase(/* ... */ ),
new ShipItPullPhase(ShipItRepoSide::SOURCE),
new ShipItGitHubInitPhase(
@@ -129,10 +129,10 @@ class ShipMyProject
new ShipItPullPhase(ShipItRepoSide::DESTINATION),
new ShipItSyncPhase(
($config, $changeset) ==> self::filterChangeset($changeset),
/* directories to run hg log/hg diff in: */ ImmSet { 'myproject/' },
/* directories to run hg log/hg diff in: */ keyset['myproject/'],
),
new ShipItPushPhase(),
};
];
(new ShipItPhaseRunner($config, $phases))->run();
}
@@ -188,7 +188,7 @@ class ImportMyProject {
'source_dir_name',
'dest_dir_name',
),
ImmVector {
vec[
new MySourceRepoInitPhase(/* ... */ ),
new ShipItCleanPhase(ShipItRepoSide::DESTINATION),
new ShipItPullPhase(ShipItRepoSide::DESTINATION),
@@ -211,7 +211,7 @@ class ImportMyProject {
ShipItRepoSide::DESTINATION,
$changeset ==> self::filterChangeset($changeset),
),
},
],
))
->run();
}

0 comments on commit 2fce6ab

Please sign in to comment.
You can’t perform that action at this time.