|
| 1 | +# update-checkout |
| 2 | + |
| 3 | +`update-checkout` is Swift's multi repository management tool. It allows to clone and update all the required repositories to build the Swift toolchain based on the `update-checkout-config.json` configuration file. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +`update-checkout` does not have any dependencies apart from `Python 3.7` or more recent. To run it, clone the `swift` repository and run the following command to print the help output: |
| 8 | + |
| 9 | +```bash |
| 10 | +./swift/utils/update-checkout -h |
| 11 | +``` |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +The following commands assume you have a working `Python 3` installation and that you have already cloned the `swift` repository. |
| 16 | + |
| 17 | +### Cloning the repositories and checking out a specific scheme |
| 18 | + |
| 19 | +To clone the repositories for the `release/6.2` scheme, run the following command: |
| 20 | + |
| 21 | +```bash |
| 22 | +./swift/utils/update-checkout --clone --scheme release/6.2 |
| 23 | +``` |
| 24 | + |
| 25 | +The command above will use `HTTPS` to clone the repositories. Use `--clone-with-ssh` to clone with `SSH` instead: |
| 26 | + |
| 27 | +```bash |
| 28 | +./swift/utils/update-checkout --clone-with-ssh --scheme release/6.2 |
| 29 | +``` |
| 30 | + |
| 31 | +You can skip repositories by adding the `--skip-repository` argument: |
| 32 | + |
| 33 | +```bash |
| 34 | +./swift/utils/update-checkout --clone-with-ssh --scheme release/6.2 --skip-repository llvm-project --skip-repository swift |
| 35 | +``` |
| 36 | + |
| 37 | +### Updating or switching between schemes |
| 38 | + |
| 39 | +To update all the repositories after they have been cloned or to switch to another scheme, run: |
| 40 | + |
| 41 | +```bash |
| 42 | +./swift/utils/update-checkout --scheme main |
| 43 | +``` |
| 44 | + |
| 45 | +If you have changes in any of the repositories, you can stash or clean them before updating. Please refer to the `help` for the details as to how `--clean` and `--stash` differ. |
| 46 | + |
| 47 | +```bash |
| 48 | +./swift/utils/update-checkout --scheme main --clean |
| 49 | +``` |
| 50 | + |
| 51 | +### Resetting all repositories to the remote state |
| 52 | + |
| 53 | +To reset the branches from each repositories to the state of the matching remote branch, run the following command: |
| 54 | + |
| 55 | +```bash |
| 56 | +./swift/utils/update-checkout --reset-to-remote --scheme release/6.2 |
| 57 | +``` |
| 58 | + |
| 59 | +To reset the branches to a tag rather than a scheme, run: |
| 60 | + |
| 61 | +```bash |
| 62 | +./swift/utils/update-checkout --reset-to-remote --tag swift-6.2.1-RELEASE |
| 63 | +``` |
| 64 | + |
| 65 | +You can skip repositories by adding the `--skip-repository` argument: |
| 66 | + |
| 67 | +```bash |
| 68 | +./swift/utils/update-checkout --reset-to-remote --scheme release/6.2 --skip-repository llvm-project --skip-repository swift |
| 69 | +``` |
| 70 | + |
| 71 | +### Matching timestamps |
| 72 | + |
| 73 | +To checkout the commits that most closely match the timestamp of the checked out commit of the Swift repository, run: |
| 74 | + |
| 75 | +```bash |
| 76 | +./swift/utils/update-checkout --scheme release/6.2 --match-timestamp |
| 77 | +``` |
| 78 | + |
| 79 | +## Testing |
| 80 | + |
| 81 | +`update-checkout` has both unit and end to end tests located in the `tests` directory. You can run them with the following command: |
| 82 | + |
| 83 | +```bash |
| 84 | +python3 ./swift/utils/update_checkout/run_tests.py |
| 85 | +``` |
| 86 | + |
| 87 | +The tests are also part of the `check-swift` target, which means they run on CI along the other Swift tests. |
| 88 | + |
| 89 | +## Contributing |
| 90 | + |
| 91 | +Before contributing, please read [our main guide](https://www.swift.org/contributing) |
| 92 | + |
| 93 | +## LICENSE |
| 94 | + |
| 95 | +See [LICENSE](../../LICENSE.txt) for license information. |
| 96 | + |
| 97 | +## Code of Conduct |
| 98 | + |
| 99 | +See [Swift.org Code of Conduct](https://swift.org/code-of-conduct/) for Code of Conduct information. |
0 commit comments