Manual:Pywikibot/Gerrit

Pywikibot is currently moving to Gerrit! This is a simple FAQ/how-to page on what you need to do.

Terminology

 * Git - a version control system. Replaces SVN.
 * Gerrit - a code review platform (http://gerrit.wikimedia.org). Replaces Special:CodeReview
 * compat - formerly known as "trunk". If you're not sure, you probably use this.
 * core - formerly known as "rewrite".

Git clients
For example in order to download core via commandline:
 * Windows users: We recommend you use TortoiseGit
 * OSX/Linux: commandline git - http://git-scm.com/

To update:

If you're lazy and want to be able to do that all at once, you can do: (copied from ) [add '--global' to make this alias stick for all projects]

Be noticed these codes are a little big (just a little, for example compat is 170 MBs) because you're downloading the whole history of codes so if size of codes are important for you (e.g. because of hard disk limits in servers or low internet speed) you can simply clone shallow version of code, for example this command downloads only the last three revisions:

Using SVN
But wait... I don't want to use Git. Can I still use SVN? Yes! For this example, I'm going to use pwb-core, however you can easily switch compat in.

Updating is as simple as

Urls
Your client will probably ask you for the repository url. The urls follow the format of:.

So for compat:.

So for core:.

Nightly distributions
You can download the whole packages or brows in codes via nightly distributor in Wikimedia Labs

For developers
Follow steps in Gerrit/Getting started and run this: and after modifying codes follow steps in Gerrit/Tutorial
 * How to submit patches...configure git/gerrit. etc.

Example (step-by-step)
So for example if you want to work with compat (formerly known as trunk), do the following, step-by-step:
 * 1) setup your software:
 * 2) 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
 * 3) install 'git' package
 * 4) install 'git-review' package (the one by openstack, NOT the one by Facebook)
 * 5) clone and setup your repo:
 * 6) clone the git repo by using (like  )   and wait, this step will take some time
 * 7) enter the directory
 * 8) config git setting for this repo/directory only (not global, in case e.g. you have different pseudo for multiple projects)   and   in order to configure this globally, use the   parameter
 * 9) config your terminal/console to output english messages (in order to work properly with git review, see Gerrit/git-review)   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
 * 10) setup git review for this repo only   and enter your   again, this is an important step - if you forget it, according to Gerrit/Tutorial, the final   below (needed to commit your changes for review) will fail - though this can be still solved then
 * 11) work with the repo, e.g. commit patches for review:
 * 12) switch to the master branch (might not be needed)
 * 13) update the current branch to revision online (like  )
 * 14) create your own local temporary branch for working   and try to choose a   with the help of the branch naming tips available
 * 15) now write some code; see the Git commands add, rm and mv to add, remove or rename files - when you're ready go to the next step
 * 16) commit your changes to your local temporary branch with   (you can use   instead of   and   instead of  ) and, as used from svn, enter a meaningful commit message, e.g. a short description of your code changes
 * 17) optionally check your changes by looking at the committed data   and make sure that you are sending what you wanted to
 * 18) send the data to the online repository, resp. gerrit for review (like  )
 * 19) finally go to Gerrit, click on your change and write a reviewer name in the input box near the "Add Reviewer" button