Manual:Pywikibot/Gerrit
Pywikibot logo |
Pywikibot |
---|
|
v · d · e |
Terminology
[edit ]- 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".
For users
[edit ]Git clients
[edit ]- Windows users: We recommend you use TortoiseGit with Git for Windows. It's recommended to install TortoiseGit first.
- macOS/Linux: commandline git - https://git-scm.com/ or
brew install git
(Homebrew, macOS)
For example in order to download core via command line:
$ gitclone--recurse-submodules--branchstablehttps://gerrit.wikimedia.org/r/pywikibot/core.git
To update:
# Assumingyou'realreadyin"core": $ gitpulloriginstable $ gitsubmoduleupdate# Updates i18n messages
If you're lazy and want to be able to do that all at once, you can do:
# Assumingyou'realreadyin"core": $ gitpulloriginstable--recurse-submodules# This updates everything
Note that the repositories are somewhat large (>100MB). If this is an issue, use the following command to just retrieve the latest versions:
$ gitclone--recurse-submodules--branchstable--depth3https://gerrit.wikimedia.org/r/pywikibot/core.git
Using SVN
[edit ]As of January 2024, it is no longer possible to use SVN to download Pywikibot. We suggest to use pip to install and update Pywikibot instead.
URLs
[edit ]Your client will probably ask you for the repository url.
The urls follow the format of:
https://gerrit.wikimedia.org/r/pywikibot/[repo name]
.
So for core:
https://gerrit.wikimedia.org/r/pywikibot/core
.
Nightly distributions
[edit ]You can download the whole packages or browse the source code via download page in Toolforge
- If you need more help on setting up your Pywikibot visit the #pywikibot IRC channel connect or pywikibot@ mailing list.
For developers
[edit ]To submit patches, first configure git/gerrit. etc.
Follow the steps in Gerrit/Getting started , and read the guidelines. Then:
$ gitclone--recurse-submoduleshttps://gerrit.wikimedia.org/r/pywikibot/core.
If you get stuck, check the longer version of the tutorial at Gerrit/Tutorial
- Windows
- Developer using Windows may also use Gerrit/TortoiseGit tutorial for further informations.
Example (step-by-step)
[edit ]Do the following, step-by-step:
- setup your software:
- clone and setup your repository:
- clone the git repository with all submodules by using (like
svn checkout
)and wait, this step will take some time$ gitclone--recurse-submoduleshttps://gerrit.wikimedia.org/r/pywikibot/corepywikibot-git
- enter the directory
$ cdpywikibot-git
- config git setting for this repository/directory only (not global, in case e.g. you have different pseudo for multiple projects) and
$ gitconfiguser.email"EMAIL"
in order to configure this globally, use the$ gitconfiguser.name"USERNAME"
--global
parameter - config your terminal/console to output english messages (in order to work properly with git review, see 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
$ aliasgit="LANG=C git"
bashrc
or similar setup file - setup git review for this repository only and enter your
$ gitreview-s
USERNAME
again, this is an important step - if you forget it, according to Gerrit/Tutorial#Push your change set to Gerrit, the finalgit review
below (needed to commit your changes for review) will fail - though this can be still solved then
- clone the git repository with all submodules by using (like
- work with the repository, e.g. commit patches for review:
- switch to the master branch (might not be needed)
$ gitcheckoutmaster
- update the current branch to revision online (like
svn update
)$ gitpull
- create your own local temporary branch for working
$ git checkout -b MEANINGFUL_BRANCH_NAME
and try to choose aMEANINGFUL_BRANCH_NAME
with the help of the branch naming tips available – the branch can be removed when not needed anymore with$ git branch -D MEANINGFUL_BRANCH_NAME
- 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
- commit your changes to your local temporary branch with (you can use
$ gitcommit--all
-a
instead of--all
and-R
instead of--no-rebase
) and, as used from svn, enter a meaningful commit message, e.g. a short description of your code changes - optionally check your changes by looking at the committed data and make sure that you are sending what you wanted to
$ gitshowHEAD
- send the data to the online repository, resp. gerrit for review (like
svn commit
)$ gitreview
- finally go to Gerrit, click on your change and write a reviewer name in the input box near the "Add Reviewer" button
- switch to the master branch (might not be needed)
- optionally/opt-in further settings:
- enable RCS keywords expansion (like svn:keywords
$Id$
) by using git hooks (explained in detail here - german only)- for core:
$ gitconfigfilter.rcs-keywords.smudge'rcs-keywords.py %f'
$ gitconfigfilter.rcs-keywords.clean'rcs-keywords.py'
- (may be we should consider using the git-rcs-keywords module as mentioned in dealing-with-svn-keyword-expansion-with-git-svn)
- for core:
- enable RCS keywords expansion (like svn:keywords
Phabricator
[edit ]Patches will be linked to a Phabricator task automatically if you mention 'Bug: T12345' in a line just before 'Change-Id: ....'. See Gerrit/Commit message guidelines for more information.
Problems, issues and work-a-rounds
[edit ]jenkins-bot messages
[edit ]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 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 Build failed due to merge conflict for a solution.
More info about this can be found in Gerrit/Tutorial#How to submit a patch and git review complains about multiple commits.