Testing Klipper Pull Requests

Rational

New features and changes to Klipper are typically managed via Pull Requests (PR) against the Klipper main repository on GitHub.

If one wants to evaluate individual PRs and potentially provide feedback, there is a quite easy way to integrate such changes into the Klipper that is running locally.

Process

1. Check the PR’s quality
At the bottom of the PR, an indication is displayed if the PR fulfills the general quality requirements and cleanly applies to the repository. The status should look like in the following screenshot:

2. Identify the PR number
For integrating the PR locally, its number is required. The screenshot below shows how to identify this number:

3. Integration of the PR locally
To integrate the PR in the local installation, some commands on the Linux shell are required:

sudo service klipper stop
cd ~/klipper
git fetch origin pull/<the identified PR number>/head && git checkout FETCH_HEAD
sudo service klipper start

With <the identified PR number> being the number from step 2 above.
Taking the example from the screenshots above, the relevant command would be:

git fetch origin pull/6784/head && git checkout FETCH_HEAD

4. Update in case the PR gets updated
It is common for PRs to evolve over time due to feedback received. To update to the latest version, repeat the procedure in step 3.

5. Return to the previous version
To finish the testing and return to the previously used version, use the following commands:

sudo service klipper stop
cd ~/klipper
git checkout master
sudo service klipper start

Final Notes

There are many different ways to potentially achieve the same result. Listing all these options with their differences and quirks is beyond the scope of this article.

  • This approach intentionally goes the way via a HEAD detached state to avoid piling up branches in the local copy.
  • PRs should be tested individually. This method is not suited to stack different PRs. If different PRs need to be tested, always return to the original version before testing another PR.
1 Like