# HG changeset patch # User Arne Babenhauserheide # Date 1238236181 -3600 # Node ID deef381a5addc7a7119b1a6782e6bac0bb555902 # Parent 6aa30181ae14707d44c5ed9a4450bedcf500de78# Parent 85b535ee14bd16c11beb2beaba51933f2882c89a merge quick start fix. diff -r 6aa30181ae14 -r deef381a5add .hgignore --- a/.hgignore Sat Mar 28 11:27:57 2009 +0100 +++ b/.hgignore Sat Mar 28 11:29:41 2009 +0100 @@ -3,3 +3,4 @@ .DS_Store *~ *.bak +*.pyc diff -r 6aa30181ae14 -r deef381a5add hgscm/apps/www/models.py --- a/hgscm/apps/www/models.py Sat Mar 28 11:27:57 2009 +0100 +++ b/hgscm/apps/www/models.py Sat Mar 28 11:29:41 2009 +0100 @@ -1,3 +1,36 @@ from django.db import models +from django.utils import simplejson +from django.conf import settings +import os, re -# Create your models here. +def get_download(platform, version): + '''get the download for the right version''' + f = open(os.path.join(settings.MEDIA_ROOT, "downloads.json")) + list = simplejson.load(f) + f.close() + latest = version == 'latest' or not version + for entry in list: + if (latest and entry['latest'] == 'true') or entry['version'] == version: + for version in entry['versions']: + if version['identifier'] == platform: + return version +def get_download_for_agent(agent, version): + '''get the download for the right version''' + f = open(os.path.join(settings.MEDIA_ROOT, "downloads.json")) + list = simplejson.load(f) + f.close() + latest = version == 'latest' or not version + for entry in list: + if (latest and entry['latest'] == 'true') or entry['version'] == version: + for version in entry['versions']: + if re.search(version['system'], agent): + return version + +def get_latest_version(): + '''return the latest available version''' + f = open(os.path.join(settings.MEDIA_ROOT, "downloads.json")) + list = simplejson.load(f) + f.close() + for entry in list: + if entry['latest'] == 'true': + return entry['version'] diff -r 6aa30181ae14 -r deef381a5add hgscm/apps/www/templatetags/__init__.py diff -r 6aa30181ae14 -r deef381a5add hgscm/apps/www/templatetags/extras.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgscm/apps/www/templatetags/extras.py Sat Mar 28 11:29:41 2009 +0100 @@ -0,0 +1,48 @@ +from django import template +from django.conf import settings +from django.template import Context +from hgscm.apps.www.models import get_latest_version, get_download_for_agent, get_download +import random, os, re + +register = template.Library() + +class MercurialTricksNode(template.Node): + def __init__(self): + self._filename = self._random() + + def _random(self): + file = random.choice(os.listdir(settings.MERCURIAL_TRICKS)) + return os.path.join(settings.MERCURIAL_TRICKS, file) + + def render(self, context): + f = open(self._filename) + result = "

Tricks

" + f.read() + "

" + f.close() + return result + +class DownloadButtonNode(template.Node): + def __init__(self, extended): + self._extended = extended + def render(self, context): + agent = context['request'].META['HTTP_USER_AGENT'] + t = template.loader.get_template('fragments/downloadbutton.html') + c = Context() + + version = get_download_for_agent(agent, 'latest') + if not version: + version = get_download('source', 'latest') + c['download_system'] = version['system'] + c['download_url'] = version['url'] + c['latest_version'] = get_latest_version() + c['extended'] = self._extended + return t.render(c) + +def do_mercurial_tricks (parser, token): + return MercurialTricksNode() + +def do_download_button(parser, token): + extended = len(token.split_contents()) > 1 + return DownloadButtonNode(extended) + +register.tag('mercurial_tricks', do_mercurial_tricks) +register.tag('download_button', do_download_button) diff -r 6aa30181ae14 -r deef381a5add hgscm/apps/www/urls.py --- a/hgscm/apps/www/urls.py Sat Mar 28 11:27:57 2009 +0100 +++ b/hgscm/apps/www/urls.py Sat Mar 28 11:29:41 2009 +0100 @@ -3,4 +3,7 @@ urlpatterns = patterns('hgscm.apps.www.views', url(r'^$', 'frontpage', name='frontpage'), url(r'^about$', 'about', name='about'), + url(r'^thepage$', 'thepage', name='thepage'), + url(r'^downloads$', 'downloads', name='downloads'), + url(r'^download/(?P.*?)/(?P.*?)$', 'download', name='download'), ) diff -r 6aa30181ae14 -r deef381a5add hgscm/apps/www/views.py --- a/hgscm/apps/www/views.py Sat Mar 28 11:27:57 2009 +0100 +++ b/hgscm/apps/www/views.py Sat Mar 28 11:29:41 2009 +0100 @@ -1,5 +1,10 @@ from django.shortcuts import render_to_response from django.template import RequestContext +from django.http import HttpResponseRedirect +from django.utils import simplejson +from django.conf import settings +from hgscm.apps.www.models import get_download, get_latest_version +import os def frontpage(request): return render_to_response("frontpage.html", { }, @@ -7,3 +12,14 @@ def about(request): return render_to_response("about.html", { }, RequestContext(request)) +def thepage(request): + return render_to_response("thepage.html", { }, + RequestContext(request)) +def download(request, platform, version): + return HttpResponseRedirect(get_download(platform, version)['url']) +def downloads(request): + f = open(os.path.join(settings.MEDIA_ROOT, "downloads.json")) + list = simplejson.load(f) + f.close() + return render_to_response("downloads.html", {'downloads': list}, + RequestContext(request)) diff -r 6aa30181ae14 -r deef381a5add hgscm/media/css/styles.css --- a/hgscm/media/css/styles.css Sat Mar 28 11:27:57 2009 +0100 +++ b/hgscm/media/css/styles.css Sat Mar 28 11:29:41 2009 +0100 @@ -19,7 +19,7 @@ /* * General Document Settings */ -body { font: .875em/1.4285em "Times New Roman", Times, Georgia, serif; color: #666; width: 900px; margin: 0 auto; position: relative; } +body { font: .925em/1.4285em "Times New Roman", Times, Georgia, serif; color: #111; width: 900px; margin: 0 auto; position: relative; } /* * Headings @@ -31,6 +31,11 @@ h3 { font-size: 1.3em; } /* + * WIP warning, can be removed once the site is 'finished' + */ +.wip-warning { font-size: 1em; font-family: Optimer, Helvetica, Arial, sans-serif; border: 1px solid #330; background-color: #fafa33; padding: 2px; text-align: center} + +/* * Lists */ ul { margin-left: 2.2em; line-height: 1.5em; } @@ -62,7 +67,8 @@ table { border-collapse: separate; border-spacing: 0; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: .7875em; } caption, th, td { text-align: left; font-weight: normal; } td, th { padding: 6px 8px; } -thead td, thead th { background: #00B5F1; color: #fff; font-weight: bold; } +.latest thead td, .latest thead th { background: #00B5F1; color: #fff; font-weight: bold; } +thead td, thead th { background: #999; color: #fff; font-weight: bold; } tbody td { border-bottom: 1px solid #ccc; } /* @@ -78,6 +84,7 @@ .row { display: block; } .col { float: right; display: inline; width: 270px; margin: 25px; } .big { float: left; width: 470px; } +.quote { float: right; width: 740px; text-align: right; margin-right: 25px; } .big h2 { margin-top: 20px; } /* @@ -89,7 +96,7 @@ /* * Nav */ -#nav { position: absolute; top: 17px; right: 0; background: #999; height: 42px; margin: 0; width: 665px; font-size: 1.1428em; *font-size: 16px; line-height: 42px; font-family: Optimer, Helvetica, Arial, sans-serif; overflow: hidden; } +#nav { position: absolute; top: 41px; right: 0; background: #999; height: 42px; margin: 0; width: 665px; font-size: 1.1428em; *font-size: 16px; line-height: 42px; font-family: Optimer, Helvetica, Arial, sans-serif; overflow: hidden; } #nav li { float: left; margin: 0; padding: 0; list-style: none; } #nav a { float: left; color: #fff; text-decoration: none; padding: 0 16px; *padding: 0 14px; } #nav a:hover, #nav a:focus, #nav .active a { background: #00b5f1; } @@ -97,7 +104,7 @@ /* * Search */ -#search { position: absolute; right: 15px; top: 26px; color: #fff; width: 183px; height: 23px; background: url(../images/search.png) no-repeat 0 0; } +#search { position: absolute; right: 15px; top: 50px; color: #fff; width: 183px; height: 23px; background: url(../images/search.png) no-repeat 0 0; } #search legend { display: none; } #search label { position: absolute; left: -9999px; } #search .text { width: 150px; background: none; border: none; margin: 0 0 0 5px; position: relative; top: 5px; color: #666; } @@ -125,6 +132,8 @@ #home ol li { list-style: none; background: url(../images/bullet-big-1.png) no-repeat 0 0; padding-left: 60px; min-height: 43px; _height: 43px; } #home ol .i-2 { background-image: url(../images/bullet-big-2.png); } #home ol .i-3 { background-image: url(../images/bullet-big-3.png); } +#home ol a { text-decoration: none; } +#home ol a:hover { text-decoration: underline; } /* * Footer diff -r 6aa30181ae14 -r deef381a5add hgscm/media/downloads.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgscm/media/downloads.json Sat Mar 28 11:29:41 2009 +0100 @@ -0,0 +1,26 @@ +[{ + "latest": "true", + "version": "1.2", + "versions": [{ + "system": "FreeBSD", + "identifier": "freebsd", + "url": "ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-stable/devel/mercurial-1.1.2.tbz" + },{ + "system": "MacOS X 10.5", + "identifier": "macosx", + "url": "http://mercurial.berkwood.com/binaries/Mercurial-1.2-py2.5-macosx10.5.zip" + },{ + "system": "MacOS X 10.4", + "identifier": "macosx104", + "url": "http://mercurial.berkwood.com/binaries/Mercurial-1.2-py2.5-macosx10.4.zip" + },{ + "system": "Windows", + "identifier": "windows", + "url": "http://mercurial.berkwood.com/binaries/Mercurial-1.2.exe" + },{ + "system": "Source", + "identifier": "source", + "url": "http://www.selenic.com/mercurial/release/mercurial-1.2.tar.gz" + }] + } +] diff -r 6aa30181ae14 -r deef381a5add hgscm/media/images/favicon.ico Binary file hgscm/media/images/favicon.ico has changed diff -r 6aa30181ae14 -r deef381a5add hgscm/settings.py --- a/hgscm/settings.py Sat Mar 28 11:27:57 2009 +0100 +++ b/hgscm/settings.py Sat Mar 28 11:29:41 2009 +0100 @@ -67,10 +67,17 @@ ROOT_URLCONF = 'hgscm.urls' +MERCURIAL_TRICKS = os.path.join(BASE_DIR, "templates/tricks") + TEMPLATE_DIRS = ( os.path.join(BASE_DIR, "templates"), ) +TEMPLATE_CONTEXT_PROCESSORS = ( + 'django.core.context_processors.request', + 'django.core.context_processors.media', +) + INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', diff -r 6aa30181ae14 -r deef381a5add hgscm/templates/about.html --- a/hgscm/templates/about.html Sat Mar 28 11:27:57 2009 +0100 +++ b/hgscm/templates/about.html Sat Mar 28 11:29:41 2009 +0100 @@ -1,5 +1,6 @@ {% extends "base.html" %} +{% load extras %} {% block content %}
@@ -14,7 +15,7 @@

Fast

-

Mercurials implementation and data structures are designed to be fast. You can generate diffs between revisions, or jump back in time within seconds. Therefore Mercurial is perfectly suiteable for large projects such as OpenJDK or NetBeans.

+

Mercurials implementation and data structures are designed to be fast. You can generate diffs between revisions, or jump back in time within seconds. Therefore Mercurial is perfectly suiteable for large projects such as OpenJDK (hg) or NetBeans (hg).

Platform independent

@@ -22,7 +23,7 @@

Extensible

-

The functionality of Mercurial can be increased with extensions, either by activating the official ones which are shipped with Mercurial or downloading some (from the wiki or by writing your own). Extensions are written in Python and can change the workings of the basic commands, add new commands and access all the core functions of Mercurial.

+

The functionality of Mercurial can be increased with extensions, either by activating the official ones which are shipped with Mercurial or downloading some from the wiki or by writing your own. Extensions are written in Python and can change the workings of the basic commands, add new commands and access all the core functions of Mercurial.

Open Source

@@ -30,15 +31,11 @@

Similar projects

-

Mercurial is used for version control of files. Similar projects include git, Bazaar, Subversion and CVS. +

Mercurial is used for version control of files. Similar projects include Git and Bazaar. Version control systems without a distributed architecture include Subversion and CVS.

-

Download Mercurial

- - Download now - Mercurial 2.42 - Windows XP | Vista | 7 - + {% download_button %} + {% mercurial_tricks %}
diff -r 6aa30181ae14 -r deef381a5add hgscm/templates/base.html --- a/hgscm/templates/base.html Sat Mar 28 11:27:57 2009 +0100 +++ b/hgscm/templates/base.html Sat Mar 28 11:29:41 2009 +0100 @@ -5,19 +5,22 @@ - + + + Mercurial SCM +
Please note that this site is work in progress and incomplete! You probably want to visit the official mercurial homepage instead.

mercurial