git.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. =================================
  2. The Django source code repository
  3. =================================
  4. When deploying a Django application into a real production environment, you
  5. will almost always want to use `an official packaged release of Django`_.
  6. However, if you'd like to try out in-development code from an upcoming release
  7. or contribute to the development of Django, you'll need to obtain a clone of
  8. Django's source code repository.
  9. This document covers the way the code repository is laid out and how to work
  10. with and find things in it.
  11. .. _an official packaged release of Django: https://www.djangoproject.com/download/
  12. High-level overview
  13. ===================
  14. The Django source code repository uses `Git`_ to track changes to the code
  15. over time, so you'll need a copy of the Git client (a program called ``git``)
  16. on your computer, and you'll want to familiarize yourself with the basics of
  17. how Git works.
  18. Git's web site offers downloads for various operating systems. The site also
  19. contains vast amounts of `documentation`_.
  20. The Django Git repository is located online at `github.com/django/django
  21. <https://github.com/django/django>`_. It contains the full source code for all
  22. Django releases, which you can browse online.
  23. The Git repository includes several `branches`_:
  24. * ``master`` contains the main in-development code which will become
  25. the next packaged release of Django. This is where most development
  26. activity is focused.
  27. * ``stable/A.B.x`` are the branches where release preparation work happens.
  28. They are also used for support and bugfix releases which occur as necessary
  29. after the initial release of a major or minor version.
  30. * ``soc20XX/<project>`` branches were used by students who worked on Django
  31. during the 2009 and 2010 Google Summer of Code programs.
  32. * ``attic/<project>`` branches were used to develop major or experimental new
  33. features without affecting the rest of Django's code.
  34. The Git repository also contains `tags`_. These are the exact revisions from
  35. which packaged Django releases were produced, since version 1.0.
  36. The source code for the `Djangoproject.com <https://www.djangoproject.com/>`_ web
  37. site can be found at `github.com/django/djangoproject.com
  38. <https://github.com/django/djangoproject.com>`_.
  39. .. _Git: http://git-scm.com/
  40. .. _documentation: http://git-scm.com/documentation
  41. .. _branches: https://github.com/django/django/branches
  42. .. _tags: https://github.com/django/django/tags
  43. The master branch
  44. =================
  45. If you'd like to try out the in-development code for the next release of
  46. Django, or if you'd like to contribute to Django by fixing bugs or developing
  47. new features, you'll want to get the code from the master branch.
  48. Note that this will get *all* of Django: in addition to the top-level
  49. ``django`` module containing Python code, you'll also get a copy of Django's
  50. documentation, test suite, packaging scripts and other miscellaneous bits.
  51. Django's code will be present in your clone as a directory named
  52. ``django``.
  53. To try out the in-development code with your own applications, simply place
  54. the directory containing your clone on your Python import path. Then
  55. ``import`` statements which look for Django will find the ``django`` module
  56. within your clone.
  57. If you're going to be working on Django's code (say, to fix a bug or
  58. develop a new feature), you can probably stop reading here and move
  59. over to :doc:`the documentation for contributing to Django
  60. </internals/contributing/index>`, which covers things like the preferred
  61. coding style and how to generate and submit a patch.
  62. Other branches
  63. ==============
  64. Django uses branches to prepare for releases of Django (whether they be
  65. :term:`major <Major release>` or :term:`minor <Minor release>`).
  66. In the past when Django was hosted on Subversion, branches were also used for
  67. feature development. Now Django is hosted on Git and feature development is
  68. done on contributor's forks, but the Subversion feature branches remain in Git
  69. for historical reference.
  70. Stable branches
  71. ---------------
  72. These branches can be found in the repository as ``stable/A.B.x``
  73. branches and will be created right after the first alpha is tagged.
  74. For example, immediately after *Django 1.5 alpha 1* was tagged, the branch
  75. ``stable/1.5.x`` was created and all further work on preparing the code for the
  76. final 1.5 release was done there.
  77. These branches also provide limited bugfix support for the most recent released
  78. version of Django and security support for the two most recently-released
  79. versions of Django.
  80. For example, after the release of Django 1.5, the branch ``stable/1.5.x``
  81. receives only fixes for security and critical stability bugs, which are
  82. eventually released as Django 1.5.1 and so on, ``stable/1.4.x`` receives only
  83. security fixes, and ``stable/1.3.x`` no longer receives any updates.
  84. .. admonition:: Historical information
  85. This policy for handling ``stable/A.B.x`` branches was adopted starting
  86. with the Django 1.5 release cycle.
  87. Previously, these branches weren't created until right after the releases
  88. and the stabilization work occurred on the main repository branch. Thus,
  89. no new features development work for the next release of Django could be
  90. committed until the final release happened.
  91. For example, shortly after the release of Django 1.3 the branch
  92. ``stable/1.3.x`` was created. Official support for that release has expired,
  93. and so it no longer receives direct maintenance from the Django project.
  94. However, that and all other similarly named branches continue to exist and
  95. interested community members have occasionally used them to provide
  96. unofficial support for old Django releases.
  97. Feature-development branches
  98. ----------------------------
  99. .. admonition:: Historical information
  100. Since Django moved to Git in 2012, anyone can clone the repository and
  101. create their own branches, alleviating the need for official branches in
  102. the source code repository.
  103. The following section is mostly useful if you're exploring the repository's
  104. history, for example if you're trying to understand how some features were
  105. designed.
  106. Feature-development branches tend by their nature to be temporary. Some
  107. produce successful features which are merged back into Django's master to
  108. become part of an official release, but others do not; in either case there
  109. comes a time when the branch is no longer being actively worked on by any
  110. developer. At this point the branch is considered closed.
  111. Unfortunately, Django used to be maintained with the Subversion revision
  112. control system, that has no standard way of indicating this. As a workaround,
  113. branches of Django which are closed and no longer maintained were moved into
  114. ``attic``.
  115. For reference, the following are branches whose code eventually became
  116. part of Django itself, and so are no longer separately maintained:
  117. * ``boulder-oracle-sprint``: Added support for Oracle databases to
  118. Django's object-relational mapper. This has been part of Django
  119. since the 1.0 release.
  120. * ``gis``: Added support for geographic/spatial queries to Django's
  121. object-relational mapper. This has been part of Django since the 1.0
  122. release, as the bundled application ``django.contrib.gis``.
  123. * ``i18n``: Added :doc:`internationalization support </topics/i18n/index>` to
  124. Django. This has been part of Django since the 0.90 release.
  125. * ``magic-removal``: A major refactoring of both the internals and
  126. public APIs of Django's object-relational mapper. This has been part
  127. of Django since the 0.95 release.
  128. * ``multi-auth``: A refactoring of :doc:`Django's bundled
  129. authentication framework </topics/auth/index>` which added support for
  130. :ref:`authentication backends <authentication-backends>`. This has
  131. been part of Django since the 0.95 release.
  132. * ``new-admin``: A refactoring of :doc:`Django's bundled
  133. administrative application </ref/contrib/admin/index>`. This became part of
  134. Django as of the 0.91 release, but was superseded by another
  135. refactoring (see next listing) prior to the Django 1.0 release.
  136. * ``newforms-admin``: The second refactoring of Django's bundled
  137. administrative application. This became part of Django as of the 1.0
  138. release, and is the basis of the current incarnation of
  139. ``django.contrib.admin``.
  140. * ``queryset-refactor``: A refactoring of the internals of Django's
  141. object-relational mapper. This became part of Django as of the 1.0
  142. release.
  143. * ``unicode``: A refactoring of Django's internals to consistently use
  144. Unicode-based strings in most places within Django and Django
  145. applications. This became part of Django as of the 1.0 release.
  146. When Django moved from SVN to Git, the information about branch merges wasn't
  147. preserved in the source code repository. This means that the ``master`` branch
  148. of Django doesn't contain merge commits for the above branches.
  149. However, this information is `available as a grafts file`_. You can restore it
  150. by putting the following lines in ``.git/info/grafts`` in your local clone::
  151. ac64e91a0cadc57f4bc5cd5d66955832320ca7a1 553a20075e6991e7a60baee51ea68c8adc520d9a 0cb8e31823b2e9f05c4ae868c19f5f38e78a5f2e
  152. 79e68c225b926302ebb29c808dda8afa49856f5c d0f57e7c7385a112cb9e19d314352fc5ed5b0747 aa239e3e5405933af6a29dac3cf587b59a099927
  153. 5cf8f684237ab5addaf3549b2347c3adf107c0a7 cb45fd0ae20597306cd1f877efc99d9bd7cbee98 e27211a0deae2f1d402537f0ebb64ad4ccf6a4da
  154. f69cf70ed813a8cd7e1f963a14ae39103e8d5265 d5dbeaa9be359a4c794885c2e9f1b5a7e5e51fb8 d2fcbcf9d76d5bb8a661ee73dae976c74183098b
  155. aab3a418ac9293bb4abd7670f65d930cb0426d58 4ea7a11659b8a0ab07b0d2e847975f7324664f10 adf4b9311d5d64a2bdd58da50271c121ea22e397
  156. ff60c5f9de3e8690d1e86f3e9e3f7248a15397c8 7ef212af149540aa2da577a960d0d87029fd1514 45b4288bb66a3cda401b45901e85b645674c3988
  157. 9dda4abee1225db7a7b195b84c915fdd141a7260 4fe5c9b7ee09dc25921918a6dbb7605edb374bc9 3a7c14b583621272d4ef53061287b619ce3c290d
  158. a19ed8aea395e8e07164ff7d85bd7dff2f24edca dc375fb0f3b7fbae740e8cfcd791b8bccb8a4e66 42ea7a5ce8aece67d16c6610a49560c1493d4653
  159. 9c52d56f6f8a9cdafb231adf9f4110473099c9b5 c91a30f00fd182faf8ca5c03cd7dbcf8b735b458 4a5c5c78f2ecd4ed8859cd5ac773ff3a01bccf96
  160. 953badbea5a04159adbfa970f5805c0232b6a401 4c958b15b250866b70ded7d82aa532f1e57f96ae 5664a678b29ab04cad425c15b2792f4519f43928
  161. 471596fc1afcb9c6258d317c619eaf5fd394e797 4e89105d64bb9e04c409139a41e9c7aac263df4c 3e9035a9625c8a8a5e88361133e87ce455c4fc13
  162. 9233d0426537615e06b78d28010d17d5a66adf44 6632739e94c6c38b4c5a86cf5c80c48ae50ac49f 18e151bc3f8a85f2766d64262902a9fcad44d937
  163. .. _available as a grafts file: https://github.com/ramiro/django-git-grafts
  164. Additionally, the following branches are closed, but their code was
  165. never merged into Django and the features they aimed to implement
  166. were never finished:
  167. * ``full-history``
  168. * ``generic-auth``
  169. * ``multiple-db-support``
  170. * ``per-object-permissions``
  171. * ``schema-evolution``
  172. * ``schema-evolution-ng``
  173. * ``search-api``
  174. * ``sqlalchemy``
  175. All of the above-mentioned branches now reside in ``attic``.
  176. Finally, the repository contains ``soc2009/xxx`` and ``soc2010/xxx`` feature
  177. branches, used for Google Summer of Code projects.
  178. Tags
  179. ====
  180. Each Django release is tagged and signed by a :ref:`releaser
  181. <releasers-list>`.
  182. The tags can be found on GitHub's `tags`_ page.
  183. .. _tags: https://github.com/django/django/tags