We're hiring!
*

Quick hack: git-pw

Ezequiel Garcia avatar

Ezequiel Garcia
April 18, 2019

Share this post:

Reading time:

Some communities, such as the Linux kernel community, base their development process on mailing lists. Patches come and go in the form of good ol' mails. When one wants to test a patch series, one downloads all the patches and applies them using a command such as git-am.

A well-known Linux kernel developer once said: A poor craftsman famously complains about his tools, but a good craftsman knows how to choose excellent tools.

With that in mind, I recently set out to find proper tools to make my workflow less poor…

…and that’s how I found git-pw. I won’t say I quit complaining, but it certainly improved my toolbox.

A new tool in your toolbox

Git-pw is a python-based tool that integrates git and patchwork. It's important to note that git-pw requires patchwork v2.0, as it uses the new REST API and other improvements, such as understanding the difference between patches, series and cover letters,to know exactly what to try and apply.

The usual python incantation can be chanted for installing:

$ pip install --user git-pw

Some configuration is the next step. First, a patchwork API endpoint is needed; and then, a way to authenticate against it. Either a user/password combination or a token will do. For instance, in order to use kernel.org's patchwork:

$ git config pw.server https://patchwork.kernel.org/api/1.1
$ git config pw.token YOUR_USER_TOKEN_HERE

Finding and applying series

Let’s see how it works in practice. As an example, I want to apply Gaël Portay's recently submitted series: "Add support for drm/rockchip to dynamically control the DDR frequency.". The first step is to do searching for this series.

We could use patchwork web UI search engine for it. Given Gaël series has been submitted to linux-rockchip, we'll go to that project and then click on _"Show patches with"_ to access the filter menu. This menu allows to quickly find the series we need, for instance filtering by submitter. This way we would find the series patchwork ID to be 95139.

Another way of searching is via Patchwork's REST API. This is very well documented. And of course, git-pw already supports this!

$ git-pw --project linux-rockchip series list "dynamically"
ID Date Name Version Submitter
95139 a day ago Add support for drm/rockchip to dynamically control the DDR frequency. 3 Gaël PORTAY
93875 3 days ago Add support for drm/rockchip to dynamically control the DDR frequency. 2 Gaël PORTAY
3039 8 months ago Add support for drm/rockchip to dynamically control the DDR frequency. 1 Enric Balletbo i Serra


Which has the added side-effect of giving us some interesting metadata on the series history.

Now, let's use the serie ID to get more info:

$ git-pw series show 95139
Property Value
ID 95139
Date 2019-03-21T23:14:35
Name Add support for drm/rockchip to dynamically control the DDR frequency.
URL https://patchwork.kernel.org/project/linux-rockchip/list/?series=95139
Submitter Gaël PORTAY
Project Rockchip SoC list
Version 3
Received 5 of 5
Complete True
Cover 10864561 [v3,0/5] Add support for drm/rockchip to dynamically control the DDR frequency.
Patches 10864575 [v3,1/5] devfreq: rockchip-dfi: Move GRF definitions to a common place.
  10864579 [v3,2/5] dt-bindings: devfreq: rk3399_dmc: Add rockchip, pmu phandle.
  10864589 [v3,3/5] devfreq: rk3399_dmc: Pass ODT and auto power down parameters to TF-A.
  10864591 [v3,4/5] arm64: dts: rk3399: Add dfi and dmc nodes.
  10864585 [v3,5/5] arm64: dts: rockchip: Enable dmc and dfi nodes on gru.


Applying the entire series, or at least trying to, is now as easy as:

$ git-pw series apply 95139

This command will simply fetch all the patches in the series, and apply them in the right order. Should there be any conflicts, we will have to resort to manual fixing just as one would when using git-am.

And that's all folks! Of course, patchwork and git-pw are open source tools. So don't hesitate to take a look at them, and help the developers by fixing any bugs you see, or contributing and proposing any features you'd like. I, for one, have already started. ;-)

Comments (0)


Add a Comment






Allowed tags: <b><i><br>Add a new comment:


Search the newsroom

Latest Blog Posts

Faster inference: torch.compile vs TensorRT

19/12/2024

In the world of deep learning optimization, two powerful tools stand out: torch.compile, PyTorch’s just-in-time (JIT) compiler, and NVIDIA’s…

Mesa CI and the power of pre-merge testing

08/10/2024

Having multiple developers work on pre-merge testing distributes the process and ensures that every contribution is rigorously tested before…

A shifty tale about unit testing with Maxwell, NVK's backend compiler

15/08/2024

After rigorous debugging, a new unit testing framework was added to the backend compiler for NVK. This is a walkthrough of the steps taken…

A journey towards reliable testing in the Linux Kernel

01/08/2024

We're reflecting on the steps taken as we continually seek to improve Linux kernel integration. This will include more detail about the…

Building a Board Farm for Embedded World

27/06/2024

With each board running a mainline-first Linux software stack and tested in a CI loop with the LAVA test framework, the Farm showcased Collabora's…

Smart audio filters with WirePlumber 0.5

26/06/2024

WirePlumber 0.5 arrived recently with many new and essential features including the Smart Filter Policy, enabling audio filters to automatically…

Open Since 2005 logo

Our website only uses a strictly necessary session cookie provided by our CMS system. To find out more please follow this link.

Collabora Limited © 2005-2024. All rights reserved. Privacy Notice. Sitemap.