-
Notifications
You must be signed in to change notification settings - Fork 3
Apply a Pull Request
$> sastre deploy --help
Usage: deploy [OPTIONS]
Options:
--pr TEXT Pull request to apply [required]
--host TEXT Host to apply [required]
--from-number INTEGER From commit number
--from-commit TEXT From commit hash (included)
--force-hostname TEXT Force hostname [default: False]
--owner TEXT GitHub owner name [default: gisce]
--repository TEXT GitHub repository name [default: erp]
--src TEXT Remote src path [default: /home/erp/src]
--help Show this message and exit.
$> sastre deploy --pr <pr_number> --host ssh://<user>@<hostname>
Applying a PR may involve a conflicting PR. Applying such PRs will require manual resolves to merge the conflicts.
The Apply PR command will apply the commits until the conflicting patch is found. Then the user must solve the conflicts manually.
Apply PR command is based on the git am
command (you can get more info here), which creates an "am" session, applying patch by patch until a conflicting patch is found.
One of the best practices to apply it is to get the reject file (with the patches that won't apply directly). To do so:
-
Go to the affected server (via ssh)
-
Apply the patch with the following command:
git apply --reject patches/<pr_number>/<conflicting_patch>
-
Solve the conflits by reading the "*.rej" files and updating the affected file manually with an editor (like vim)
-
Add the commit files (even if no "*.rej" was generated), we recommend using the "--patch" to add only the changes from the commit if the file isn't clean on the repository before applying.
-
Go back to your applying session and insert a return character (press Intro) to resume.
On the Apply_pr session, insert a return character (press Intro) to skip the current commit.
Either the connection was lost or you, as a user, killed it on your PC the remote session will be kept. Also if the session was lost unexpectedly it won't be maked as Failed or Deployed on GitHub.
For a correct usage of deploy marks on github, it'd be great to mark as Failed or Deployed using status_pr
Also remember to enter the affected server (via ssh) and abort the current am session (initiated with apply_pr, but never closed)
# Status will show if the repository is applying patches inside an "am" session
git status
# You can abort the current AM session restoring all files as they where,
# but beware the edited files as they won't be restored
git am --abort