Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

Commit Policy: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=Qt Commit Policy=
[[Category:Developing_Qt::Guidelines]]
 
= Qt Commit Policy =


These are the general rules for creating and pushing commits to any shared Qt repositories. As usual at Qt, none of these rules is set in stone, but you '''will''' be subject of public reprimand if you violate them without good reason.
These are the general rules for creating and pushing commits to any shared Qt repositories. As usual at Qt, none of these rules is set in stone, but you '''will''' be subject of public reprimand if you violate them without good reason.


# If you add new functions/classes:
# If you add new functions/classes:<br />## Ensure everything is documented properly.<br />## Follow the [[API Design Principles]]. Discuss and verify the names of functions/classes with other Qt developers (conduct API reviews).<br /># All code should follow the [[Coding Conventions]].<br /># For GUI code, follow the &quot;style guide&amp;quot;:http://techbase.kde.org/Projects/Usability/HIG , the [[Qt_Creator_Translation_Page|Qt Creator translation hints]] and avoid &quot;internationalization mistakes&amp;quot;:http://techbase.kde.org/Development/Tutorials/Localization/i18n_Mistakes.<br /># Ensure your change compiles and works on all platforms. The CI system will not allow your change to go in if it does not compile.<br /># Verify that there are no regressions in the unit tests (see [[Public Autotest Infrastructure]] for more info).<br /># Write new unit tests for the bugs you fixed or functionality you added.<br /># Make your new/changed code follow the [[Coding_Style | coding style]].<br /># Produce commits which facilitate reviews and contribute to a useful history which can be read, searched, annotated and cherry-picked. In particular:<br />## Make atomic commits. That means that each commit should contain exactly one self-contained change - do not mix unrelated changes, and do not create inconsistent states. Never &quot;hide&amp;quot; unrelated fixes in bigger commits. Make coding style fixes only in exactly the lines which contain the functional changes, and comment fixes only when they relate to the change - the rest is for a separate commit.<br />## Write descriptive commit messages. Make them self-contained, so people do not have to research the historical context to make sense of them. Conversely, do not put unnecessary trivia into them. Tell ''why'' you changed something unless it is completely self-evident; this is particularly important for reverts. Use the &quot;Qt commit template&amp;quot;:http://qt.gitorious.org/qt/qt5/blobs/dev/.commit-template. Follow the summary + description message style and use footers to reference JIRA issues, reviewers, etc. and consider the &quot;generic Git commit message guidelines&amp;quot;:http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html.<br />## Commit often. Use &lt;code&amp;gt;git gui&amp;lt;/code&amp;gt; and &lt;code&amp;gt;git rebase -i&amp;lt;/code&amp;gt; extensively to get your unpublished history into shape. Note that pushing to your private clone does ''not'' count as publishing and is a perfectly valid way to solicit an early review or to make a backup of a work in progress. Further reading: &quot;Understanding the Git Workflow&amp;quot;:http://sandofsky.com/blog/git-workflow.html<br />## Avoid unnecessary merges. Use &lt;code&amp;gt;git pull —rebase&amp;lt;/code&amp;gt; unless you have an unpushed &quot;proper&amp;quot; merge. Our Gerrit permits only trusted Merge Masters to push merge commits.<br /># Do not commit anything you do not understand. &quot;Somehow it suddenly works&amp;quot; is not acceptable. Reverting when a proper fix would be possible is admitting defeat. ;)<br /># Review your changes before you push to Gerrit. &lt;code&amp;gt;git log [—stat] [—summary] [-p] <code>{u}..&lt;/code&amp;gt; and &lt;code&amp;gt;gitk&amp;lt;/code&amp;gt; are your friends.<br /># Make sure you submit against the lowest applicable branch from which a release is still planned. Cherry-picks (&quot;backports&amp;quot;) are frowned upon, while forward-merging to more recent branches happens &quot;automatically&amp;quot; on a regular basis. '''Exception:''' As Qt 4 and Qt 5 live in separate repositories, changes ''must'' be applied to Qt 5 first (successfully merged; passed integration) and then be cherry-picked to Qt 4.<br /># Peer review is '''strongly''' encouraged. Do not approve your own changes. Discuss objections.<br />#* If there is no candidate for a review yet, introduce somebody to the code.<br />#* Maintainer privilege: A maintainer ''may'' approve his own change to the code he maintains if<br />#'''''' at least one review (+1) from somebody else is present, and<br />#'''''' nobody else who could approve (+2) the change can be produced within reasonable time<br /># Do not ignore/fight the [[Early Warning System]]. Justify each override.<br /># And most importantly: use your brain.
## Ensure everything is documented properly.
## Follow the [[API-Design-Principles|<span class="caps">API</span> Design Principles]]. Discuss and verify the names of functions/classes with other Qt developers (conduct <span class="caps">API</span> reviews).
# All code should follow the [[Coding-Conventions|Coding Conventions]].
# For <span class="caps">GUI</span> code, follow the [http://techbase.kde.org/Projects/Usability/HIG style guide] ''[techbase.kde.org]'' , the [[Qt Creator Translation Page|Qt Creator translation hints]] and avoid [http://techbase.kde.org/Development/Tutorials/Localization/i18n_Mistakes internationalization mistakes] ''[techbase.kde.org]''.
# Ensure your change compiles and works on all platforms. The CI system will not allow your change to go in if it does not compile.
# Verify that there are no regressions in the unit tests (see [[Public-Autotest-Infrastructure|Public Autotest Infrastructure]] for more info).
# Write new unit tests for the bugs you fixed or functionality you added.
# Make your new/changed code follow the [[Coding Style|coding style]].
# Produce commits which facilitate reviews and contribute to a useful history which can be read, searched, annotated and cherry-picked. In particular:
## Make atomic commits. That means that each commit should contain exactly one self-contained change do not mix unrelated changes, and do not create inconsistent states. Never “hide” unrelated fixes in bigger commits. Make coding style fixes only in exactly the lines which contain the functional changes, and comment fixes only when they relate to the change the rest is for a separate commit.
## Write descriptive commit messages. Make them self-contained, so people do not have to research the historical context to make sense of them. Conversely, do not put unnecessary trivia into them. Tell ''why'' you changed something unless it is completely self-evident; this is particularly important for reverts. Use the [http://qt.gitorious.org/qt/qt5/blobs/stable/.commit-template Qt commit template] ''[qt.gitorious.org]''. Follow the summary + description message style and use footers to reference <span class="caps">JIRA</span> issues, reviewers, etc. and consider the [http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html generic Git commit message guidelines] ''[tbaggery.com]''.
## Commit often. Use <code>git gui</code> and <code>git rebase -i</code> extensively to get your unpublished history into shape. Note that pushing to your private clone does ''not'' count as publishing and is a perfectly valid way to solicit an early review or to make a backup of a work in progress. Further reading: [http://sandofsky.com/blog/git-workflow.html Understanding the Git Workflow] ''[sandofsky.com]''
## Avoid unnecessary merges. Use <code>git pull —rebase</code> unless you have an unpushed “proper” merge. Our Gerrit permits only trusted Merge Masters to push merge commits.
# Do not commit anything you do not understand. “Somehow it suddenly works” is not acceptable. Reverting when a proper fix would be possible is admitting defeat. <span class="smiley">;)</span>
# Review your changes before you push to Gerrit. <code>git log [—stat] [—summary] [-p] @{u}..</code> and <code>gitk</code> are your friends.
# Make sure you submit against the lowest applicable branch from which a release is still planned. Cherry-picks (“backports”) are frowned upon, while forward-merging to more recent branches happens “automatically” on a regular basis. '''Exception:''' As Qt 4 and Qt 5 live in separate repositories, changes ''must'' be applied to Qt 5 first (successfully merged; passed integration) and then be cherry-picked to Qt 4.
# Peer review is '''strongly''' encouraged. Do not approve your own changes. Discuss objections.
## If there is no candidate for a review yet, introduce somebody to the code.
## Maintainer privilege: A maintainer ''may'' approve his own change to the code he maintains if
### at least one review (+1) from somebody else is present, and
### nobody else who could approve (+2) the change can be produced within reasonable time
# Do not ignore/fight the [[Early-Warning-System|Early Warning System]]. Justify each override.
# And most importantly: use your brain.
 
==Change Log==
 
If the change is significant and affects many users, compatibility or is a noteworthy feature, you must add a ChangeLog tag.
 
* A [ChangeLog] entry can be multiple lines long and ends with an empty newline.
* If the Git repository contains multiple modules, use the module name to indicate the area of the change e.g. [QtCore].
* Optionally specify a class or subtopic [QtNetwork][QSslSocket]
* Other common tags are:
** [General]
** [Important Behavior Changes]
** [Platform Specific Changes]
** [Windows]
** [OS X]
** [Linux/XCB]
* In summary the entry should look like this:<br /><code> [ChangeLog][module][class/topic] description of the really important<br /> change that was just made (on several lines).<br /></code>


==Additional notes==
== Change Log ==


* When you commit translations, use “make commit-ts” instead of “git commit” to keep the line number information out of the committed files.
If the change is significant and affects many users, compatibility, or is a noteworthy feature, you must add a ChangeLog tag. Conversely, do not ChangeLog entries that are not relevant to users.<br />* A [ChangeLog] entry can be multiple lines long and ends with an empty newline.<br />* Try to integrate the changelog entry into the surrounding commit message to avoid redundancy.<br />* If the Git repository contains multiple modules, use the module name to indicate the area of the change e.g. [QtCore].<br />* Optionally specify a class or subtopic [QtNetwork][QSslSocket]<br />* Other common tags are:<br />'''''' [General]<br />'''''' [Important Behavior Changes]<br />'''''' [Platform Specific Changes]<br />'''''' [Windows]<br />'''''' [OS X]<br />'''''' [Linux/XCB]<br />* In summary the entry should look like this:<br />&lt;code&amp;gt;<br /> [ChangeLog][module][class/topic] description of the really important<br />change that was just made (on several lines).<br />&lt;/code&amp;gt;<br />'''''' The description should use either simple past (&quot;Fixed …&quot;) or be explicit about refering to the current state (&quot;… does now …&quot;).<br />'''''' Make sure the entry is reasonably self-contained. If you fail to formulate a meaningful description, it's probably not useful information to start with.
* When you need configure.exe recompiled, let the designated “compile master” (currenly Oswald.Buddenhagen at digia.com, ossi|tt on <span class="caps">IRC</span>) do that for you in a separate commit. We try to batch recompiles and always do them in the same build configuration to keep the git repository bloat down.
* For non-native English speakers who’d like any written English (code comments and documentation in general) to be reviewed, feel free to add one of the people listed under the Approvers and Editors section [[:Category:Developing Qt::Documentation|here]] ''[qt.io]''.


===Categories:===
== Additional notes ==


* [[:Category:Developing Qt|Developing_Qt]]
* When you commit translations, use &quot;make commit-ts&amp;quot; instead of &quot;git commit&amp;quot; to keep the line number information out of the committed files.
** [[:Category:Developing Qt::Guidelines|Guidelines]]
* When you need configure.exe recompiled, let the designated &quot;compile master&amp;quot; (currenly Oswald.Buddenhagen at digia.com, ossi|tt on IRC) do that for you in a separate commit. We try to batch recompiles and always do them in the same build configuration to keep the git repository bloat down.

Revision as of 09:22, 24 February 2015


Qt Commit Policy

These are the general rules for creating and pushing commits to any shared Qt repositories. As usual at Qt, none of these rules is set in stone, but you will be subject of public reprimand if you violate them without good reason.

  1. If you add new functions/classes:
    ## Ensure everything is documented properly.
    ## Follow the API Design Principles. Discuss and verify the names of functions/classes with other Qt developers (conduct API reviews).
    # All code should follow the Coding Conventions.
    # For GUI code, follow the "style guide&quot;:http://techbase.kde.org/Projects/Usability/HIG , the Qt Creator translation hints and avoid "internationalization mistakes&quot;:http://techbase.kde.org/Development/Tutorials/Localization/i18n_Mistakes.
    # Ensure your change compiles and works on all platforms. The CI system will not allow your change to go in if it does not compile.
    # Verify that there are no regressions in the unit tests (see Public Autotest Infrastructure for more info).
    # Write new unit tests for the bugs you fixed or functionality you added.
    # Make your new/changed code follow the coding style.
    # Produce commits which facilitate reviews and contribute to a useful history which can be read, searched, annotated and cherry-picked. In particular:
    ## Make atomic commits. That means that each commit should contain exactly one self-contained change - do not mix unrelated changes, and do not create inconsistent states. Never "hide&quot; unrelated fixes in bigger commits. Make coding style fixes only in exactly the lines which contain the functional changes, and comment fixes only when they relate to the change - the rest is for a separate commit.
    ## Write descriptive commit messages. Make them self-contained, so people do not have to research the historical context to make sense of them. Conversely, do not put unnecessary trivia into them. Tell why you changed something unless it is completely self-evident; this is particularly important for reverts. Use the "Qt commit template&quot;:http://qt.gitorious.org/qt/qt5/blobs/dev/.commit-template. Follow the summary + description message style and use footers to reference JIRA issues, reviewers, etc. and consider the "generic Git commit message guidelines&quot;:http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html.
    ## Commit often. Use <code&gt;git gui&lt;/code&gt; and <code&gt;git rebase -i&lt;/code&gt; extensively to get your unpublished history into shape. Note that pushing to your private clone does not count as publishing and is a perfectly valid way to solicit an early review or to make a backup of a work in progress. Further reading: "Understanding the Git Workflow&quot;:http://sandofsky.com/blog/git-workflow.html
    ## Avoid unnecessary merges. Use <code&gt;git pull —rebase&lt;/code&gt; unless you have an unpushed "proper&quot; merge. Our Gerrit permits only trusted Merge Masters to push merge commits.
    # Do not commit anything you do not understand. "Somehow it suddenly works&quot; is not acceptable. Reverting when a proper fix would be possible is admitting defeat. ;)
    # Review your changes before you push to Gerrit. <code&gt;git log [—stat] [—summary] [-p] {u}..</code&gt; and <code&gt;gitk&lt;/code&gt; are your friends.
    # Make sure you submit against the lowest applicable branch from which a release is still planned. Cherry-picks ("backports&quot;) are frowned upon, while forward-merging to more recent branches happens "automatically&quot; on a regular basis. Exception: As Qt 4 and Qt 5 live in separate repositories, changes must be applied to Qt 5 first (successfully merged; passed integration) and then be cherry-picked to Qt 4.
    # Peer review is strongly encouraged. Do not approve your own changes. Discuss objections.
    #* If there is no candidate for a review yet, introduce somebody to the code.
    #* Maintainer privilege: A maintainer may approve his own change to the code he maintains if
    #' at least one review (+1) from somebody else is present, and
    #'
    nobody else who could approve (+2) the change can be produced within reasonable time
    # Do not ignore/fight the Early Warning System. Justify each override.
    # And most importantly: use your brain.

Change Log

If the change is significant and affects many users, compatibility, or is a noteworthy feature, you must add a ChangeLog tag. Conversely, do not ChangeLog entries that are not relevant to users.
* A [ChangeLog] entry can be multiple lines long and ends with an empty newline.
* Try to integrate the changelog entry into the surrounding commit message to avoid redundancy.
* If the Git repository contains multiple modules, use the module name to indicate the area of the change e.g. [QtCore].
* Optionally specify a class or subtopic [QtNetwork][QSslSocket]
* Other common tags are:
' [General]
'
[Important Behavior Changes]
' [Platform Specific Changes]
'
[Windows]
' [OS X]
'
[Linux/XCB]
* In summary the entry should look like this:
<code&gt;
[ChangeLog][module][class/topic] description of the really important
change that was just made (on several lines).
</code&gt;
' The description should use either simple past ("Fixed …") or be explicit about refering to the current state ("… does now …").
'
Make sure the entry is reasonably self-contained. If you fail to formulate a meaningful description, it's probably not useful information to start with.

Additional notes

  • When you commit translations, use "make commit-ts&quot; instead of "git commit&quot; to keep the line number information out of the committed files.
  • When you need configure.exe recompiled, let the designated "compile master&quot; (currenly Oswald.Buddenhagen at digia.com, ossi|tt on IRC) do that for you in a separate commit. We try to batch recompiles and always do them in the same build configuration to keep the git repository bloat down.