内容简介:Heya! This post will be ridiculously brief and simple, albeit filled with screenshots.As usual: This is a series of blog posts explaining different ways to contribute to KDE in an easy-to-digest manner.The purpose of this series originated from how I feel
Heya! This post will be ridiculously brief and simple, albeit filled with screenshots.
As usual: This is a series of blog posts explaining different ways to contribute to KDE in an easy-to-digest manner.
The purpose of this series originated from how I feel about asking users to contribute back to KDE. I firmly believe that showing users how contributing is easier than they think is more effective than simply calling them out and directing them to the correct resources; especially if, like me, said user suffers from anxiety or does not believe they are up to the task, in spite of their desire to help back.
Last time I explained how translators with a developer account have a really straightforward workflow and how the entire localization process for KDE works . I’ve also posted a little article I made some time ago on how to create a live-test environment to translate Scribus more easily , given that Scribus might become a KDE application in the future.
This post explains the process of sending your first patch to KDE. This tutorial, of course, is only useful for small patches, likely those which alter only one file, as the web interface is convenient for such cases but not when there is a ton of files from the same project.
I recently learned how to do this, so I really got excited to write a tutorial about it. However, it’s not worth adding it to the wiki as of now since the KDE infrastructure is being migrated to Gitlab . So instead I’m writing this blog post. Seriously, it’s so ridiculously easy that I honestly believe if this had been promoted before there would be many more patches coming from people who are still in the process of getting used to the terminal. Or those who simply prefer using a GUI, like me.
For more information about sending patches, please refer to https://community.kde.org/Get_Involved/development and https://community.kde.org/Infrastructure/Phabricator .
Creating your patch
First of all, I decided what I wanted to change. If you check https://phabricator.kde.org/T12810 , you’ll see the only change I’ll be doing to the selected projects is switching the contents of the GenericName
field. That is, I’ll be changing a single line of code in one file of each project. I’ll start with GCompris .
GCompris is not yet on KDE Invent. So, for downloading the project, I’m going to git clone it from cgit.kde.org . While the interface is not the best, it serves its purpose and it’s lightweight.
On cgit.kde.org, I press Ctrl+F
to find the project’s repository. It’s available here .
We’ll need to copy the link portrayed on the screenshot, it’s in the bottom left corner of the page. You can either select it or right-click and copy its address.
Next we’ll be using a terminal command. Don’t worry, it’s easy to follow and it’s minimal too. For this I like using Yakuake , sometimes I use Konsole , but for this tutorial, I’ll be using Dolphin to keep it more GUI-friendly.
Open a Dolphin window and press F4
to open its terminal. It should open on your home directory, so you can download the repository there, but with Dolphin you can simply navigate to the folder you want and clone the repository, for instance, inside ~/Documents/Patches
.
Please install git
if you don’t yet have it on your system. This is the only thing you’ll need to install.
After selecting the desired folder and pressing F4, download the repository using git using the previously copied link. It will look similar to the command git clone git://anongit.kde.org/gcompris.git
:
The above screenshot is only for illustration purposes, I cloned mine inside my home ( ~/
) folder.
After that, you should have something like the following screenshot.
Open the desired file with e.g. Kate and make the desired change. In my case, I need to change org.kde.gcompris.desktop
:
Don’t forget to save your changes. Now back to Dolphin, go back to its terminal and type git diff
. Yes, the same tool we used for downloading the repository we use to create the patch! Git is really the only requirement for this tutorial. You should have something like this:
The original text which was removed is shown in red and prefixed with a minus, the text added in its stead is shown in green and prefixed with a plus. Just be sure the changes you did are correctly depicted in green.
For the patch, as we will see later, you can simply copy what shows up in your terminal. But another way to do that is by creating a file and sending its contents instead. If you want to create a file, use git diff > filename.diff
. I used the extension .diff
, but it doesn’t really matter; you can name it .txt
or .patch
, for instance. For checking if everything is alright, you can then open it by right-clicking the file and opening it with Kate, or you can run kate gcompris.diff
as shown below.
Sending your patch
Let’s now go to Phabricator. Before submitting a patch, you’ll need a KDE Identity account . You don’t need to have a developer account. With a KDE Identity, you can login to Phabricator which is located on phabricator.kde.org .
After logging into Phabricator, click on Code Review on the upper left corner of the page.
On the next window, click on Create Diff on the upper right corner.
On the next window, if you want to send the diff file, click on the Browse...
button next to Raw Diff From File
and select the file.
If you don’t want to send a file but instead you just want to paste the diff itself, you can do so on the Raw Diff section. Just remember: choose ONE of those two methods. Don’t send the diff through both methods .
I’ll repeat: choose ONE of those two methods. Don’t send the diff through both methods .
Also important: Don’t forget to add the correct repository name . In my case, it was this one:
On the next window, simply accept the default for creating a new revision, confirm and go to the next window. It will look similarly to the following:
For the users following this tutorial from their mobile, here’s a better framed screenshot:
Fill each field accordingly. Add a descriptive title and a short summary explaining what the patch does, and in the reviewers, repository, tags and subscribers sections, add the correct project. Just by typing the program name Phabricator should suggest the correct project for you, just click on the one you think is right. Again, in my case, it was GCompris.
After filling the fields correctly, click on Create New Revision.
And done! Your patch will look similar to this:
That’s it for sending your first patch through the web interface of Phabricator. If your patch has any issues, those should be pointed out during the review stage by the more experienced contributors responsible for the project.
The most important thing that should be done is getting in touch with the community. If you want to know more about contributing, please read this very clear wiki page on Getting Involved . There’s Matrix , Telegram and IRC for instant messaging.
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。