Manual:Pywikibot/Gerrit

Terminology

 * Git - a version control system. Replaces SVN.
 * Gerrit - a code review platform (https://gerrit.wikimedia.org). Replaces Special:CodeReview
 * core - actual (master) branch formerly known as "rewrite".

Git clients

 * Windows users: We recommend you use [https://tortoisegit.org/ TortoiseGit] with [https://gitforwindows.org/ Git for Windows].  It's recommended to [https://tortoisegit.org/support/faq/#install install TortoiseGit first.]

For example in order to download core via commandline:
 * macOS/Linux: commandline git - https://git-scm.com/ or brew install git(Homebrew, macOS)

To update:

If you're lazy and want to be able to do that all at once, you can do:

Note that the repositories are somewhat large (~70MB). If this is an issue, use

to just retrieve the latest versions.

Using SVN
But wait...

I don't want to use Git.

Can I still use SVN? Yes!

But don't forget to configure and update i18n submodule separately.

Updating is as simple as

URLs
Your client will probably ask you for the repository url.

The urls follow the format of: .

So for core:

.

Nightly distributions
You can download the whole packages or browse the source code via [https://tools.wmflabs.org/pywikibot/ nightly distributor in Wikimedia Labs]

For developers
How to submit patches...configure git/gerrit. etc.

Read the 1>Special:MyLanguage/Manual:Pywikibot/Development/Guidelines|guidelines, then follow steps in  and run this:

and after modifying codes follow steps in 


 * Windows : Developer using Windows may also use </> for further informations.

Example (step-by-step)
Do the following, step-by-step:


 * 1) 1>Special:MyLanguage/Gerrit/Getting started</>|setup your software:


 * 1) if not done already for svn access; create an SSH key, a developer account and add your public key to gerrit as well as to wikitech


 * 1) install '<tvar|1>git</>' package


 * 1) install '<tvar|1>git-review</>' package
 * 2) * the one by openstack <tvar|1></>, NOT the one by Facebook
 * 3) * any version like 1.12, 1.21, but 1>Special:MyLanguage/Gerrit/git-review#"Could not parse json query response: u'Verified'"</>|NOT v1.18


 * 1) clone and setup your repo:


 * 1) clone the git repo with all submodules by using (like <tvar|1> </>) <tvar|2> </> and wait, this step will take some time


 * 1) enter the directory


 * 1) config git setting for this repo/directory only (not global, in case e.g. you have different pseudo for multiple projects) <tvar|1> </> and <tvar|2> </> in order to configure this globally, use the   parameter


 * 1) config your terminal/console to output english messages (in order to work properly with git review, see 1>Special:MyLanguage/Gerrit/git-review#Troubleshooting</>|Gerrit/git-review#Troubleshooting)   this has to be done every time a new console is started, in order to configure this permanently, put this into your   or similar setup file


 * 1) setup git review for this repo only   and enter your   again, this is an important step - if you forget it, according to 1>Special:MyLanguage/Gerrit/Tutorial#Push your change set to Gerrit</>|Gerrit/Tutorial#Push your change set to Gerrit, the final <tvar|2> </> below (needed to commit your changes for review) will fail - though this can be still solved then


 * 1) 1>Special:MyLanguage/Gerrit/Getting started</>|work with the repo, e.g. commit patches for review:


 * 1) switch to the master branch (might not be needed)


 * 1) update the current branch to revision online (like  )


 * 1) create your own local temporary branch for working   and try to choose a   with the help of the 1>Special:MyLanguage/Gerrit/Tutorial#Create a branch</>|branch naming tips available - the branch can be removed when not needed anymore with


 * 1) now write some code; see the 1>Special:MyLanguage/Gerrit/Tutorial</>|Git commands add, rm and mv to add, remove or rename files - when you're ready go to the next step


 * 1) commit your changes to your local temporary branch with <tvar|1> </> (you can use <tvar|2> </> instead of <tvar|3> </> and <tvar|4> </> instead of <tvar|5> </>) and, as used from svn, enter a meaningful commit message, e.g. a short description of your code changes
 * 1) * See <tvar|1></>.


 * 1) optionally check your changes by looking at the committed data <tvar|1> </> and make sure that you are sending what you wanted to


 * 1) send the data to the online repository, resp. 1>Special:MyLanguage/Gerrit/git-review#What happens when you submit a change</>|gerrit for review (like <tvar|2> </>) <tvar|3> </>


 * 1) finally go to [<tvar|url>https://gerrit.wikimedia.org</> Gerrit], click on your change and write a reviewer name in the input box near the "Add Reviewer" button


 * 1) optionally/opt-in further settings:


 * 1) * enable RCS keywords expansion (like svn:keywords <tvar|1> </>) by using git hooks (explained in detail [<tvar|url>https://github.com/progit/progit/blob/master/de/07-customizing-git/01-chapter7.markdown#schl%C3%BCsselworterweiterung</> here - german only])
 * 1) ** for core (rewrite):
 * 2) ** (may be we should consider using the [<tvar|url>https://github.com/turon/git-rcs-keywords</> git-rcs-keywords module] as mentioned in [<tvar|url2>https://stackoverflow.com/questions/62264/dealing-with-svn-keyword-expansion-with-git-svn/5633162#5633162</> dealing-with-svn-keyword-expansion-with-git-svn])

Phabricator
Patches will be linked to a <tvar|1></> task automatically if you mention 'Bug: T12345' in a line just before 'Change-Id: ....'.

See <tvar|1></> for more information.

jenkins-bot messages
https://integration.wikimedia.org/ci/job/pywikibot-core-tox-flake8/2591/console : FAILURE in ?s (non-voting)

The patchset committed did not pass flake8 code style checks.

That says nothing about the functionality of the code but about the syntax and style.

https://integration.wikimedia.org/ci/job/pywikibot-core-tox-flake8-docstrings-mandatory/560/console : FAILURE in ?s (non-voting)

The patchset committed did not pass mandatory <tvar|1>pep257</> code style checks.

That says nothing about the functionality of the code but about the inline documentation.

https://integration.wikimedia.org/ci/job/pywikibot-core-tox-nose/1448/console : FAILURE in ?s (non-voting)

The patchset committed did not pass pre-merge test suite.

That indicates the code fails the basic tests, but a pass says nothing about the functionality of the modified code.

There is a more extensive set of tests which developers should run pre-submission, and will run post merge.

This change could not be automatically merged with the current state of the repository. Please rebase your change and upload a new patchset.

The pachset cannot be merged automatically into current HEAD.

Please consider 1>Special:MyLanguage/Gerrit/Advanced usage#Build failed due to merge conflict</>|Gerrit/Advanced usage#Build failed due to merge conflict for a solution.

More info about this can be found in 1>Special:MyLanguage/Gerrit/Tutorial#How to submit a patch</>|Gerrit/Tutorial#How to submit a patch and 2>Special:MyLanguage/Gerrit/Tutorial#git review complains about multiple commits</>|Gerrit/Tutorial#git review complains about multiple commits.