-
Notifications
You must be signed in to change notification settings - Fork 207
Managing externals included in CIME
There are several external tools (e.g., PIO, MCT) which are included in CIME to ease its use in Earth Models. This page has some instructions for moving changes to externals into CIME and for contributing changes from CIME back to the originating external.
There are four possible workflows; Inserting in a new external into CIME as a subtree, replacing original CIME code with an external subtree, merging in changes from an external into a CIME subtree, and pulling changes from a CIME subtree to merge back to an external. Each workflow is outlined below followed by sections showing details for various workflow step types. Read the conditions at the top of each workflow to be sure to choose the correct one. Some Terminology
<external-subdir> refers to the place in the CIME tree where the external code resides (or will reside).
<external_name> is a name you give to the external so that you can refer to the external repository. Note that <external_name> can be a branch name, a commit, or a tag name.
<external_url> is the URL for the external repository.
<external_commit> refers to a branch name (<external_url>/<branch_name>), a commit, or a tag name from the external repository.
<external_branchname> refers to local branch created with git subtree split. In preparation for merging with an upstream repository.
This workflow should only be used if CIME decides to adopt code from a new external. The resulting subtree will be a new subdirectory within CIME. This will typically be done once to be followed by the 'Merge Changes' workflow below.
- Create and switch to a branch in which to conduct the work. Be sure to follow the <?branch naming conventions> and other <?development practices>. The branch name should follow the form ??.
- Add external git repo to as a remote in your local repository copy (git remote add -f --tags <external_name> <external_url>).
- Add code from external git repo to CIME (git read-tree --prefix=<external_subdir>/ -u <external_commit>).
- Commit the change (git commit).
- Test and submit a pull request as defined in the development practices page.
This workflow should only be used if original (v0.0) CIME code is being replaced with code from an external. This will typically be done once to be followed by the 'Merge Changes' workflow below.
- Verify that the external code in the CIME repository has been not been modified since the initial commit (cd <external-subdir>; git diff --name-only v0.0 .). If there are changes (non-blank output), follow the 'Merge changes from external into CIME subtree' workflow below.
- Create and switch to a branch in which to conduct the work. Be sure to follow the branch naming conventions and other development practices. The branch name should follow the form github-username/component/component.<version>-import.
- Add external git repo to as a remote in your local repository copy (git remote add -f --tags <external_name> <external_url>).
- Remove the code from your working copy (git rm -r <external-subdir>).
- Add code from external git repo to CIME (git read-tree --prefix=<external_subdir>/ -u <external_commit>).
- Commit the change (git commit).
- Test and submit a pull request as defined in the development practices page.
This workflow may be used repeatedly anytime new work is to be moved from an external into an CIME subtree.
- Add external git repo to as a remote in your local repository copy (git remote add -f --tags <external_name> <external_url>).
- Create and switch to a branch in which to conduct the work. Be sure to follow the branch naming conventions and other development practices. The branch name should follow the form github-username/component/component.<version>-import.
- Merge from external git repo to CIME (git merge --squash -X subtree=<external_subdir> --no-commit <external_commit>).
- Commit the change (git commit).
- Test and submit a pull request as defined in the development practices page.
This workflow is to be used any time changes to an CIME subtree should be shared with the source external repository. For example, consider a bug fix made in the CIME MCT code. This workflow would allow contributing that fix upstream to MCT. Note that this workflow should not be used for the case where the CIME subdirectory was not brought into CIME as a subtree. That workflow is beyond the scope of this document.
Pull changes from the CIME subtree into a new branch (git subtree split -P <external_subdir> -b <external_branchname>).