Changeset - d945c95ba4ac
[Not reviewed]
default
0 14 0
Marcin Kuzminski - 15 years ago 2010-09-28 22:25:58
marcin@python-works.com
refactoring for new vcs implementation
renamed all ._short and .raw_id into .short_id
updated dependency for vcs to 0.1.6
14 files changed with 53 insertions and 53 deletions:
0 comments (0 inline, 0 general)
celeryconfig.py
Show inline comments
 
# List of modules to import when celery starts.
 
import sys
 
import os
 
import ConfigParser
 
root = os.getcwd()
 

	
 
PYLONS_CONFIG_NAME = 'development.ini'
 
PYLONS_CONFIG_NAME = 'production.ini'
 

	
 
sys.path.append(root)
 
config = ConfigParser.ConfigParser({'here':root})
 
config.read('%s/%s' % (root, PYLONS_CONFIG_NAME))
 
PYLONS_CONFIG = config
 

	
 
CELERY_IMPORTS = ("pylons_app.lib.celerylib.tasks",)
 

	
 
## Result store settings.
 
CELERY_RESULT_BACKEND = "database"
 
CELERY_RESULT_DBURI = dict(config.items('app:main'))['sqlalchemy.db1.url']
 
CELERY_RESULT_SERIALIZER = 'json'
 

	
 

	
 
BROKER_CONNECTION_MAX_RETRIES = 30
 

	
 
## Broker settings.
 
BROKER_HOST = "localhost"
 
BROKER_PORT = 5672
 
BROKER_VHOST = "rabbitmqhost"
 
BROKER_USER = "rabbitmq"
 
BROKER_PASSWORD = "qweqwe"
 

	
 
## Worker settings
pylons_app/controllers/changeset.py
Show inline comments
 
@@ -44,95 +44,95 @@ class ChangesetController(BaseController
 
        
 
    def index(self, revision):
 
        hg_model = HgModel()
 
        try:
 
            c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
 
        except RepositoryError:
 
            log.error(traceback.format_exc())
 
            return redirect(url('hg_home'))
 
        else:
 
            try:
 
                c.changeset_old = c.changeset.parents[0]
 
            except IndexError:
 
                c.changeset_old = None
 
            c.changes = []
 
            
 
            for node in c.changeset.added:
 
                filenode_old = FileNode(node.path, '')
 
                if filenode_old.is_binary or node.is_binary:
 
                    diff = 'binary file'
 
                else:    
 
                    f_udiff = differ.get_udiff(filenode_old, node)
 
                    diff = differ.DiffProcessor(f_udiff).as_html()
 

	
 
                cs1 = None
 
                cs2 = node.last_changeset.raw_id                                        
 
                cs2 = node.last_changeset.short_id                                        
 
                c.changes.append(('added', node, diff, cs1, cs2))
 
                
 
            for node in c.changeset.changed:
 
                filenode_old = c.changeset_old.get_node(node.path)
 
                if filenode_old.is_binary or node.is_binary:
 
                    diff = 'binary file'
 
                else:    
 
                    f_udiff = differ.get_udiff(filenode_old, node)
 
                    diff = differ.DiffProcessor(f_udiff).as_html()
 

	
 
                cs1 = filenode_old.last_changeset.raw_id
 
                cs2 = node.last_changeset.raw_id                    
 
                cs1 = filenode_old.last_changeset.short_id
 
                cs2 = node.last_changeset.short_id                    
 
                c.changes.append(('changed', node, diff, cs1, cs2))
 
                
 
            for node in c.changeset.removed:
 
                c.changes.append(('removed', node, None, None, None))            
 
            
 
        return render('changeset/changeset.html')
 

	
 
    def raw_changeset(self,revision):
 
        
 
        hg_model = HgModel()
 
        method = request.GET.get('diff','show')
 
        try:
 
            c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
 
        except RepositoryError:
 
            log.error(traceback.format_exc())
 
            return redirect(url('hg_home'))
 
        else:
 
            try:
 
                c.changeset_old = c.changeset.parents[0]
 
            except IndexError:
 
                c.changeset_old = None
 
            c.changes = []
 
            
 
            for node in c.changeset.added:
 
                filenode_old = FileNode(node.path, '')
 
                if filenode_old.is_binary or node.is_binary:
 
                    diff = 'binary file'
 
                else:    
 
                    f_udiff = differ.get_udiff(filenode_old, node)
 
                    diff = differ.DiffProcessor(f_udiff).raw_diff()
 

	
 
                cs1 = None
 
                cs2 = node.last_changeset.raw_id                                        
 
                cs2 = node.last_changeset.short_id                                        
 
                c.changes.append(('added', node, diff, cs1, cs2))
 
                
 
            for node in c.changeset.changed:
 
                filenode_old = c.changeset_old.get_node(node.path)
 
                if filenode_old.is_binary or node.is_binary:
 
                    diff = 'binary file'
 
                else:    
 
                    f_udiff = differ.get_udiff(filenode_old, node)
 
                    diff = differ.DiffProcessor(f_udiff).raw_diff()
 

	
 
                cs1 = filenode_old.last_changeset.raw_id
 
                cs2 = node.last_changeset.raw_id                    
 
                cs1 = filenode_old.last_changeset.short_id
 
                cs2 = node.last_changeset.short_id                    
 
                c.changes.append(('changed', node, diff, cs1, cs2))      
 
        
 
        response.content_type = 'text/plain'
 
        if method == 'download':
 
            response.content_disposition = 'attachment; filename=%s.patch' % revision 
 
        parent = True if len(c.changeset.parents) > 0 else False
 
        c.parent_tmpl = 'Parent  %s' % c.changeset.parents[0]._hex if parent else ''
 
    
 
        c.diffs = ''
 
        for x in c.changes:
 
            c.diffs += x[2]
 
            
 
        return render('changeset/raw_changeset.html')
pylons_app/controllers/feed.py
Show inline comments
 
@@ -33,48 +33,48 @@ class FeedController(BaseController):
 
    
 
    #secure it or not ?
 
    def __before__(self):
 
        super(FeedController, self).__before__()
 
        #common values for feeds
 
        self.description = 'Changes on %s repository'
 
        self.title = "%s feed"
 
        self.language = 'en-us'
 
        self.ttl = "5"
 
        self.feed_nr = 10
 

	
 
    def atom(self, repo_name):
 
        """Produce an atom-1.0 feed via feedgenerator module"""
 
        feed = Atom1Feed(title=self.title % repo_name,
 
                         link=url('summary_home', repo_name=repo_name, qualified=True),
 
                         description=self.description % repo_name,
 
                         language=self.language,
 
                         ttl=self.ttl)
 
        
 
        changesets = HgModel().get_repo(repo_name)
 

	
 
        for cs in changesets[:self.feed_nr]:
 
            feed.add_item(title=cs.message,
 
                          link=url('changeset_home', repo_name=repo_name,
 
                                   revision=cs.raw_id, qualified=True),
 
                                   revision=cs.short_id, qualified=True),
 
                                   description=str(cs.date))
 
        
 
        response.content_type = feed.mime_type
 
        return feed.writeString('utf-8')
 

	
 
    
 
    def rss(self, repo_name):
 
        """Produce an rss2 feed via feedgenerator module"""
 
        feed = Rss201rev2Feed(title=self.title % repo_name,
 
                         link=url('summary_home', repo_name=repo_name, qualified=True),
 
                         description=self.description % repo_name,
 
                         language=self.language,
 
                         ttl=self.ttl)
 
        
 
        changesets = HgModel().get_repo(repo_name)
 
        for cs in changesets[:self.feed_nr]:
 
            feed.add_item(title=cs.message,
 
                          link=url('changeset_home', repo_name=repo_name,
 
                                   revision=cs.raw_id, qualified=True),
 
                                   revision=cs.short_id, qualified=True),
 
                          description=str(cs.date))
 
            
 
        response.content_type = feed.mime_type
 
        return feed.writeString('utf-8')
pylons_app/controllers/files.py
Show inline comments
 
@@ -47,92 +47,92 @@ class FilesController(BaseController):
 
        super(FilesController, self).__before__()
 
        c.file_size_limit = 250 * 1024 #limit of file size to display
 

	
 
    def index(self, repo_name, revision, f_path):
 
        hg_model = HgModel()
 
        c.repo = repo = hg_model.get_repo(c.repo_name)
 
        revision = request.POST.get('at_rev', None) or revision
 
        
 
        def get_next_rev(cur):
 
            max_rev = len(c.repo.revisions) - 1
 
            r = cur + 1
 
            if r > max_rev:
 
                r = max_rev
 
            return r
 
            
 
        def get_prev_rev(cur):
 
            r = cur - 1
 
            return r
 

	
 
        c.f_path = f_path
 
     
 
        
 
        try:
 
            cur_rev = repo.get_changeset(revision).revision
 
            prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).raw_id
 
            next_rev = repo.get_changeset(get_next_rev(cur_rev)).raw_id
 
            prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).short_id
 
            next_rev = repo.get_changeset(get_next_rev(cur_rev)).short_id
 
                    
 
            c.url_prev = url('files_home', repo_name=c.repo_name,
 
                             revision=prev_rev, f_path=f_path) 
 
            c.url_next = url('files_home', repo_name=c.repo_name,
 
                             revision=next_rev, f_path=f_path)   
 
                    
 
            c.changeset = repo.get_changeset(revision)
 
                        
 
            c.cur_rev = c.changeset.raw_id
 
            c.cur_rev = c.changeset.short_id
 
            c.rev_nr = c.changeset.revision
 
            c.files_list = c.changeset.get_node(f_path)
 
            c.file_history = self._get_history(repo, c.files_list, f_path)
 
            
 
        except (RepositoryError, ChangesetError):
 
            c.files_list = None
 
        
 
        return render('files/files.html')
 

	
 
    def rawfile(self, repo_name, revision, f_path):
 
        hg_model = HgModel()
 
        c.repo = hg_model.get_repo(c.repo_name)
 
        file_node = c.repo.get_changeset(revision).get_node(f_path)
 
        response.content_type = file_node.mimetype
 
        response.content_disposition = 'attachment; filename=%s' \
 
                                                    % f_path.split('/')[-1] 
 
        return file_node.content
 

	
 
    def raw(self, repo_name, revision, f_path):
 
        hg_model = HgModel()
 
        c.repo = hg_model.get_repo(c.repo_name)
 
        file_node = c.repo.get_changeset(revision).get_node(f_path)
 
        response.content_type = 'text/plain'
 
        
 
        return file_node.content
 
    
 
    def annotate(self, repo_name, revision, f_path):
 
        hg_model = HgModel()
 
        c.repo = hg_model.get_repo(c.repo_name)
 
        cs = c.repo.get_changeset(revision)
 
        c.file = cs.get_node(f_path)
 
        c.file_msg = cs.get_file_message(f_path)
 
        c.cur_rev = cs.raw_id
 
        c.cur_rev = cs.short_id
 
        c.rev_nr = cs.revision        
 
        c.f_path = f_path
 

	
 
        return render('files/files_annotate.html')
 
      
 
    def archivefile(self, repo_name, revision, fileformat):
 
        archive_specs = {
 
          '.tar.bz2': ('application/x-tar', 'tbz2'),
 
          '.tar.gz': ('application/x-tar', 'tgz'),
 
          '.zip': ('application/zip', 'zip'),
 
        }
 
        if not archive_specs.has_key(fileformat):
 
            return 'Unknown archive type %s' % fileformat
 
                        
 
        def read_in_chunks(file_object, chunk_size=1024 * 40):
 
            """Lazy function (generator) to read a file piece by piece.
 
            Default chunk size: 40k."""
 
            while True:
 
                data = file_object.read(chunk_size)
 
                if not data:
 
                    break
 
                yield data        
 
            
 
        archive = tempfile.TemporaryFile()
 
@@ -150,58 +150,58 @@ class FilesController(BaseController):
 
        diff1 = request.GET.get('diff1')
 
        diff2 = request.GET.get('diff2')
 
        c.action = request.GET.get('diff')
 
        c.no_changes = diff1 == diff2
 
        c.f_path = f_path
 
        c.repo = hg_model.get_repo(c.repo_name)
 

	
 
        try:
 
            if diff1 not in ['', None, 'None', '0' * 12]:
 
                c.changeset_1 = c.repo.get_changeset(diff1)
 
                node1 = c.changeset_1.get_node(f_path)
 
            else:
 
                c.changeset_1 = EmptyChangeset()
 
                node1 = FileNode('.', '')
 
            if diff2 not in ['', None, 'None', '0' * 12]:
 
                c.changeset_2 = c.repo.get_changeset(diff2)
 
                node2 = c.changeset_2.get_node(f_path)
 
            else:
 
                c.changeset_2 = EmptyChangeset()
 
                node2 = FileNode('.', '') 
 
        except RepositoryError:
 
            return redirect(url('files_home',
 
                                repo_name=c.repo_name, f_path=f_path))
 

	
 
        c.diff1 = 'r%s:%s' % (c.changeset_1.revision, c.changeset_1.raw_id)
 
        c.diff2 = 'r%s:%s' % (c.changeset_2.revision, c.changeset_2.raw_id)
 
        c.diff1 = 'r%s:%s' % (c.changeset_1.revision, c.changeset_1.short_id)
 
        c.diff2 = 'r%s:%s' % (c.changeset_2.revision, c.changeset_2.short_id)
 
        f_udiff = differ.get_udiff(node1, node2)
 
        
 
        diff = differ.DiffProcessor(f_udiff)
 
                                
 
        if c.action == 'download':
 
            diff_name = '%s_vs_%s.diff' % (diff1, diff2)
 
            response.content_type = 'text/plain'
 
            response.content_disposition = 'attachment; filename=%s' \
 
                                                    % diff_name             
 
            return diff.raw_diff()
 
        
 
        elif c.action == 'raw':
 
            c.cur_diff = '<pre class="raw">%s</pre>' % h.escape(diff.raw_diff())
 
        elif c.action == 'diff':
 
            c.cur_diff = diff.as_html()
 
        else:
 
            #default option
 
            c.cur_diff = diff.as_html()
 
        
 
        if not c.cur_diff: c.no_changes = True    
 
        return render('files/file_diff.html')
 
    
 
    def _get_history(self, repo, node, f_path):
 
        from vcs.nodes import NodeKind
 
        if not node.kind is NodeKind.FILE:
 
            return []
 
        changesets = node.history
 
        hist_l = []
 
        for chs in changesets:
 
            n_desc = 'r%s:%s' % (chs.revision, chs._short)
 
            hist_l.append((chs._short, n_desc,))
 
            n_desc = 'r%s:%s' % (chs.revision, chs.short_id)
 
            hist_l.append((chs.short_id, n_desc,))
 
        return hist_l
pylons_app/lib/helpers.py
Show inline comments
 
@@ -250,54 +250,54 @@ def pygmentize_annotation(filenode, **kw
 
        for c in xrange(n):
 
            h += golden_ratio
 
            h %= 1
 
            HSV_tuple = [h, 0.95, 0.95]
 
            RGB_tuple = colorsys.hsv_to_rgb(*HSV_tuple)
 
            yield map(lambda x:str(int(x * 256)), RGB_tuple)           
 

	
 
    cgenerator = gen_color()
 
        
 
    def get_color_string(cs):
 
        if color_dict.has_key(cs):
 
            col = color_dict[cs]
 
        else:
 
            col = color_dict[cs] = cgenerator.next()
 
        return "color: rgb(%s)! important;" % (', '.join(col))
 
        
 
    def url_func(changeset):
 
        tooltip_html = "<div style='font-size:0.8em'><b>Author:</b>" + \
 
        " %s<br/><b>Date:</b> %s</b><br/><b>Message:</b> %s<br/></div>" 
 
        
 
        tooltip_html = tooltip_html % (changeset.author,
 
                                               changeset.date,
 
                                               tooltip(changeset.message))
 
        lnk_format = 'r%-5s:%s' % (changeset.revision,
 
                                 changeset.raw_id)
 
                                 changeset.short_id)
 
        uri = link_to(
 
                lnk_format,
 
                url('changeset_home', repo_name=changeset.repository.name,
 
                    revision=changeset.raw_id),
 
                style=get_color_string(changeset.raw_id),
 
                    revision=changeset.short_id),
 
                style=get_color_string(changeset.short_id),
 
                class_='tooltip',
 
                tooltip_title=tooltip_html
 
              )
 
        
 
        uri += '\n'
 
        return uri   
 
    return literal(annotate_highlight(filenode, url_func, **kwargs))
 
      
 
def repo_name_slug(value):
 
    """Return slug of name of repository
 
    This function is called on each creation/modification
 
    of repository to prevent bad names in repo
 
    """
 
    slug = remove_formatting(value)
 
    slug = strip_tags(slug)
 
    
 
    for c in """=[]\;'"<>,/~!@#$%^&*()+{}|: """:
 
        slug = slug.replace(c, '-')
 
    slug = recursive_replace(slug, '-')
 
    slug = collapse(slug, '-')
 
    return slug
 

	
 
def get_changeset_safe(repo, rev):
 
    from vcs.backends.base import BaseRepository
pylons_app/model/hg_model.py
Show inline comments
 
@@ -134,36 +134,36 @@ class HgModel(object):
 
                        else:
 
                            repos_list[name].contact = sa.query(User)\
 
                            .filter(User.admin == True).first().full_contact
 
            except OSError:
 
                continue
 
        meta.Session.remove()
 
        return repos_list
 
        
 
    def get_repos(self):
 
        for name, repo in _get_repos_cached().items():
 
            if repo._get_hidden():
 
                #skip hidden web repository
 
                continue
 
            
 
            last_change = repo.last_change
 
            tip = h.get_changeset_safe(repo, 'tip')
 
                
 
            tmp_d = {}
 
            tmp_d['name'] = repo.name
 
            tmp_d['name_sort'] = tmp_d['name'].lower()
 
            tmp_d['description'] = repo.description
 
            tmp_d['description_sort'] = tmp_d['description']
 
            tmp_d['last_change'] = last_change
 
            tmp_d['last_change_sort'] = last_change[1] - last_change[0]
 
            tmp_d['tip'] = tip.raw_id
 
            tmp_d['tip'] = tip.short_id
 
            tmp_d['tip_sort'] = tip.revision 
 
            tmp_d['rev'] = tip.revision
 
            tmp_d['contact'] = repo.contact
 
            tmp_d['contact_sort'] = tmp_d['contact']
 
            tmp_d['repo_archives'] = list(repo._get_archives())
 
            tmp_d['last_msg'] = tip.message
 
            tmp_d['repo'] = repo
 
            yield tmp_d
 

	
 
    def get_repo(self, repo_name):
 
        return _get_repos_cached()[repo_name]
pylons_app/templates/branches/branches_data.html
Show inline comments
 
% if c.repo_branches:
 
    <table class="table_disp">
 
        <tr>
 
            <th class="left">${_('date')}</th>
 
            <th class="left">${_('revision')}</th>
 
            <th class="left">${_('name')}</th>
 
            <th class="left">${_('links')}</th>
 
        </tr>
 
		%for cnt,branch in enumerate(c.repo_branches.items()):
 
		<tr class="parity${cnt%2}">
 
			<td>${h.age(branch[1]._ctx.date())}</td>
 
			<td>r${branch[1].revision}:${branch[1].raw_id}</td>
 
			<td>r${branch[1].revision}:${branch[1].short_id}</td>
 
			<td>
 
				<span class="logtags">
 
					<span class="branchtag">${h.link_to(branch[0],
 
					h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
 
					h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].short_id))}</span>
 
				</span>			
 
			</td>
 
			<td class="nowrap">
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].short_id))}
 
			|
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id))}
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch[1].short_id))}
 
			</td>
 
		</tr>	
 
		%endfor
 
    </table>
 
%else:
 
	${_('There are no branches yet')}
 
%endif
 

	
pylons_app/templates/changelog/changelog.html
Show inline comments
 
@@ -25,81 +25,81 @@
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="table">
 
		% if c.pagination:
 
			<div id="graph">
 
				<div id="graph_nodes">
 
					<canvas id="graph_canvas"></canvas>
 
				</div>
 
				<div id="graph_content">
 
					<div class="container_header">
 
						
 
        ${h.form(h.url.current(),method='get')}
 
        <div class="info_box">
 
          <span>${_('Show')}:</span>
 
          ${h.text('size',size=1,value=c.size)}
 
          <span>${_('revisions')}</span>
 
          ${h.submit('set',_('set'))}
 
        </div>
 
        ${h.end_form()}
 
						
 
					</div>
 
				%for cnt,cs in enumerate(c.pagination):
 
					<div id="chg_${cnt+1}" class="container">
 
						<div class="left">
 
							<div class="date">${_('commit')} ${cs.revision}: ${cs.raw_id}@${cs.date}</div>
 
							<div class="date">${_('commit')} ${cs.revision}: ${cs.short_id}@${cs.date}</div>
 
								<span class="logtags">
 
									<span class="branchtag">${cs.branch}</span>
 
									%for tag in cs.tags:
 
										<span class="tagtag">${tag}</span>
 
									%endfor
 
								</span>					
 
							<div class="author">
 
								<div class="gravatar">
 
									<img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),20)}"/>
 
								</div>
 
								<span>${h.person(cs.author)}</span><br/>
 
								<span><a href="mailto:${h.email_or_none(cs.author)}">${h.email_or_none(cs.author)}</a></span><br/>
 
							</div>
 
							<div class="message">
 
								${h.link_to(h.wrap_paragraphs(cs.message),
 
								h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
								h.url('changeset_home',repo_name=c.repo_name,revision=cs.short_id))}
 
							</div>
 
						</div>	
 
						<div class="right">
 
									<div class="changes">
 
										<span class="removed" title="${_('removed')}">${len(cs.removed)}</span>
 
										<span class="changed" title="${_('changed')}">${len(cs.changed)}</span>
 
										<span class="added" title="${_('added')}">${len(cs.added)}</span>
 
									</div>					
 
										%if len(cs.parents)>1:
 
										<div class="merge">
 
											${_('merge')}<img alt="merge" src="/images/icons/arrow_join.png"/>
 
										</div>
 
										%endif						
 
									%for p_cs in reversed(cs.parents):
 
										<div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(p_cs.raw_id,
 
											h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}
 
										<div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(p_cs.short_id,
 
											h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.short_id),title=p_cs.message)}
 
										</div>
 
									%endfor								
 
						</div>				
 
					</div>
 
					
 
				%endfor
 
				<div class="pagination-wh pagination-left">
 
					${c.pagination.pager('$link_previous ~2~ $link_next')}
 
				</div>			
 
				</div>
 
			</div>
 
			
 
			<script type="text/javascript" src="/js/graph.js"></script>
 
			<script type="text/javascript">
 
				YAHOO.util.Event.onDOMReady(function(){
 
					function set_canvas() {
 
						var c = document.getElementById('graph_nodes');
 
						var t = document.getElementById('graph_content');
 
						canvas = document.getElementById('graph_canvas');
 
						var div_h = t.clientHeight;
 
						c.style.height=div_h+'px';
 
						canvas.setAttribute('height',div_h);
 
						canvas.setAttribute('width',160);
 
					};
pylons_app/templates/changeset/changeset.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('Changeset')}
 
</%def>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    &raquo;
 
    ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
 
    &raquo;
 
    ${_('Changeset')} - r${c.changeset.revision}:${c.changeset.raw_id}
 
    ${_('Changeset')} - r${c.changeset.revision}:${c.changeset.short_id}
 
</%def>
 

	
 
<%def name="page_nav()">
 
    ${self.menu('changelog')}     
 
</%def>
 

	
 
<%def name="main()">
 
<div class="box">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="table">
 
		<div id="body" class="diffblock">
 
			<div class="code-header">
 
				<div>
 
				${_('Changeset')} - r${c.changeset.revision}:${c.changeset.raw_id}
 
				${_('Changeset')} - r${c.changeset.revision}:${c.changeset.short_id}
 
				 &raquo; <span>${h.link_to(_('raw diff'),
 
				h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show'))}</span>
 
				h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.short_id,diff='show'))}</span>
 
				 &raquo; <span>${h.link_to(_('download diff'),
 
				h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download'))}</span>
 
				h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.short_id,diff='download'))}</span>
 
				</div>
 
			</div>
 
		</div>
 
		    
 
    <div id="changeset_content">
 
		<div class="container">
 
			<div class="left">
 
				<div class="date">${_('Date')}: ${c.changeset.date}</div>
 
				<div class="author">${_('Author')}: ${c.changeset.author}</div>
 
				<div class="message">${h.wrap_paragraphs(c.changeset.message)}</div>
 
			</div>	
 
			<div class="right">
 
				<span class="logtags">
 
					<span class="branchtag">${c.changeset.branch}</span>
 
					%for tag in c.changeset.tags:
 
						<span class="tagtag">${tag}</span>
 
					%endfor
 
				</span>					
 
				%if len(c.changeset.parents)>1:
 
				<div class="merge">		
 
				${_('merge')}
 
				<img alt="merge" src="/images/icons/arrow_join.png">
 
				</div>
 
				%endif						
 
				%for p_cs in reversed(c.changeset.parents):
 
					<div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(p_cs.raw_id,
 
						h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}
 
					<div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(p_cs.short_id,
 
						h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.short_id),title=p_cs.message)}
 
					</div>
 
				%endfor								
 
			</div>		
 
		</div>
 
		<span style="font-size:1.1em;font-weight: bold">${_('Files affected')}</span>
 
	    <div class="cs_files">
 
				%for change,filenode,diff,cs1,cs2 in c.changes:
 
					<div class="cs_${change}">${h.link_to(filenode.path,h.url.current(anchor='CHANGE-%s'%filenode.path))}</div>
 
				%endfor
 
		</div>		    
 
    </div>
 
    	
 
	%for change,filenode,diff,cs1,cs2 in c.changes:
 
		%if change !='removed':
 
		<div style="clear:both;height:10px"></div>
 
		<div id="body" class="diffblock">
 
			<div id="${'CHANGE-%s'%filenode.path}" class="code-header">
 
				<div>
 
					<span>
 
						${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name,
 
						revision=filenode.changeset.raw_id,f_path=filenode.path))}
 
						revision=filenode.changeset.short_id,f_path=filenode.path))}
 
					</span>
 
					%if 1:
 
					&raquo; <span>${h.link_to(_('diff'),
 
					h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='diff'))}</span>
 
					&raquo; <span>${h.link_to(_('raw diff'),
 
					h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='raw'))}</span>
 
					&raquo; <span>${h.link_to(_('download diff'),
 
					h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='download'))}</span>
 
					%endif
 
				</div>
 
			</div>
 
			<div class="code-body">        
 
					%if diff:
 
						${diff|n}
 
					%else:
 
						${_('No changes in this file')}
 
					%endif
 
			</div>
 
		</div>
 
		%endif
 
	%endfor 
 
    </div>
 
</div>    
 
	
pylons_app/templates/files/files_annotate.html
Show inline comments
 
@@ -5,57 +5,57 @@
 
</%def>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    &raquo;
 
    ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
 
    &raquo;
 
    ${_('annotate')} @ R${c.rev_nr}:${c.cur_rev}
 
</%def>
 

	
 
<%def name="page_nav()">
 
		${self.menu('files')}     
 
</%def>
 
<%def name="main()">
 
<div class="box">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="table">
 
		<div id="files_data">
 
			<h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.file.path)}</h3>
 
			<dl class="overview">
 
				<dt>${_('Last revision')}</dt>
 
				<dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,c.file.last_changeset._short),
 
						h.url('files_annotate_home',repo_name=c.repo_name,revision=c.file.last_changeset._short,f_path=c.f_path))} </dd>
 
				<dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,c.file.last_changeset.short_id),
 
						h.url('files_annotate_home',repo_name=c.repo_name,revision=c.file.last_changeset.short_id,f_path=c.f_path))} </dd>
 
				<dt>${_('Size')}</dt>
 
				<dd>${h.format_byte_size(c.file.size,binary=True)}</dd>
 
    			<dt>${_('Mimetype')}</dt>
 
				<dd>${c.file.mimetype}</dd>				
 
				<dt>${_('Options')}</dt>
 
				<dd>${h.link_to(_('show source'),
 
						h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}  
 
					/ ${h.link_to(_('show as raw'),
 
						h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
 
					/ ${h.link_to(_('download as raw'),
 
						h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
 
				</dd>				
 
			</dl>
 
			<div id="body" class="codeblock">
 
				<div class="code-header">
 
					<div class="revision">${c.file.name}@r${c.file.last_changeset.revision}:${c.file.last_changeset._short}</div>
 
					<div class="revision">${c.file.name}@r${c.file.last_changeset.revision}:${c.file.last_changeset.short_id}</div>
 
					<div class="commit">"${c.file_msg}"</div>
 
				</div>
 
				<div class="code-body">
 
					% if c.file.size < c.file_size_limit:
 
						${h.pygmentize_annotation(c.file,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
 
					%else:
 
						${_('File is to big to display')} ${h.link_to(_('show as raw'),
 
						h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
 
					%endif				
 
				</div>
 
			</div>
 
		</div>    
 
    </div>
 
</div>    
 
</%def>   
 
\ No newline at end of file
pylons_app/templates/files/files_source.html
Show inline comments
 
<dl>
 
	<dt>${_('Last revision')}</dt>
 
	<dd>
 
		${h.link_to("r%s:%s" % (c.files_list.last_changeset.revision,c.files_list.last_changeset._short),
 
						h.url('files_home',repo_name=c.repo_name,revision=c.files_list.last_changeset._short,f_path=c.f_path))} 
 
		${h.link_to("r%s:%s" % (c.files_list.last_changeset.revision,c.files_list.last_changeset.short_id),
 
						h.url('files_home',repo_name=c.repo_name,revision=c.files_list.last_changeset.short_id,f_path=c.f_path))} 
 
	</dd>
 
	<dt>${_('Size')}</dt>
 
	<dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd>
 
	<dt>${_('Mimetype')}</dt>
 
	<dd>${c.files_list.mimetype}</dd>
 
	<dt>${_('Options')}</dt>
 
	<dd>${h.link_to(_('show annotation'),
 
			h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
 
		 / ${h.link_to(_('show as raw'),
 
			h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}			
 
		 / ${h.link_to(_('download as raw'),
 
			h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
 
	</dd>
 
	<dt>${_('History')}</dt>
 
	<dd>
 
		<div>
 
		${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
 
		${h.hidden('diff2',c.files_list.last_changeset._short)}
 
		${h.select('diff1',c.files_list.last_changeset._short,c.file_history)}
 
		${h.hidden('diff2',c.files_list.last_changeset.short_id)}
 
		${h.select('diff1',c.files_list.last_changeset.short_id,c.file_history)}
 
		${h.submit('diff','diff to revision',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
		${h.submit('show_rev','show at revision',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
		${h.end_form()}
 
		</div>
 
	</dd>
 
</dl>	
 

	
 
	
 
<div id="body" class="codeblock">
 
	<div class="code-header">
 
		<div class="revision">${c.files_list.name}@r${c.files_list.last_changeset.revision}:${c.files_list.last_changeset._short}</div>
 
		<div class="revision">${c.files_list.name}@r${c.files_list.last_changeset.revision}:${c.files_list.last_changeset.short_id}</div>
 
		<div class="commit">"${c.files_list.last_changeset.message}"</div>
 
	</div>
 
	<div class="code-body">
 
		% if c.files_list.size < c.file_size_limit:
 
			${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
 
		%else:
 
			${_('File is to big to display')} ${h.link_to(_('show as raw'),
 
			h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
 
		%endif
 
	</div>
 
</div>
 

	
 
<script type="text/javascript">
 
YAHOO.util.Event.onDOMReady(function(){
 
    YAHOO.util.Event.addListener('show_rev','click',function(e){
 
    	YAHOO.util.Event.preventDefault(e);
 
        var cs = YAHOO.util.Dom.get('diff1').value;
 
        var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs);
 
        window.location = url;
 
        });
 
   });
 
</script>
 
\ No newline at end of file
pylons_app/templates/shortlog/shortlog_data.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
% if c.repo_changesets:
 
<table>
 
	<tr>
 
		<th class="left">${_('date')}</th>
 
		<th class="left">${_('author')}</th>
 
		<th class="left">${_('revision')}</th>
 
		<th class="left">${_('commit message')}</th>
 
		<th class="left">${_('branch')}</th>
 
		<th class="left">${_('tags')}</th>
 
		<th class="left">${_('links')}</th>
 
		
 
	</tr>
 
%for cnt,cs in enumerate(c.repo_changesets):
 
	<tr class="parity${cnt%2}">
 
		<td>${h.age(cs._ctx.date())} - ${h.rfc822date_notz(cs._ctx.date())} </td>
 
		<td title="${cs.author}">${h.person(cs.author)}</td>
 
		<td>r${cs.revision}:${cs.raw_id}</td>
 
		<td>r${cs.revision}:${cs.short_id}</td>
 
		<td>
 
			${h.link_to(h.truncate(cs.message,60),
 
			h.url('changeset_home',repo_name=c.repo_name,revision=cs._short),
 
			h.url('changeset_home',repo_name=c.repo_name,revision=cs.short_id),
 
			title=cs.message)}
 
		</td>
 
		<td>
 
			<span class="logtags">
 
				<span class="branchtag">${cs.branch}</span>
 
			</span>
 
		</td>
 
		<td>
 
			<span class="logtags">
 
				%for tag in cs.tags:
 
					<span class="tagtag">${tag}</span>
 
				%endfor
 
			</span>
 
		</td>
 
		<td class="nowrap">
 
		${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
		${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs.short_id))}
 
		|
 
		${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
		${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs.short_id))}
 
		</td>
 
	</tr>
 
%endfor
 

	
 
</table>
 

	
 
<script type="text/javascript">
 
  var data_div = 'shortlog_data';
 
  YAHOO.util.Event.onDOMReady(function(){
 
    YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
 
            YAHOO.util.Dom.setStyle('shortlog_data','opacity','0.3');});});
 
</script>
 

	
 
<div class="pagination-wh pagination-left">
 
${c.repo_changesets.pager('$link_previous ~2~ $link_next',     
 
onclick="""YAHOO.util.Connect.asyncRequest('GET','$partial_url',{
 
success:function(o){YAHOO.util.Dom.get(data_div).innerHTML=o.responseText;
 
YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
 
        YAHOO.util.Dom.setStyle(data_div,'opacity','0.3');});       
 
YAHOO.util.Dom.setStyle(data_div,'opacity','1');}},null); return false;""")}
 
</div>
 
%else:
 
    ${_('There are no changes yet')}
 
%endif
pylons_app/templates/tags/tags_data.html
Show inline comments
 
%if c.repo_tags:    
 
    <table>
 
    	<tr>
 
			<th class="left">${_('date')}</th>
 
			<th class="left">${_('revision')}</th>
 
			<th class="left">${_('name')}</th>
 
			<th class="left">${_('links')}</th>
 
    	</tr>
 
		%for cnt,tag in enumerate(c.repo_tags.items()):
 
		<tr class="parity${cnt%2}">
 
			<td>${h.age(tag[1]._ctx.date())}</td>
 
			<td>r${tag[1].revision}:${tag[1].raw_id}</td>
 
			<td>r${tag[1].revision}:${tag[1].short_id}</td>
 
			<td>
 
				<span class="logtags">
 
					<span class="tagtag">${h.link_to(tag[0],
 
					h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}</span>
 
					h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].short_id))}</span>
 
				</span>
 
			</td>
 
			<td class="nowrap">
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].short_id))}
 
			|
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag[1].short_id))}
 
			</td>
 
		</tr>	
 
		%endfor
 
    </table>
 
%else:
 
	${_('There are no tags yet')}
 
%endif    
 
\ No newline at end of file
setup.py
Show inline comments
 
from pylons_app import get_version
 
try:
 
    from setuptools import setup, find_packages
 
except ImportError:
 
    from ez_setup import use_setuptools
 
    use_setuptools()
 
    from setuptools import setup, find_packages
 

	
 
setup(
 
    name='HgApp-%s' % get_version(),
 
    version=get_version(),
 
    description='Mercurial repository serving and browsing app',
 
    keywords='mercurial web hgwebdir replacement serving hgweb',
 
    license='BSD',
 
    author='marcin kuzminski',
 
    author_email='marcin@python-works.com',
 
    url='http://hg.python-works.com',
 
    install_requires=[
 
        "Pylons>=1.0.0",
 
        "SQLAlchemy>=0.6",
 
        "babel",
 
        "Mako>=0.3.2",
 
        "vcs>=0.1.5",
 
        "vcs>=0.1.6",
 
        "pygments>=1.3.0",
 
        "mercurial>=1.6",
 
        "pysqlite",
 
        "whoosh==1.0.0b17",
 
        "py-bcrypt",
 
        "celery",
 
    ],
 
    setup_requires=["PasteScript>=1.6.3"],
 
    packages=find_packages(exclude=['ez_setup']),
 
    include_package_data=True,
 
    test_suite='nose.collector',
 
    package_data={'pylons_app': ['i18n/*/LC_MESSAGES/*.mo']},
 
    message_extractors={'pylons_app': [
 
            ('**.py', 'python', None),
 
            ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
 
            ('public/**', 'ignore', None)]},
 
    zip_safe=False,
 
    paster_plugins=['PasteScript', 'Pylons'],
 
    entry_points="""
 
    [paste.app_factory]
 
    main = pylons_app.config.middleware:make_app
 

	
 
    [paste.app_install]
 
    main = pylons.util:PylonsInstaller
0 comments (0 inline, 0 general)