PageRenderTime 46ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/docs/build/index.html

https://bitbucket.org/nautilebleu/django_hg/
HTML | 210 lines | 197 code | 13 blank | 0 comment | 0 complexity | a58d88f35029e78f2ffde0ee9767563f MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <title>Documentation > Index</title>
  6. <link rel="stylesheet" href="css/screen.css" />
  7. <link rel="stylesheet" href="css/codehilite.css" />
  8. <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
  9. <script src="js/referencrz.js" type="text/javascript"></script>
  10. </head>
  11. <body id="body">
  12. <div id="body-header" class="admin">
  13. <h1><a href="index.html">Documentation</a></h1>
  14. </div>
  15. <div id="body-content">
  16. <div id="sf_admin_container">
  17. <div class="toc">
  18. <ul>
  19. <li><a href="#using-django_hg">Using django_hg</a><ul>
  20. <li><a href="#why-use-django_hg">Why use django_hg ?</a></li>
  21. <li><a href="#install">Install</a></li>
  22. <li><a href="#usage">Usage</a><ul>
  23. <li><a href="#administration">Administration</a></li>
  24. <li><a href="#public">Public</a><ul>
  25. <li><a href="#list">List</a></li>
  26. <li><a href="#repository">Repository</a></li>
  27. <li><a href="#file">File</a></li>
  28. </ul>
  29. </li>
  30. <li><a href="#hg-commands-clone-push-and-pull">Hg commands (clone, push and pull)</a></li>
  31. </ul>
  32. </li>
  33. <li><a href="#templating">Templating</a></li>
  34. <li><a href="#deployment">Deployment</a></li>
  35. <li><a href="#to-dos">To-dos</a></li>
  36. <li><a href="#requirements">Requirements</a></li>
  37. </ul>
  38. </li>
  39. </ul>
  40. </div>
  41. <h1 id="using-django_hg">Using django_hg</h1>
  42. <h2 id="why-use-django_hg">Why use django_hg ?</h2>
  43. <p><a href="http://bitbucket.org/nautilebleu/django_hg/">django_hg [en]</a> aims to allow browsing a <a href="http://selenic.com/mercurial/">Mercurial [en]</a> repository into a <a href="http://djangoproject.com/">django [en]</a> project.</p>
  44. <p>Even if Mercurial has a built-in webserver, I think there's room for a
  45. django-integrated solution:</p>
  46. <ul>
  47. <li>better integration with other components of the website, especially for the
  48. graphics. django templates are much easy to understand than Mercurial
  49. templates.</li>
  50. <li>allow to browse more than one repository, without installing <code>hgwebdir.cgi</code>.</li>
  51. <li>django authentication</li>
  52. <li>links with a django-powered bug tracker such as
  53. <a href="http://opensource.washingtontimes.com/projects/django-projectmgr/">django-projectmgr [en]</a> (to-do)</li>
  54. </ul>
  55. <p>Currently, this project is in his early stages of development and not all
  56. features of the Mercurial integrated webserver are implemented. If you need an
  57. out-of-box ready solution, you should currently use Mercurial built-in
  58. webserver. You may want to read <a href="http://hgbook.red-bean.com/">Mercurial: The Definitive Guide [en]</a>,
  59. and especially the <a href="http://hgbook.red-bean.com/read/collaborating-with-other-people.html">Chapter 6 [en]</a>, for more informations about
  60. configuring Mercurial webserver.</p>
  61. <h2 id="install">Install</h2>
  62. <p>django_hg follows <a href="http://ericholscher.com/projects/django-conventions/app/">django reusable apps conventions [en]</a>
  63. and install is quite easy:</p>
  64. <p>Clone <code>django_hg</code> from <a href="http://bitbucket.org/">bitbucket [en]</a> somewhere in your
  65. <code>PYTHONPATH</code>:</p>
  66. <div class="codehilite"><pre><span class="nv">$ </span>hg clone https://bitbucket.org/nautilebleu/django_hg/ django_hg
  67. </pre></div>
  68. <p>Configure your <code>settings.py</code>:</p>
  69. <div class="codehilite"><pre><span class="c"># /PROJECT/APP/settings.py</span>
  70. <span class="c"># django_hg settings</span>
  71. <span class="n">DJANGO_HG_REPOSITORIES_DIR</span> <span class="o">=</span> <span class="p">{</span>
  72. <span class="s">&quot;public&quot;</span><span class="p">:</span> <span class="s">&quot;/Users/goulwen/Repositories/public/&quot;</span><span class="p">,</span>
  73. <span class="s">&quot;private&quot;</span><span class="p">:</span> <span class="s">&quot;/Users/goulwen/Repositories/private/&quot;</span>
  74. <span class="p">}</span>
  75. <span class="n">DJANGO_HG_PAGER_ITEMS</span> <span class="o">=</span> <span class="mf">30</span>
  76. <span class="c"># one of pygment styles : autumn, borland, bw, colorful, default, emacs,</span>
  77. <span class="c"># friendly, fruity, manni, murphy, native, pastie, perldoc, tango, trac, vim,</span>
  78. <span class="c"># vs</span>
  79. <span class="n">DJANGO_HG_PYGMENT_STYLE</span> <span class="o">=</span> <span class="s">&#39;tango&#39;</span>
  80. <span class="c"># The maximum of search results returned when performing a search in a repository</span>
  81. <span class="n">DJANGO_HG_MAX_SEARCH_RESULTS</span> <span class="o">=</span> <span class="mf">100</span>
  82. <span class="c"># templates dir</span>
  83. <span class="n">TEMPLATE_DIRS</span> <span class="o">=</span> <span class="p">(</span>
  84. <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">),</span> <span class="s">&#39;templates&#39;</span><span class="p">),</span>
  85. <span class="s">&#39;/Users/goulwen/Dev/Python/django_hg/templates&#39;</span><span class="p">,</span>
  86. <span class="p">)</span>
  87. <span class="c"># if not already done, add the DJANGO.CORE.CONTEXT_PROCESSORS.REQUEST and</span>
  88. <span class="c"># the DJANGO.CORE.CONTEXT_PROCESSORS.MEDIA to settings</span>
  89. <span class="n">TEMPLATE_CONTEXT_PROCESSORS</span> <span class="o">=</span> <span class="p">(</span>
  90. <span class="s">&#39;django.core.context_processors.request&#39;</span><span class="p">,</span>
  91. <span class="s">&#39;django.core.context_processors.media&#39;</span><span class="p">,</span>
  92. <span class="p">)</span>
  93. <span class="c"># add to installed apps</span>
  94. <span class="n">INSTALLED_APPS</span> <span class="o">=</span> <span class="p">(</span>
  95. <span class="c"># </span>
  96. <span class="s">&#39;django_hg&#39;</span><span class="p">,</span>
  97. <span class="p">)</span>
  98. </pre></div>
  99. <p>Configure your project's <code>urls.py</code>:</p>
  100. <div class="codehilite"><pre><span class="c"># /PROJECT/urls.py</span>
  101. <span class="n">urlpatterns</span> <span class="o">=</span> <span class="n">patterns</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">,</span>
  102. <span class="c"># </span>
  103. <span class="p">(</span><span class="s">r&#39;^hg/&#39;</span><span class="p">,</span> <span class="n">include</span><span class="p">(</span><span class="s">&#39;django_hg.urls&#39;</span><span class="p">)),</span>
  104. <span class="p">)</span>
  105. </pre></div>
  106. <p>That's it.</p>
  107. <p>You can now run the django built-in webserver:</p>
  108. <div class="codehilite"><pre><span class="nv">$ </span>python manage.py runserver
  109. </pre></div>
  110. <h2 id="usage">Usage</h2>
  111. <h3 id="administration">Administration</h3>
  112. <p>Repositories can be created in django_hg using the admin module within the
  113. django admin site.</p>
  114. <p>You can import a repository by putting it in the folder of your choice (public
  115. or private) and then create a repository object with the same name in the admin.</p>
  116. <p>Because django <code>SlugField</code> are restricted to letters, numbers, underscores and
  117. hyphens, the name of the repository root folder must match these restrictions.</p>
  118. <p>For exemple, <code>mozilla-1.9.1</code> is not a valid name, but <code>mozilla-1_9_1</code> is.</p>
  119. <p>django_hg allows setting permissions to users throught an inline form. There's 3
  120. roles <code>Read</code>, <code>Read/Write</code> and <code>Owner</code>. These roles are used for displaying
  121. repositories in browsers and when handling commands like <code>clone</code>, <code>push</code> and
  122. <code>pull</code>.</p>
  123. <h3 id="public">Public</h3>
  124. <h4 id="list">List</h4>
  125. <p>django_hg lets you browse a list of repositories, depending of the user
  126. permissions:</p>
  127. <ul>
  128. <li>If the user is anonymous, only public repositories are displayed.</li>
  129. <li>If the user is authenticated, private repositories where the user has role are
  130. displayed, plus public ones.</li>
  131. </ul>
  132. <p>A search facility is available. Currently, search looks in repositories' title
  133. and summary, but not in the source code or the changelog.</p>
  134. <p>Results can also be filtered using current user permissions, so only
  135. repositories he owned are displayed, for example.</p>
  136. <h4 id="repository">Repository</h4>
  137. <p>When accessing a repository, you can display 3 differents views:</p>
  138. <ul>
  139. <li>The <code>overview</code> view summarizes the repository, showing the latest changeset
  140. (aka <code>tip</code> in Mercurial, people involved in the project. This page will evolve
  141. in the next weeks to be raffined.</li>
  142. <li>The <code>browse</code> view displays the repository at a given revision (<code>tip</code> by default)</li>
  143. <li>The <code>changesets</code>view diplays the list of revisions of the repository.
  144. You can browse the repository at a given revision or display the changelog
  145. details.</li>
  146. </ul>
  147. <h4 id="file">File</h4>
  148. <p>From the <code>browse</code> and the <code>changeset</code> views, repository files can be accessed:</p>
  149. <ul>
  150. <li>The <code>log</code> view displays changes history of the file.</li>
  151. <li>The <code>view</code> view shows the file, depending of its mimetype:</li>
  152. <li>If a <a href="http://pygments.org">Pygments [en]</a> lexer can be found, the file is displayed
  153. with syntax coloration</li>
  154. <li>If the mimetype corresponds to a picture (PNG, GIF, JPEG) or a PDF, the file
  155. is displayed</li>
  156. <li>Otherwise, you can download it or force the display a plain text.</li>
  157. <li>The <code>diff</code> view will allow the comparison between two revisions, but is far
  158. from being operational yet.</li>
  159. </ul>
  160. <h3 id="hg-commands-clone-push-and-pull">Hg commands (clone, push and pull)</h3>
  161. <p>django_hg supports <code>clone</code>, <code>push</code> and <code>pull</code> over HTTP throught django,
  162. including authentication.</p>
  163. <h2 id="templating">Templating</h2>
  164. <p>django_hg tries to follow
  165. <a href="http://ericholscher.com/projects/django-conventions/app/">django reusable apps conventions [en]</a> in naming of
  166. blocks.</p>
  167. <p>A simple CSS is provided in the <code>site_media</code> directory. Feel free to</p>
  168. <h2 id="deployment">Deployment</h2>
  169. <p>Because django_hg relies on wsgi objects to performs Mercurial commands, django
  170. must be deployed throught <a href="http://docs.djangoproject.com/en/1.0/howto/deployment/modwsgi/">mod_wsgi [en]</a>.</p>
  171. <p>The Apache vhost configuration must contains the following directive in
  172. order to <a href="http://www.arnebrodowski.de/blog/508-Django,-mod_wsgi-and-HTTP-Authentication.html">pass authentication [en]</a> to django:</p>
  173. <div class="codehilite"><pre><span class="nb">WSGIPassAuthorization</span> <span class="k">On</span>
  174. </pre></div>
  175. <h2 id="to-dos">To-dos</h2>
  176. <ul>
  177. <li>Add missing features such as search in list, changesets, filelog</li>
  178. <li><code>diff</code> and <code>archive</code></li>
  179. <li>Add Ajax browsing for the repository</li>
  180. </ul>
  181. <h2 id="requirements">Requirements</h2>
  182. <ul>
  183. <li><a href="http://python.org/">Python 2.5+ [en]</a></li>
  184. <li><a href="http://selenic.com/mercurial/">Mercurial 1.2 [en]</a></li>
  185. <li><a href="http://djangoproject.com/">django 1.0.2 [en]</a></li>
  186. <li><a href="http://pygments.org">Pygments [en]</a></li>
  187. </ul>
  188. <p>For deployement:</p>
  189. <ul>
  190. <li><a href="http://httpd.apache.org/">Apache 2.2 [en]</a></li>
  191. <li><a href="http://code.google.com/p/modwsgi/">mod_wsgi [en]</a></li>
  192. <li><a href="http://www.mysql.com/">MySQL [en]</a> or <a href="http://www.postgresql.org/">PostgreSQL [en]</a></li>
  193. </ul>
  194. </div>
  195. </div>
  196. </body>
  197. </html>