Commits

Joe Heck  committed 2b73bcd Merge

merging in changes

  • Participants
  • Parent commits f71c554, 00d548e

Comments (0)

Files changed (10)

 .project
 .pydevproject
 *.*~
+*.*.orig

File context_processors.py

 from django import get_version as django_version
 from mercurial import __version__ as hg_version
+from sys import version_info
 
 def softwaresVersions(request):
-    return {"django_version": django_version(), "hg_version": hg_version.version}
+    def py_version():
+        v = "%s.%s.%s" % version_info[:3]
+        
+        if version_info[3] != "final":
+            v += ".%s" % version_info[3]
+        
+        return v
+    
+    versions = dict()
+    versions["django_version"] = django_version()
+    versions["hg_version"] = hg_version.version
+    versions["py_version"] = py_version()
+     
+    return versions
+
+def customLinks(request):
+    class Link(object):
+        def __init__(self):
+            self.url = ""
+            self.label = ""
+        
+    links = list()
+    
+    link = Link()
+    link.url = "/about"
+    link.label = "About"
+    links.append(link)
+    
+    link = Link()
+    link.url = "/tos"
+    link.label = "T.O.S"
+    links.append(link)
+    
+    link = Link()
+    link.url = "/workflow"
+    link.label = "Workflow"
+    links.append(link)
+    
+    return {"custom_links": links}

File howto.markdown

+How to setup FreeHg on your own server
+======================================
+
+Assuming you are using Debian unstable (it should be similar on other distributions).
+
+	sudo apt-get install -t experimental python-django
+	hg clone http://freehg.org/u/mmarshall/freehg/
+	cd freehg
+	cp default_settings.py settings.py
+
+Note: the below patches (and some other convenient things) are in this repo: http://freehg.org/u/certik/freehg/. a try to update to django-1.0.2 is here.
+
+Apply the following patch:
+
+	# HG changeset patch
+	# User Ondrej Certik <ondrej@certik.cz>
+	# Date 1215091794 -7200
+	# Node ID e2055dc9678e37e8ec0e140ee76dfcefd0245ffe
+	# Parent  9de77539abe2c32a2a1bdc35cc87fa872b96b3af
+	summary view adapted to the latest mercurial
+
+	diff --git a/repos/views.py b/repos/views.py
+	--- a/repos/views.py
+	+++ b/repos/views.py
+	@@ -78,6 +78,7 @@ def summary(request, username, reponame)
+	     from mercurial.hgweb.hgweb_mod import hgweb
+	     from mercurial.hgweb.common import style_map
+	     from mercurial import templater
+	+    from mercurial.templatefilters import filters as common_filters
+	     from django.conf import settings
+	     web = hgweb(hgrepo, name=repo.get_long_name())
+	     web.refresh()
+	@@ -85,7 +86,7 @@ def summary(request, username, reponame)
+	         yield web.config("web", "motd", "")
+	     templatepath = settings.HG_TEMPLATE_PATH
+	     mapfile = mapfile = style_map(templatepath, "freehg")
+	-    web.t = templater.templater(mapfile, templater.common_filters,
+	+    tmpl = templater.templater(mapfile, common_filters,
+	                                      defaults={"url": request.build_absolute_uri(),
+	                                                "staticurl": "/static/",
+	                                                "urlbase": "/",
+	@@ -106,7 +107,7 @@ def summary(request, username, reponame)
+	             else:
+	                 # FIXME I have a feeling that this isn't correct.
+	                 content.append(str(thing).decode('utf8'))
+	-    write(web.summary())
+	+    write(web.summary(tmpl))
+ 
+	     return render_to_response('repos/summary.html',
+	         dict(
+
+And also this patch:
+
+	--- default_settings.py 2008-06-15 11:41:43.658803990 +0200
+	+++ settings.py 2008-07-03 15:18:54.245187159 +0200
+	@@ -7,10 +7,13 @@
+	     # ('Your Name', 'your_email@domain.com'),
+	 )
+ 
+	+import os
+	+
+	 MANAGERS = ADMINS
+ 
+	-DATABASE_ENGINE = ''           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+	-DATABASE_NAME = ''             # Or path to database file if using sqlite3.
+	+DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+	+#DATABASE_NAME = ''             # Or path to database file if using sqlite3.
+	+DATABASE_NAME = os.path.join(os.path.dirname(__file__), 'database.dat')
+	 DATABASE_USER = ''             # Not used with sqlite3.
+	 DATABASE_PASSWORD = ''         # Not used with sqlite3.
+	 DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
+	@@ -63,10 +66,15 @@
+ 
+	 ROOT_URLCONF = 'freehg.urls'
+ 
+	+HTPASSWD_FILE = os.path.join(os.path.dirname(__file__), 'htpasswd')
+	+HG_TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), 'hgtemplates')
+	+REPO_PATH = "/tmp/po"
+	+
+	 TEMPLATE_DIRS = (
+	     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
+	     # Always use forward slashes, even on Windows.
+	     # Don't forget to use absolute paths, not relative paths.
+	+    os.path.join(os.path.dirname(__file__), 'templates'),
+	 )
+ 
+	 INSTALLED_APPS = (
+
+Create database tables:
+
+	./manage.py syncdb
+(You can answer "no" to create superuser now.) Test it locally
+
+	./manage.py runserver
+Installing in apache
+
+Apache config:
+
+	<VirtualHost *>
+	    ServerName freehg.org
+	    ServerAdmin your@email.com
+	    SetHandler python-program
+	    PythonHandler django.core.handlers.modpython
+	    SetEnv DJANGO_SETTINGS_MODULE freehg.settings
+	    PythonPath "['/home/ondra/repos/'] + sys.path"
+	        <Location "/static">
+	            SetHandler None
+	        </Location>
+	        Alias /static /home/ondra/repos/freehg/htdocs/static
+	    RewriteEngine on
+
+	    RewriteCond %{QUERY_STRING} .+
+	    RewriteRule /u(/.*) /home/ondra/repos/freehg/web/hgwebdir.cgi$1
+
+	    RewriteCond %{REQUEST_URI} !u/([^/]+)/([^/?]+)/?$
+	    RewriteCond %{REQUEST_URI} !u/([^/]+)/([^/?]+)/edit/?$
+	    RewriteCond %{REQUEST_URI} !u/([^/]+)/([^/?]+)/delete/?$
+	    RewriteRule /u(/.*) /home/ondra/repos/freehg/web/hgwebdir.cgi$1
+	      <Directory "/home/ondra/repos/freehg/web/">
+	        Order allow,deny
+	        Allow from all
+	        AllowOverride All
+	        SetHandler None
+	        Options ExecCGI
+	        AddHandler cgi-script .cgi
+	        AuthUserFile /home/ondra/repos/freehg/htpasswd
+	        AuthGroupFile /dev/null
+	        AuthName "freehg.org"
+	        AuthType Basic
+	        <LimitExcept GET>
+	        Require valid-user
+	        </LimitExcept>
+	      </Directory>
+	</VirtualHost>
+
+Then setup permissions
+
+	$ chmod o+x freehg
+	$ cd freehg
+	$ chmod o+x database.dat
+so that Apache can write to the database and create files in the freehg dir. Put this into your /etc/mercurial/hgrc:
+
+	[web]
+	style = /home/ondra/repos/freehg/hgtemplates/freehg
+	allow_archive = bz2 gz zip
+	push_ssl = false
+	allow_push = *
+not working ,any details?
+
+Problems and fixes
+==================
+
+Recommended version of Django
+-----------------------------
+
+The Author recommends (http://matthewmarshall.org/blog/2008/03/freehg.org/#comment-4238781) revision 7350 from the Django repository
+
+	svn co -r 7350 http://code.djangoproject.com/svn/django/trunk/
+
+Django 0.95
+===========
+
+FreeHG doesn't work with Django 0.95 or above. Here is how you need to change the source code to get it working with 0.95: The parameter name for "max_length" was changed to "maxlength" (without the underscore). To get "manage.py syncdb" runnig you need to change "repos/model.py" line 51 - 54 from
+
+
+	name = models.CharField(max_length=30)
+	long_name = models.CharField(max_length=50, blank=True)
+	description = models.TextField(max_length=5000, blank=True)
+to:
+
+	name = models.CharField(maxlength=30)
+	long_name = models.CharField(maxlength=50, blank=True)
+	description = models.TextField(maxlength=5000, blank=True)
+Additionaly: In "accountviews.py", "repos/forms.py" and "views.py"change the line:
+
+	from django import newforms as forms
+to:
+
+	from django import forms
+
+Ubuntu 8.10 (and probably other distros shiping with Django above 1.0)
+----------------------------------------------------------------------
+
+If you want to install FreeHG on Ubuntu 8.10
+
+download Django 0.95 from http://www.djangoproject.com/download/0.95.4/tarball/
+extract the "django" directory from the tar ball
+copy the "django" directory below your freehg folder
+apply the changes above to "repos/model.py"
+
+(copied from http://mercurial.selenic.com/wiki/HowToSetupFreeHg)

File htdocs/static/styles.css

 }
 
 html {
-	height: 100%;
+	height: 100% !important;
 }
 
 body {
 	background-color: #FFFFFF; 
 	font-family: tahoma, sans-serif;
-	height: 100%;
+	height: 100% !important;
 }
 
 #menu-bar a {
 	text-decoration: underline;
 }
 
+a:active {
+	border: none;
+}
+
 #main {
 	position: relative;
 	width: 100%; 
-	height: 100%;
+	min-height: 100% !important;
+	border: 0 none;
 }
 
 * html #main {
-	height: 100%;
+	height: 100% !important;
 }
 
 #top {
 
 #menu-bar {
 	float: right; 
-	padding: 10px 10px 0px 0px; 
+	padding: 12px 10px 0px 0px; 
 	height: 40px;
 }
 
 #menu-bar a {
+	color: #FFF;
 	text-shadow: #333 0px 0px 0.2em;
 }
 
 	width: 900px;
 	left: 50%; 
 	margin-left: -450px;
-	padding-bottom: 80px;
+	padding-bottom: 120px;
 }
 
 
 	background-color: #739ABD;
 	border-top: solid 6px #526671; 
 	border-bottom: solid 6px #EFEFF7; 
-	min-width:100%;*/
-	font-size: 11pt;
-	text-align: center;
+	min-width:100%;
+	font-size: 8pt;
 }
 
-#footer a{
-	font-size: 11pt;
-	text-align: center;
-}
-
-/*#footer div {
+#footer div {
+	list-style: none;
 	font-size: inherit;
-	margin-top: 30px;
+	font-weight: bold;
+	margin-top: 18px;
 	margin-left: 150px;
 	margin-right: 150px;
 	color: #FFF;
 	text-align: center;
-	text-shadow: #000 0px 0px 0.3em; 
-}*/
+	text-shadow: #333 0px 0px 0.3em;
+}
 
-/*#footer div strong {
+#footer div a {
 	font-size: inherit;
-	color: #000;
-	text-shadow: None; 
-}*/
+	color: #FC0;
+	text-shadow: #333 0px 0px 0.3em;
+}
+
+#footer div ul {
+	padding-bottom: 5px;
+	list-style: none;
+	font-size: inherit;
+}
+
+#footer div li {
+	font-size: inherit;
+	display: inline;
+}
 
 #clear {
 	clear: both;
 	min-height: 120px;
 }
 
+#about {
+	width: 550px;
+	min-height: 250px;
+}
+
 #left-side {
-	position: relative;
+	position: aboslute;
 	width: 50%;
 	float: left;
 	height: 100%;
 }
 
 #right-side {
-	position: relative;
+	position: absolute;
 	width: 50%;
 	float: right;
 	height: 100%;

File repos/views.py

     tip_hex = hexlify(hgrepo.changelog.tip())[:12]
 
     real_url = FreeHGConf.objects.all()[0]
-    clone_url = real_url.clone_url + "/" + username + "/" + reponame 
-    push_url = real_url.push_url + "/" + username + "/" + reponame 
+    clone_url = real_url.clone_url + "/u/" + username + "/" + reponame 
+    push_url = real_url.push_url + "/u/" + username + "/" + reponame 
 
     from mercurial.hgweb.hgweb_mod import hgweb
     from mercurial import templater
     def motd(**map):
         yield web.config("web", "motd", "")
     templatepath = settings.HG_TEMPLATE_PATH
-    mapfile = mapfile = templater.stylemap("freehg", templatepath)
+    mapfile = templater.stylemap("freehg", templatepath)[1]
+    # docs for templater.stylemap says it returns a path, but it really returns a tuple
+    # with the path as the second element. Added the [1] to discard the style name.
     tmpl = templater.templater(mapfile, common_filters,
                                      defaults={"url": clone_url,
                                                "staticurl": "/static/",
                                                "motd": motd,
                                                "rawfileheader": "FIXME",
                                                "sessionvars": tuple(),
-                                               })
+                                               })                                               
     from cStringIO import StringIO
     content = []
     def write(*things):
                 # FIXME I have a feeling that this isn't correct.
                 content.append(str(thing).decode('utf8'))
     write(summary(web, req=None, tmpl=tmpl))
-
     return render_to_response('repos/summary.html',
         dict(
             repo=repo,
 
 MANAGERS = ADMINS
 
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': 'hgbox',                      # Or path to database file if using sqlite3.
-        'USER': 'hgbox',                      # Not used with sqlite3.
-        'PASSWORD': 'hgbox',                  # Not used with sqlite3.
-        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
-        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
-    }
-}
+
+# DATABASES = {
+#     'default': {
+#         'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+#         'NAME': 'hgbox',                      # Or path to database file if using sqlite3.
+#         'USER': 'hgbox',                      # Not used with sqlite3.
+#         'PASSWORD': 'hgbox',                  # Not used with sqlite3.
+#         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
+#         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
+#     }
+# }
+DATABASE_ENGINE = 'sqlite3'          # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_NAME = 'development.db'     # Or path to database file if using sqlite3.
+DATABASE_USER = 'freehg'             # Not used with sqlite3.
+DATABASE_PASSWORD = 'fr33hg'         # Not used with sqlite3.
+DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
+DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
 
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
 # timezone as the operating system.
 # If running in a Windows environment this must be set to the same as your
 # system time zone.
-TIME_ZONE = 'America/Manaus'
+TIME_ZONE = 'America/PST8PDT'
 
 # Language code for this installation. All choices can be found here:
 # http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'pt-br'
+LANGUAGE_CODE = 'en-us'
 
 SITE_ID = 1
 
     os.path.join(os.path.dirname(__file__), 'templates'),
 )
 
+TEMPLATE_CONTEXT_PROCESSORS = (
+    'django.core.context_processors.auth',
+    'freehg.context_processors.softwaresVersions',
+    'freehg.context_processors.customLinks',
+)
+
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',

File templates/about.html

 {% block title %}About{% endblock %}
 
 {% block content %}
-<div class="span-12">
-
-<p>FreeHG goals:</p>
+<div id="about" class="dialog">
+<p class="title"><strong>About freeHg</strong></p>
 <ul>
-    <li>Repository management</li>
-    <li>Fork feature(remote clone)</li>
-    <li>Tickets system(issues)</li>
-    <li>Team system(groups of users)</li>
-    <li>Commiters system(ACL for repositories)</li>
-    <li>Merge request or pull request</li>
+	<li class="head">freeHg Goals:</li>
+	<li class="body">Repository management</li>
+	<li class="body">Fork feature(remote clone)</li>
+	<li class="body">Tickets system(issues)</li>
+	<li class="body">Team system(groups of users)</li>
+	<li class="body">Commiters system(ACL for repositories)</li>
+	<li class="body">Merge request or pull request</li>
+</ul>
+<ul>
+	<li>
+		I've was searching for something that would look like gitorious.org but using mercurial instead of git as the SCM.
+		I found bitbucket.org, but it's not an open source project, so I couldn't customize it the way I needed.
+	</li>
+	<li>
+		freeHg originally was written by <a href="http://matthewmarshall.org/contact/">Matthew Marshall</a> and 
+		now I'm working 
+	</li>
 </ul>
 
-<p>Freehg was initally written by <a href="http://matthewmarshall.org/contact/">Matthew Marshall</a> and I got to make improvements. I searched for something like gitorious.org but that use mercurial instead of git, I found bitbucket.org but is not open source and haven't the source code available</p>
 <p>If you have any questions, comments, suggestions or even better <b>patchs</b> about this site, I would love to hear from you. <a href="http://danielmartins.eti.br/blog/contato/">my contact is here.</a></p>
 <p>The project tracker are <a href="http://bitbucket.org/danielmartins/freehg">here</a>, will be better if you register an issue for anything useful like problem, proposal or enhancement, this way is better to us track and control the software</p>
 </div>

File templates/base.html

 						<li>
 							<a href="/accounts/change_password/">Password Change</a>
 						</li>
+						{% else %}
+						<li>
+							<a href="#">Sign in</a>
+						</li>
 						{% endif %}
 					</ul>
 				</div><!-- #menu-bar -->
 		<div id="clear"></div>
 		<br />
 		<div id="footer">
-			HgBox Copyright 2010
-			<a href="""">TOS</a>
-			 | 
-			<a href="""">Privacy</a>
-			 | 
-			<a href="http://www.djangoproject.com/" >Django {{django_version}}</a>
-			 | 
-			<a href="http://mercurial.selenic.com/" >Hg {{hg_version}}</a>
-			
+			<div>
+				<ul>						
+					{% if custom_links %}{% for link in custom_links %} &bull; <li><a href="{{link.url}}">{{link.label}}</a></li>{% endfor %} &bull; {% endif %}
+				</ul>
+				&bull; freeHg copyright 2009 by <a href="#">freeHg Team</a> &bull; 
+				Django <a href="http://www.djangoproject.com" target="__blank">{{django_version}}</a> &rsaquo; 
+				Hg <a href="http://mercurial.selenic.com/" target="__blank">{{hg_version}}</a> &rsaquo; 
+				Python <a href="http://www.python.org" target="__blank">{{py_version}}</a> &bull;
+			</div>
 		</div><!-- #footer -->
 	</div><!-- #main -->
 </body>

File templates/frontpage.html

File contents unchanged.

File templates/workflow.html

 <li>Faz as alterações e commits no seu repositório e então gera o patch</li>
 </ol>
 </div>
-
 {% endblock %}