Mercurial > kallithea
annotate rhodecode/lib/helpers.py @ 2111:122f15a8f6ec beta
fixed issue with escaping < and > in changeset commits
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 07 Mar 2012 05:26:33 +0200 |
parents | 8ecfed1d8f8b |
children | 2f2695771579 |
rev | line source |
---|---|
0 | 1 """Helper functions |
2 | |
3 Consists of functions to typically be used within templates, but also | |
4 available to Controllers. This module is available to both as 'h'. | |
5 """ | |
734
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
6 import random |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
7 import hashlib |
966
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
8 import StringIO |
1101
c1080b42a7cb
fixed problem with int. chars in gravatars
Marcin Kuzminski <marcin@python-works.com>
parents:
1100
diff
changeset
|
9 import urllib |
1422
e69da281e235
fixed issues with repo pager
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
10 import math |
1837
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
11 import logging |
1101
c1080b42a7cb
fixed problem with int. chars in gravatars
Marcin Kuzminski <marcin@python-works.com>
parents:
1100
diff
changeset
|
12 |
1154
36fe593dfe4b
simplified str2bool, and moved safe_unicode out of helpers since it was not html specific function
Marcin Kuzminski <marcin@python-works.com>
parents:
1115
diff
changeset
|
13 from datetime import datetime |
1716
7d1fc253549e
notification to commit author + gardening
Marcin Kuzminski <marcin@python-works.com>
parents:
1676
diff
changeset
|
14 from pygments.formatters.html import HtmlFormatter |
250
be4621c6de58
Pygments code coloring rewrite, annotation was moved to vcs whitch had much better lib for that. Fixed code recognition based on mimetypes of filenodes, for better coloring.
Marcin Kuzminski <marcin@python-works.com>
parents:
165
diff
changeset
|
15 from pygments import highlight as code_highlight |
1110
5351a3a32381
#21 added optional flag to disable gravatar, and use local icon
Marcin Kuzminski <marcin@python-works.com>
parents:
1105
diff
changeset
|
16 from pylons import url, request, config |
97
be0096a02772
added helper for filesize
Marcin Kuzminski <marcin@python-works.com>
parents:
94
diff
changeset
|
17 from pylons.i18n.translation import _, ungettext |
1832
b9708d66277c
fixed problem with anchor links that contains non ascii chars
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
18 from hashlib import md5 |
1022
4f834b0abcd3
Code refactor number 2
Marcin Kuzminski <marcin@python-works.com>
parents:
1009
diff
changeset
|
19 |
250
be4621c6de58
Pygments code coloring rewrite, annotation was moved to vcs whitch had much better lib for that. Fixed code recognition based on mimetypes of filenodes, for better coloring.
Marcin Kuzminski <marcin@python-works.com>
parents:
165
diff
changeset
|
20 from webhelpers.html import literal, HTML, escape |
281
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
21 from webhelpers.html.tools import * |
98
01d0f363f36d
added pygments webhelper
Marcin Kuzminski <marcin@python-works.com>
parents:
97
diff
changeset
|
22 from webhelpers.html.builder import make_tag |
250
be4621c6de58
Pygments code coloring rewrite, annotation was moved to vcs whitch had much better lib for that. Fixed code recognition based on mimetypes of filenodes, for better coloring.
Marcin Kuzminski <marcin@python-works.com>
parents:
165
diff
changeset
|
23 from webhelpers.html.tags import auto_discovery_link, checkbox, css_classes, \ |
1766 | 24 end_form, file, form, hidden, image, javascript_link, link_to, \ |
25 link_to_if, link_to_unless, ol, required_legend, select, stylesheet_link, \ | |
26 submit, text, password, textarea, title, ul, xml_declaration, radio | |
27 from webhelpers.html.tools import auto_link, button_to, highlight, \ | |
28 js_obfuscate, mail_to, strip_links, strip_tags, tag_re | |
250
be4621c6de58
Pygments code coloring rewrite, annotation was moved to vcs whitch had much better lib for that. Fixed code recognition based on mimetypes of filenodes, for better coloring.
Marcin Kuzminski <marcin@python-works.com>
parents:
165
diff
changeset
|
29 from webhelpers.number import format_byte_size, format_bit_size |
0 | 30 from webhelpers.pylonslib import Flash as _Flash |
31 from webhelpers.pylonslib.secure_form import secure_form | |
250
be4621c6de58
Pygments code coloring rewrite, annotation was moved to vcs whitch had much better lib for that. Fixed code recognition based on mimetypes of filenodes, for better coloring.
Marcin Kuzminski <marcin@python-works.com>
parents:
165
diff
changeset
|
32 from webhelpers.text import chop_at, collapse, convert_accented_entities, \ |
be4621c6de58
Pygments code coloring rewrite, annotation was moved to vcs whitch had much better lib for that. Fixed code recognition based on mimetypes of filenodes, for better coloring.
Marcin Kuzminski <marcin@python-works.com>
parents:
165
diff
changeset
|
33 convert_misc_entities, lchop, plural, rchop, remove_formatting, \ |
281
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
34 replace_whitespace, urlify, truncate, wrap_paragraphs |
635
fd63782c4426
Fixed age, for new vcs implementation. Removed all obsolete date formatters
Marcin Kuzminski <marcin@python-works.com>
parents:
631
diff
changeset
|
35 from webhelpers.date import time_ago_in_words |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
36 from webhelpers.paginate import Page |
698
4cd0709b6d4b
fixes #65, Added reset buttons to edit forms
Marcin Kuzminski <marcin@python-works.com>
parents:
668
diff
changeset
|
37 from webhelpers.html.tags import _set_input_attrs, _set_id_attr, \ |
1676
e86191684f4b
fixed some anchor id problems for changeset ranges
Marcin Kuzminski <marcin@python-works.com>
parents:
1670
diff
changeset
|
38 convert_boolean_attrs, NotGiven, _make_safe_id_component |
698
4cd0709b6d4b
fixes #65, Added reset buttons to edit forms
Marcin Kuzminski <marcin@python-works.com>
parents:
668
diff
changeset
|
39 |
1753
1d1ccb873d00
moved soon-to-be-deleted code from vcs to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
1747
diff
changeset
|
40 from rhodecode.lib.annotate import annotate_highlight |
1101
c1080b42a7cb
fixed problem with int. chars in gravatars
Marcin Kuzminski <marcin@python-works.com>
parents:
1100
diff
changeset
|
41 from rhodecode.lib.utils import repo_name_slug |
2109 | 42 from rhodecode.lib.utils2 import str2bool, safe_unicode, safe_str, \ |
43 get_changeset_safe | |
1670
d2de0c2f02cd
#77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1656
diff
changeset
|
44 from rhodecode.lib.markup_renderer import MarkupRenderer |
d2de0c2f02cd
#77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1656
diff
changeset
|
45 |
1837
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
46 log = logging.getLogger(__name__) |
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
47 |
1789
17caf4efe15c
implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents:
1781
diff
changeset
|
48 |
698
4cd0709b6d4b
fixes #65, Added reset buttons to edit forms
Marcin Kuzminski <marcin@python-works.com>
parents:
668
diff
changeset
|
49 def _reset(name, value=None, id=NotGiven, type="reset", **attrs): |
1154
36fe593dfe4b
simplified str2bool, and moved safe_unicode out of helpers since it was not html specific function
Marcin Kuzminski <marcin@python-works.com>
parents:
1115
diff
changeset
|
50 """ |
36fe593dfe4b
simplified str2bool, and moved safe_unicode out of helpers since it was not html specific function
Marcin Kuzminski <marcin@python-works.com>
parents:
1115
diff
changeset
|
51 Reset button |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
52 """ |
698
4cd0709b6d4b
fixes #65, Added reset buttons to edit forms
Marcin Kuzminski <marcin@python-works.com>
parents:
668
diff
changeset
|
53 _set_input_attrs(attrs, type, name, value) |
4cd0709b6d4b
fixes #65, Added reset buttons to edit forms
Marcin Kuzminski <marcin@python-works.com>
parents:
668
diff
changeset
|
54 _set_id_attr(attrs, id, name) |
4cd0709b6d4b
fixes #65, Added reset buttons to edit forms
Marcin Kuzminski <marcin@python-works.com>
parents:
668
diff
changeset
|
55 convert_boolean_attrs(attrs, ["disabled"]) |
4cd0709b6d4b
fixes #65, Added reset buttons to edit forms
Marcin Kuzminski <marcin@python-works.com>
parents:
668
diff
changeset
|
56 return HTML.input(**attrs) |
4cd0709b6d4b
fixes #65, Added reset buttons to edit forms
Marcin Kuzminski <marcin@python-works.com>
parents:
668
diff
changeset
|
57 |
4cd0709b6d4b
fixes #65, Added reset buttons to edit forms
Marcin Kuzminski <marcin@python-works.com>
parents:
668
diff
changeset
|
58 reset = _reset |
1676
e86191684f4b
fixed some anchor id problems for changeset ranges
Marcin Kuzminski <marcin@python-works.com>
parents:
1670
diff
changeset
|
59 safeid = _make_safe_id_component |
734
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
60 |
1789
17caf4efe15c
implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents:
1781
diff
changeset
|
61 |
17caf4efe15c
implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents:
1781
diff
changeset
|
62 def FID(raw_id, path): |
1776
22333ddd1a40
implements #307, configurable diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
1769
diff
changeset
|
63 """ |
1832
b9708d66277c
fixed problem with anchor links that contains non ascii chars
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
64 Creates a uniqe ID for filenode based on it's hash of path and revision |
b9708d66277c
fixed problem with anchor links that contains non ascii chars
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
65 it's safe to use in urls |
1789
17caf4efe15c
implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents:
1781
diff
changeset
|
66 |
1776
22333ddd1a40
implements #307, configurable diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
1769
diff
changeset
|
67 :param raw_id: |
22333ddd1a40
implements #307, configurable diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
1769
diff
changeset
|
68 :param path: |
22333ddd1a40
implements #307, configurable diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
1769
diff
changeset
|
69 """ |
1832
b9708d66277c
fixed problem with anchor links that contains non ascii chars
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
70 |
b9708d66277c
fixed problem with anchor links that contains non ascii chars
Marcin Kuzminski <marcin@python-works.com>
parents:
1818
diff
changeset
|
71 return 'C-%s-%s' % (short_id(raw_id), md5(path).hexdigest()[:12]) |
1776
22333ddd1a40
implements #307, configurable diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
1769
diff
changeset
|
72 |
22333ddd1a40
implements #307, configurable diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
1769
diff
changeset
|
73 |
734
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
74 def get_token(): |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
75 """Return the current authentication token, creating one if one doesn't |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
76 already exist. |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
77 """ |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
78 token_key = "_authentication_token" |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
79 from pylons import session |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
80 if not token_key in session: |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
81 try: |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
82 token = hashlib.sha1(str(random.getrandbits(128))).hexdigest() |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
83 except AttributeError: # Python < 2.4 |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
84 token = hashlib.sha1(str(random.randrange(2 ** 128))).hexdigest() |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
85 session[token_key] = token |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
86 if hasattr(session, 'save'): |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
87 session.save() |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
88 return session[token_key] |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
89 |
0 | 90 class _GetError(object): |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
91 """Get error from form_errors, and represent it as span wrapped error |
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
92 message |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1187
diff
changeset
|
93 |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
94 :param field_name: field to fetch errors for |
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
95 :param form_errors: form errors dict |
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
96 """ |
0 | 97 |
98 def __call__(self, field_name, form_errors): | |
99 tmpl = """<span class="error_msg">%s</span>""" | |
100 if form_errors and form_errors.has_key(field_name): | |
101 return literal(tmpl % form_errors.get(field_name)) | |
102 | |
281
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
103 get_error = _GetError() |
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
104 |
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
105 class _ToolTip(object): |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
106 |
281
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
107 def __call__(self, tooltip_title, trim_at=50): |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1187
diff
changeset
|
108 """Special function just to wrap our text into nice formatted |
905
1294f2baf2bc
added wrapping of long tooltips in index page
Marcin Kuzminski <marcin@python-works.com>
parents:
904
diff
changeset
|
109 autowrapped text |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1187
diff
changeset
|
110 |
604
5cc96df705b9
fixed @repo into :repo for docs
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
111 :param tooltip_title: |
281
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
112 """ |
1352
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
113 return escape(tooltip_title) |
281
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
114 tooltip = _ToolTip() |
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
115 |
102
2dc0c8e4f384
Updated tempaltes, added file browser breadcrumbs, and feed icons
Marcin Kuzminski <marcin@python-works.com>
parents:
98
diff
changeset
|
116 class _FilesBreadCrumbs(object): |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
117 |
102
2dc0c8e4f384
Updated tempaltes, added file browser breadcrumbs, and feed icons
Marcin Kuzminski <marcin@python-works.com>
parents:
98
diff
changeset
|
118 def __call__(self, repo_name, rev, paths): |
955
129eb072b8a8
fixes for #99, added casting to unicode for int chars as utf-8 files
Marcin Kuzminski <marcin@python-works.com>
parents:
953
diff
changeset
|
119 if isinstance(paths, str): |
1176
014c9a58a0d9
fixes for issues #137 and #116 safe_unicode is now default for handling file names
Marcin Kuzminski <marcin@python-works.com>
parents:
1171
diff
changeset
|
120 paths = safe_unicode(paths) |
287
5827c739b0bd
webhelpers breadcrumbs bugfix
Marcin Kuzminski <marcin@python-works.com>
parents:
286
diff
changeset
|
121 url_l = [link_to(repo_name, url('files_home', |
5827c739b0bd
webhelpers breadcrumbs bugfix
Marcin Kuzminski <marcin@python-works.com>
parents:
286
diff
changeset
|
122 repo_name=repo_name, |
5827c739b0bd
webhelpers breadcrumbs bugfix
Marcin Kuzminski <marcin@python-works.com>
parents:
286
diff
changeset
|
123 revision=rev, f_path=''))] |
5827c739b0bd
webhelpers breadcrumbs bugfix
Marcin Kuzminski <marcin@python-works.com>
parents:
286
diff
changeset
|
124 paths_l = paths.split('/') |
740
9279dfedcf93
fixed python2.5 incompatible enumerate calls
Marcin Kuzminski <marcin@python-works.com>
parents:
735
diff
changeset
|
125 for cnt, p in enumerate(paths_l): |
102
2dc0c8e4f384
Updated tempaltes, added file browser breadcrumbs, and feed icons
Marcin Kuzminski <marcin@python-works.com>
parents:
98
diff
changeset
|
126 if p != '': |
1789
17caf4efe15c
implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents:
1781
diff
changeset
|
127 url_l.append(link_to(p, |
1766 | 128 url('files_home', |
129 repo_name=repo_name, | |
130 revision=rev, | |
131 f_path='/'.join(paths_l[:cnt + 1]) | |
132 ) | |
133 ) | |
134 ) | |
97
be0096a02772
added helper for filesize
Marcin Kuzminski <marcin@python-works.com>
parents:
94
diff
changeset
|
135 |
448
4679105ef03e
more css html fixes (+cleanups), rewrote definition list for files
Marcin Kuzminski <marcin@python-works.com>
parents:
444
diff
changeset
|
136 return literal('/'.join(url_l)) |
98
01d0f363f36d
added pygments webhelper
Marcin Kuzminski <marcin@python-works.com>
parents:
97
diff
changeset
|
137 |
281
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
138 files_breadcrumbs = _FilesBreadCrumbs() |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
139 |
505
5aba7adff196
little gui change for file source
Marcin Kuzminski <marcin@python-works.com>
parents:
494
diff
changeset
|
140 class CodeHtmlFormatter(HtmlFormatter): |
966
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
141 """My code Html Formatter for source codes |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
142 """ |
281
cd2ee462fc2c
implemented yui tooltip, and added it into annotation and main page.
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
143 |
505
5aba7adff196
little gui change for file source
Marcin Kuzminski <marcin@python-works.com>
parents:
494
diff
changeset
|
144 def wrap(self, source, outfile): |
5aba7adff196
little gui change for file source
Marcin Kuzminski <marcin@python-works.com>
parents:
494
diff
changeset
|
145 return self._wrap_div(self._wrap_pre(self._wrap_code(source))) |
5aba7adff196
little gui change for file source
Marcin Kuzminski <marcin@python-works.com>
parents:
494
diff
changeset
|
146 |
5aba7adff196
little gui change for file source
Marcin Kuzminski <marcin@python-works.com>
parents:
494
diff
changeset
|
147 def _wrap_code(self, source): |
740
9279dfedcf93
fixed python2.5 incompatible enumerate calls
Marcin Kuzminski <marcin@python-works.com>
parents:
735
diff
changeset
|
148 for cnt, it in enumerate(source): |
505
5aba7adff196
little gui change for file source
Marcin Kuzminski <marcin@python-works.com>
parents:
494
diff
changeset
|
149 i, t = it |
966
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
150 t = '<div id="L%s">%s</div>' % (cnt + 1, t) |
505
5aba7adff196
little gui change for file source
Marcin Kuzminski <marcin@python-works.com>
parents:
494
diff
changeset
|
151 yield i, t |
966
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
152 |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
153 def _wrap_tablelinenos(self, inner): |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
154 dummyoutfile = StringIO.StringIO() |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
155 lncount = 0 |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
156 for t, line in inner: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
157 if t: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
158 lncount += 1 |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
159 dummyoutfile.write(line) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
160 |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
161 fl = self.linenostart |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
162 mw = len(str(lncount + fl - 1)) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
163 sp = self.linenospecial |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
164 st = self.linenostep |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
165 la = self.lineanchors |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
166 aln = self.anchorlinenos |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
167 nocls = self.noclasses |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
168 if sp: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
169 lines = [] |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
170 |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
171 for i in range(fl, fl + lncount): |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
172 if i % st == 0: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
173 if i % sp == 0: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
174 if aln: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
175 lines.append('<a href="#%s%d" class="special">%*d</a>' % |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
176 (la, i, mw, i)) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
177 else: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
178 lines.append('<span class="special">%*d</span>' % (mw, i)) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
179 else: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
180 if aln: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
181 lines.append('<a href="#%s%d">%*d</a>' % (la, i, mw, i)) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
182 else: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
183 lines.append('%*d' % (mw, i)) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
184 else: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
185 lines.append('') |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
186 ls = '\n'.join(lines) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
187 else: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
188 lines = [] |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
189 for i in range(fl, fl + lncount): |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
190 if i % st == 0: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
191 if aln: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
192 lines.append('<a href="#%s%d">%*d</a>' % (la, i, mw, i)) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
193 else: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
194 lines.append('%*d' % (mw, i)) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
195 else: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
196 lines.append('') |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
197 ls = '\n'.join(lines) |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
198 |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
199 # in case you wonder about the seemingly redundant <div> here: since the |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
200 # content in the other cell also is wrapped in a div, some browsers in |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
201 # some configurations seem to mess up the formatting... |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
202 if nocls: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
203 yield 0, ('<table class="%stable">' % self.cssclass + |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
204 '<tr><td><div class="linenodiv" ' |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
205 'style="background-color: #f0f0f0; padding-right: 10px">' |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
206 '<pre style="line-height: 125%">' + |
1320
09c3fb460fcb
Fixed problem with anchor link positioning when passed in ranges.
Marcin Kuzminski <marcin@python-works.com>
parents:
1312
diff
changeset
|
207 ls + '</pre></div></td><td id="hlcode" class="code">') |
966
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
208 else: |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
209 yield 0, ('<table class="%stable">' % self.cssclass + |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
210 '<tr><td class="linenos"><div class="linenodiv"><pre>' + |
1320
09c3fb460fcb
Fixed problem with anchor link positioning when passed in ranges.
Marcin Kuzminski <marcin@python-works.com>
parents:
1312
diff
changeset
|
211 ls + '</pre></div></td><td id="hlcode" class="code">') |
966
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
212 yield 0, dummyoutfile.getvalue() |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
213 yield 0, '</td></tr></table>' |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
214 |
63c91390853c
fixed line number look
Marcin Kuzminski <marcin@python-works.com>
parents:
965
diff
changeset
|
215 |
250
be4621c6de58
Pygments code coloring rewrite, annotation was moved to vcs whitch had much better lib for that. Fixed code recognition based on mimetypes of filenodes, for better coloring.
Marcin Kuzminski <marcin@python-works.com>
parents:
165
diff
changeset
|
216 def pygmentize(filenode, **kwargs): |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
217 """pygmentize function using pygments |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1187
diff
changeset
|
218 |
604
5cc96df705b9
fixed @repo into :repo for docs
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
219 :param filenode: |
165
ea893ffb7f00
implemented pygmentize codes into webhelpers. Together with color_dict caching into pylons globals
Marcin Kuzminski <marcin@python-works.com>
parents:
104
diff
changeset
|
220 """ |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
221 |
450
c3236d7febad
fixed, empty cs bug.
Marcin Kuzminski <marcin@python-works.com>
parents:
448
diff
changeset
|
222 return literal(code_highlight(filenode.content, |
505
5aba7adff196
little gui change for file source
Marcin Kuzminski <marcin@python-works.com>
parents:
494
diff
changeset
|
223 filenode.lexer, CodeHtmlFormatter(**kwargs))) |
165
ea893ffb7f00
implemented pygmentize codes into webhelpers. Together with color_dict caching into pylons globals
Marcin Kuzminski <marcin@python-works.com>
parents:
104
diff
changeset
|
224 |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
225 |
1171
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
226 def pygmentize_annotation(repo_name, filenode, **kwargs): |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
227 """ |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
228 pygmentize function for annotation |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1187
diff
changeset
|
229 |
604
5cc96df705b9
fixed @repo into :repo for docs
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
230 :param filenode: |
165
ea893ffb7f00
implemented pygmentize codes into webhelpers. Together with color_dict caching into pylons globals
Marcin Kuzminski <marcin@python-works.com>
parents:
104
diff
changeset
|
231 """ |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
232 |
438
0d4fceb91c9c
fixes #24, added generator that generates equally distrybuted colors. Thus skipping creating one large coloring history.
Marcin Kuzminski <marcin@python-works.com>
parents:
428
diff
changeset
|
233 color_dict = {} |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
234 |
947
99850ac883d1
Fixed whoosh daemon, for depracated walk method
Marcin Kuzminski <marcin@python-works.com>
parents:
946
diff
changeset
|
235 def gen_color(n=10000): |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1187
diff
changeset
|
236 """generator for getting n of evenly distributed colors using |
947
99850ac883d1
Fixed whoosh daemon, for depracated walk method
Marcin Kuzminski <marcin@python-works.com>
parents:
946
diff
changeset
|
237 hsv color and golden ratio. It always return same order of colors |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1187
diff
changeset
|
238 |
947
99850ac883d1
Fixed whoosh daemon, for depracated walk method
Marcin Kuzminski <marcin@python-works.com>
parents:
946
diff
changeset
|
239 :returns: RGB tuple |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
240 """ |
1461
e7d9d543364d
removed colorsys import
Marcin Kuzminski <marcin@python-works.com>
parents:
1438
diff
changeset
|
241 |
e7d9d543364d
removed colorsys import
Marcin Kuzminski <marcin@python-works.com>
parents:
1438
diff
changeset
|
242 def hsv_to_rgb(h, s, v): |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
243 if s == 0.0: |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
244 return v, v, v |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
245 i = int(h * 6.0) # XXX assume int() truncates! |
1461
e7d9d543364d
removed colorsys import
Marcin Kuzminski <marcin@python-works.com>
parents:
1438
diff
changeset
|
246 f = (h * 6.0) - i |
e7d9d543364d
removed colorsys import
Marcin Kuzminski <marcin@python-works.com>
parents:
1438
diff
changeset
|
247 p = v * (1.0 - s) |
e7d9d543364d
removed colorsys import
Marcin Kuzminski <marcin@python-works.com>
parents:
1438
diff
changeset
|
248 q = v * (1.0 - s * f) |
e7d9d543364d
removed colorsys import
Marcin Kuzminski <marcin@python-works.com>
parents:
1438
diff
changeset
|
249 t = v * (1.0 - s * (1.0 - f)) |
e7d9d543364d
removed colorsys import
Marcin Kuzminski <marcin@python-works.com>
parents:
1438
diff
changeset
|
250 i = i % 6 |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
251 if i == 0: |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
252 return v, t, p |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
253 if i == 1: |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
254 return q, v, p |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
255 if i == 2: |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
256 return p, v, t |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
257 if i == 3: |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
258 return p, q, v |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
259 if i == 4: |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
260 return t, p, v |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
261 if i == 5: |
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
262 return v, p, q |
1461
e7d9d543364d
removed colorsys import
Marcin Kuzminski <marcin@python-works.com>
parents:
1438
diff
changeset
|
263 |
438
0d4fceb91c9c
fixes #24, added generator that generates equally distrybuted colors. Thus skipping creating one large coloring history.
Marcin Kuzminski <marcin@python-works.com>
parents:
428
diff
changeset
|
264 golden_ratio = 0.618033988749895 |
0d4fceb91c9c
fixes #24, added generator that generates equally distrybuted colors. Thus skipping creating one large coloring history.
Marcin Kuzminski <marcin@python-works.com>
parents:
428
diff
changeset
|
265 h = 0.22717784590367374 |
947
99850ac883d1
Fixed whoosh daemon, for depracated walk method
Marcin Kuzminski <marcin@python-works.com>
parents:
946
diff
changeset
|
266 |
1320
09c3fb460fcb
Fixed problem with anchor link positioning when passed in ranges.
Marcin Kuzminski <marcin@python-works.com>
parents:
1312
diff
changeset
|
267 for _ in xrange(n): |
450
c3236d7febad
fixed, empty cs bug.
Marcin Kuzminski <marcin@python-works.com>
parents:
448
diff
changeset
|
268 h += golden_ratio |
438
0d4fceb91c9c
fixes #24, added generator that generates equally distrybuted colors. Thus skipping creating one large coloring history.
Marcin Kuzminski <marcin@python-works.com>
parents:
428
diff
changeset
|
269 h %= 1 |
0d4fceb91c9c
fixes #24, added generator that generates equally distrybuted colors. Thus skipping creating one large coloring history.
Marcin Kuzminski <marcin@python-works.com>
parents:
428
diff
changeset
|
270 HSV_tuple = [h, 0.95, 0.95] |
1461
e7d9d543364d
removed colorsys import
Marcin Kuzminski <marcin@python-works.com>
parents:
1438
diff
changeset
|
271 RGB_tuple = hsv_to_rgb(*HSV_tuple) |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
272 yield map(lambda x: str(int(x * 256)), RGB_tuple) |
438
0d4fceb91c9c
fixes #24, added generator that generates equally distrybuted colors. Thus skipping creating one large coloring history.
Marcin Kuzminski <marcin@python-works.com>
parents:
428
diff
changeset
|
273 |
0d4fceb91c9c
fixes #24, added generator that generates equally distrybuted colors. Thus skipping creating one large coloring history.
Marcin Kuzminski <marcin@python-works.com>
parents:
428
diff
changeset
|
274 cgenerator = gen_color() |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
275 |
165
ea893ffb7f00
implemented pygmentize codes into webhelpers. Together with color_dict caching into pylons globals
Marcin Kuzminski <marcin@python-works.com>
parents:
104
diff
changeset
|
276 def get_color_string(cs): |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
277 if cs in color_dict: |
165
ea893ffb7f00
implemented pygmentize codes into webhelpers. Together with color_dict caching into pylons globals
Marcin Kuzminski <marcin@python-works.com>
parents:
104
diff
changeset
|
278 col = color_dict[cs] |
ea893ffb7f00
implemented pygmentize codes into webhelpers. Together with color_dict caching into pylons globals
Marcin Kuzminski <marcin@python-works.com>
parents:
104
diff
changeset
|
279 else: |
438
0d4fceb91c9c
fixes #24, added generator that generates equally distrybuted colors. Thus skipping creating one large coloring history.
Marcin Kuzminski <marcin@python-works.com>
parents:
428
diff
changeset
|
280 col = color_dict[cs] = cgenerator.next() |
0d4fceb91c9c
fixes #24, added generator that generates equally distrybuted colors. Thus skipping creating one large coloring history.
Marcin Kuzminski <marcin@python-works.com>
parents:
428
diff
changeset
|
281 return "color: rgb(%s)! important;" % (', '.join(col)) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
282 |
1171
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
283 def url_func(repo_name): |
1352
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
284 |
1171
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
285 def _url_func(changeset): |
1352
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
286 author = changeset.author |
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
287 date = changeset.date |
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
288 message = tooltip(changeset.message) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
289 |
1352
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
290 tooltip_html = ("<div style='font-size:0.8em'><b>Author:</b>" |
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
291 " %s<br/><b>Date:</b> %s</b><br/><b>Message:" |
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
292 "</b> %s<br/></div>") |
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
293 |
79041f2d16f4
wrap_paragraph was to slow for toolip generation and was removed.
Marcin Kuzminski <marcin@python-works.com>
parents:
1342
diff
changeset
|
294 tooltip_html = tooltip_html % (author, date, message) |
1171
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
295 lnk_format = '%5s:%s' % ('r%s' % changeset.revision, |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
296 short_id(changeset.raw_id)) |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
297 uri = link_to( |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
298 lnk_format, |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
299 url('changeset_home', repo_name=repo_name, |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
300 revision=changeset.raw_id), |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
301 style=get_color_string(changeset.raw_id), |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
302 class_='tooltip', |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
303 title=tooltip_html |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
304 ) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
305 |
1171
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
306 uri += '\n' |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
307 return uri |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
308 return _url_func |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
309 |
2ab211e0aecd
changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
1159
diff
changeset
|
310 return literal(annotate_highlight(filenode, url_func(repo_name), **kwargs)) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
311 |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
312 |
999
1951c35483ab
fixed following js snipet. It' can be called multiple times now next to each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
995
diff
changeset
|
313 def is_following_repo(repo_name, user_id): |
1951c35483ab
fixed following js snipet. It' can be called multiple times now next to each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
995
diff
changeset
|
314 from rhodecode.model.scm import ScmModel |
1951c35483ab
fixed following js snipet. It' can be called multiple times now next to each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
995
diff
changeset
|
315 return ScmModel().is_following_repo(repo_name, user_id) |
1951c35483ab
fixed following js snipet. It' can be called multiple times now next to each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
995
diff
changeset
|
316 |
0 | 317 flash = _Flash() |
282
237470e64bb8
switched filters into webhelpers for easy of usage.
Marcin Kuzminski <marcin@python-works.com>
parents:
281
diff
changeset
|
318 |
635
fd63782c4426
Fixed age, for new vcs implementation. Removed all obsolete date formatters
Marcin Kuzminski <marcin@python-works.com>
parents:
631
diff
changeset
|
319 #============================================================================== |
1356
eec4defdf2b8
Make rhodecode use author/username filter from vcs instead of mercurial
Marcin Kuzminski <marcin@python-works.com>
parents:
1352
diff
changeset
|
320 # SCM FILTERS available via h. |
635
fd63782c4426
Fixed age, for new vcs implementation. Removed all obsolete date formatters
Marcin Kuzminski <marcin@python-works.com>
parents:
631
diff
changeset
|
321 #============================================================================== |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
1979
diff
changeset
|
322 from rhodecode.lib.vcs.utils import author_name, author_email |
2109 | 323 from rhodecode.lib.utils2 import credentials_filter, age as _age |
1764
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
324 from rhodecode.model.db import User |
282
237470e64bb8
switched filters into webhelpers for easy of usage.
Marcin Kuzminski <marcin@python-works.com>
parents:
281
diff
changeset
|
325 |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
326 age = lambda x: _age(x) |
282
237470e64bb8
switched filters into webhelpers for easy of usage.
Marcin Kuzminski <marcin@python-works.com>
parents:
281
diff
changeset
|
327 capitalize = lambda x: x.capitalize() |
1356
eec4defdf2b8
Make rhodecode use author/username filter from vcs instead of mercurial
Marcin Kuzminski <marcin@python-works.com>
parents:
1352
diff
changeset
|
328 email = author_email |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
635
diff
changeset
|
329 short_id = lambda x: x[:12] |
1373
66f03a87141c
Fixes issue #201
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
330 hide_credentials = lambda x: ''.join(credentials_filter(x)) |
660
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
331 |
1764
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
332 |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
333 def is_git(repository): |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
334 if hasattr(repository, 'alias'): |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
335 _type = repository.alias |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
336 elif hasattr(repository, 'repo_type'): |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
337 _type = repository.repo_type |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
338 else: |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
339 _type = repository |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
340 return _type == 'git' |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
341 |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
342 |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
343 def is_hg(repository): |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
344 if hasattr(repository, 'alias'): |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
345 _type = repository.alias |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
346 elif hasattr(repository, 'repo_type'): |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
347 _type = repository.repo_type |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
348 else: |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
349 _type = repository |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
350 return _type == 'hg' |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
351 |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
352 |
1767 | 353 def email_or_none(author): |
354 _email = email(author) | |
355 if _email != '': | |
356 return _email | |
1764
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
357 |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
358 # See if it contains a username we can get an email from |
1767 | 359 user = User.get_by_username(author_name(author), case_insensitive=True, |
1764
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
360 cache=True) |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
361 if user is not None: |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
362 return user.email |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
363 |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
364 # No valid email, not a valid user in the system, none! |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
365 return None |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
366 |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
367 |
1767 | 368 def person(author): |
1764
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
369 # attr to return from fetched user |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
370 person_getter = lambda usr: usr.username |
1781
089c81cf04d9
fixes #326 some html special chars where not escaped in diffs + code garden in helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1776
diff
changeset
|
371 |
1767 | 372 # Valid email in the attribute passed, see if they're in the system |
373 _email = email(author) | |
374 if _email != '': | |
375 user = User.get_by_email(_email, case_insensitive=True, cache=True) | |
1764
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
376 if user is not None: |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
377 return person_getter(user) |
1767 | 378 return _email |
1764
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
379 |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
380 # Maybe it's a username? |
1767 | 381 _author = author_name(author) |
382 user = User.get_by_username(_author, case_insensitive=True, | |
1764
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
383 cache=True) |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
384 if user is not None: |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
385 return person_getter(user) |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
386 |
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
387 # Still nothing? Just pass back the author name then |
1767 | 388 return _author |
1764
39b49c999efb
fixes issue #320.
Marcin Kuzminski <marcin@python-works.com>
parents:
1753
diff
changeset
|
389 |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
390 |
712
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
391 def bool2icon(value): |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
392 """Returns True/False values represented as small html image of true/false |
712
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
393 icons |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1187
diff
changeset
|
394 |
712
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
395 :param value: bool value |
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
396 """ |
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
397 |
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
398 if value is True: |
1050
cabe887a9829
removed obsolete _static flag from url, and fixed urls in webhelpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1045
diff
changeset
|
399 return HTML.tag('img', src=url("/images/icons/accept.png"), |
cabe887a9829
removed obsolete _static flag from url, and fixed urls in webhelpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1045
diff
changeset
|
400 alt=_('True')) |
712
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
401 |
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
402 if value is False: |
1050
cabe887a9829
removed obsolete _static flag from url, and fixed urls in webhelpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1045
diff
changeset
|
403 return HTML.tag('img', src=url("/images/icons/cancel.png"), |
cabe887a9829
removed obsolete _static flag from url, and fixed urls in webhelpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1045
diff
changeset
|
404 alt=_('False')) |
712
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
405 |
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
406 return value |
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
407 |
131c1e335fa7
Added ldap info on admin users, added bool2icon helper for nicer representation of
Marcin Kuzminski <marcin@python-works.com>
parents:
698
diff
changeset
|
408 |
1087
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
409 def action_parser(user_log, feed=False): |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
410 """ |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
411 This helper will action_map the specified string action into translated |
660
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
412 fancy names with icons and links |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1187
diff
changeset
|
413 |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
414 :param user_log: user log instance |
1087
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
415 :param feed: use output for feeds (no html and fancy icons) |
660
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
416 """ |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
417 |
660
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
418 action = user_log.action |
840
ee6f345736a6
action logger upgrade, for working with migrations
Marcin Kuzminski <marcin@python-works.com>
parents:
817
diff
changeset
|
419 action_params = ' ' |
660
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
420 |
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
421 x = action.split(':') |
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
422 |
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
423 if len(x) > 1: |
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
424 action, action_params = x |
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
425 |
718
7df3855bf6c7
Added fork name to journal
Marcin Kuzminski <marcin@python-works.com>
parents:
714
diff
changeset
|
426 def get_cs_links(): |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
427 revs_limit = 3 # display this amount always |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
428 revs_top_limit = 50 # show upto this amount of changesets hidden |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
429 revs_ids = action_params.split(',') |
2014
8ccac2b0fcf3
fixed cs_links for deleted repos
Marcin Kuzminski <marcin@python-works.com>
parents:
2012
diff
changeset
|
430 deleted = user_log.repository is None |
8ccac2b0fcf3
fixed cs_links for deleted repos
Marcin Kuzminski <marcin@python-works.com>
parents:
2012
diff
changeset
|
431 if deleted: |
8ccac2b0fcf3
fixed cs_links for deleted repos
Marcin Kuzminski <marcin@python-works.com>
parents:
2012
diff
changeset
|
432 return ','.join(revs_ids) |
8ccac2b0fcf3
fixed cs_links for deleted repos
Marcin Kuzminski <marcin@python-works.com>
parents:
2012
diff
changeset
|
433 |
953
def3578dac8c
fixed vcs import.
Marcin Kuzminski <marcin@python-works.com>
parents:
947
diff
changeset
|
434 repo_name = user_log.repository.repo_name |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1041
diff
changeset
|
435 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1359
diff
changeset
|
436 repo = user_log.repository.scm_instance |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1041
diff
changeset
|
437 |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
438 message = lambda rev: rev.message |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
439 lnk = lambda rev, repo_name: ( |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
440 link_to('r%s:%s' % (rev.revision, rev.short_id), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
441 url('changeset_home', repo_name=repo_name, |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
442 revision=rev.raw_id), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
443 title=tooltip(message(rev)), class_='tooltip') |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
444 ) |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
445 # get only max revs_top_limit of changeset for performance/ui reasons |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
446 revs = [ |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
447 x for x in repo.get_changesets(revs_ids[0], |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
448 revs_ids[:revs_top_limit][-1]) |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
449 ] |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
450 |
1359
54fc83f2192c
Removed all string concat for exchange of ''.join()
Marcin Kuzminski <marcin@python-works.com>
parents:
1356
diff
changeset
|
451 cs_links = [] |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
452 cs_links.append(" " + ', '.join( |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
453 [lnk(rev, repo_name) for rev in revs[:revs_limit]] |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
454 ) |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
455 ) |
1009
eafe5ae429ea
Added compare view into journal, fixed wrong function call to show compare view
Marcin Kuzminski <marcin@python-works.com>
parents:
999
diff
changeset
|
456 |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
457 compare_view = ( |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
458 ' <div class="compare_view tooltip" title="%s">' |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
459 '<a href="%s">%s</a> </div>' % ( |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
460 _('Show all combined changesets %s->%s') % ( |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
461 revs_ids[0], revs_ids[-1] |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
462 ), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
463 url('changeset_home', repo_name=repo_name, |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
464 revision='%s...%s' % (revs_ids[0], revs_ids[-1]) |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
465 ), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
466 _('compare view') |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
467 ) |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
468 ) |
1009
eafe5ae429ea
Added compare view into journal, fixed wrong function call to show compare view
Marcin Kuzminski <marcin@python-works.com>
parents:
999
diff
changeset
|
469 |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
470 # if we have exactly one more than normally displayed |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
471 # just display it, takes less space than displaying |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
472 # "and 1 more revisions" |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
473 if len(revs_ids) == revs_limit + 1: |
1979 | 474 rev = revs[revs_limit] |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
475 cs_links.append(", " + lnk(rev, repo_name)) |
1979 | 476 |
477 # hidden-by-default ones | |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
478 if len(revs_ids) > revs_limit + 1: |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
479 uniq_id = revs_ids[0] |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
480 html_tmpl = ( |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
481 '<span> %s <a class="show_more" id="_%s" ' |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
482 'href="#more">%s</a> %s</span>' |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
483 ) |
1087
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
484 if not feed: |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
485 cs_links.append(html_tmpl % ( |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
486 _('and'), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
487 uniq_id, _('%s more') % (len(revs_ids) - revs_limit), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
488 _('revisions') |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
489 ) |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
490 ) |
808
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
491 |
1087
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
492 if not feed: |
1979 | 493 html_tmpl = '<span id="%s" style="display:none">, %s </span>' |
1087
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
494 else: |
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
495 html_tmpl = '<span id="%s"> %s </span>' |
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
496 |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
497 morelinks = ', '.join( |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
498 [lnk(rev, repo_name) for rev in revs[revs_limit:]] |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
499 ) |
1979 | 500 |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
501 if len(revs_ids) > revs_top_limit: |
1979 | 502 morelinks += ', ...' |
503 | |
504 cs_links.append(html_tmpl % (uniq_id, morelinks)) | |
1024
22c147726ea6
hidden compare view link for single revision push
Marcin Kuzminski <marcin@python-works.com>
parents:
1022
diff
changeset
|
505 if len(revs) > 1: |
1359
54fc83f2192c
Removed all string concat for exchange of ''.join()
Marcin Kuzminski <marcin@python-works.com>
parents:
1356
diff
changeset
|
506 cs_links.append(compare_view) |
54fc83f2192c
Removed all string concat for exchange of ''.join()
Marcin Kuzminski <marcin@python-works.com>
parents:
1356
diff
changeset
|
507 return ''.join(cs_links) |
734
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
718
diff
changeset
|
508 |
718
7df3855bf6c7
Added fork name to journal
Marcin Kuzminski <marcin@python-works.com>
parents:
714
diff
changeset
|
509 def get_fork_name(): |
953
def3578dac8c
fixed vcs import.
Marcin Kuzminski <marcin@python-works.com>
parents:
947
diff
changeset
|
510 repo_name = action_params |
1055
903aadbf9047
updated changelog, small fix for journal
Marcin Kuzminski <marcin@python-works.com>
parents:
1053
diff
changeset
|
511 return _('fork name ') + str(link_to(action_params, url('summary_home', |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1041
diff
changeset
|
512 repo_name=repo_name,))) |
953
def3578dac8c
fixed vcs import.
Marcin Kuzminski <marcin@python-works.com>
parents:
947
diff
changeset
|
513 |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
514 action_map = {'user_deleted_repo': (_('[deleted] repository'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
515 'user_created_repo': (_('[created] repository'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
516 'user_created_fork': (_('[created] repository as fork'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
517 'user_forked_repo': (_('[forked] repository'), get_fork_name), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
518 'user_updated_repo': (_('[updated] repository'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
519 'admin_deleted_repo': (_('[delete] repository'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
520 'admin_created_repo': (_('[created] repository'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
521 'admin_forked_repo': (_('[forked] repository'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
522 'admin_updated_repo': (_('[updated] repository'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
523 'push': (_('[pushed] into'), get_cs_links), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
524 'push_local': (_('[committed via RhodeCode] into'), get_cs_links), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
525 'push_remote': (_('[pulled from remote] into'), get_cs_links), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
526 'pull': (_('[pulled] from'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
527 'started_following_repo': (_('[started following] repository'), None), |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
528 'stopped_following_repo': (_('[stopped following] repository'), None), |
735
dbec976d9975
added action loggers to following repositories,
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
529 } |
660
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
530 |
1087
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
531 action_str = action_map.get(action, action) |
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
532 if feed: |
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
533 action = action_str[0].replace('[', '').replace(']', '') |
51076a2a2b64
fixed unicode problems with file paths.
Marcin Kuzminski <marcin@python-works.com>
parents:
1055
diff
changeset
|
534 else: |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
535 action = action_str[0]\ |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
536 .replace('[', '<span class="journal_highlight">')\ |
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
537 .replace(']', '</span>') |
1114
4de3fa6290a7
#109, added manual pull of changes for repositories that have remote location filled in.
Marcin Kuzminski <marcin@python-works.com>
parents:
1105
diff
changeset
|
538 |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
539 action_params_func = lambda: "" |
1052
c96651aebd8a
fixed journal look & feel
Marcin Kuzminski <marcin@python-works.com>
parents:
1050
diff
changeset
|
540 |
1114
4de3fa6290a7
#109, added manual pull of changes for repositories that have remote location filled in.
Marcin Kuzminski <marcin@python-works.com>
parents:
1105
diff
changeset
|
541 if callable(action_str[1]): |
1052
c96651aebd8a
fixed journal look & feel
Marcin Kuzminski <marcin@python-works.com>
parents:
1050
diff
changeset
|
542 action_params_func = action_str[1] |
953
def3578dac8c
fixed vcs import.
Marcin Kuzminski <marcin@python-works.com>
parents:
947
diff
changeset
|
543 |
1052
c96651aebd8a
fixed journal look & feel
Marcin Kuzminski <marcin@python-works.com>
parents:
1050
diff
changeset
|
544 return [literal(action), action_params_func] |
808
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
545 |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
546 |
808
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
547 def action_parser_icon(user_log): |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
548 action = user_log.action |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
549 action_params = None |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
550 x = action.split(':') |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
551 |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
552 if len(x) > 1: |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
553 action, action_params = x |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
554 |
1114
4de3fa6290a7
#109, added manual pull of changes for repositories that have remote location filled in.
Marcin Kuzminski <marcin@python-works.com>
parents:
1105
diff
changeset
|
555 tmpl = """<img src="%s%s" alt="%s"/>""" |
808
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
556 map = {'user_deleted_repo':'database_delete.png', |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
557 'user_created_repo':'database_add.png', |
1747
8804715404c9
implements #193 journal stores information about deleting of repos
Marcin Kuzminski <marcin@python-works.com>
parents:
1716
diff
changeset
|
558 'user_created_fork':'arrow_divide.png', |
808
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
559 'user_forked_repo':'arrow_divide.png', |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
560 'user_updated_repo':'database_edit.png', |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
561 'admin_deleted_repo':'database_delete.png', |
899
d65843e07d3c
Added message tooltip into journal revisions in push.
Marcin Kuzminski <marcin@python-works.com>
parents:
864
diff
changeset
|
562 'admin_created_repo':'database_add.png', |
808
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
563 'admin_forked_repo':'arrow_divide.png', |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
564 'admin_updated_repo':'database_edit.png', |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
565 'push':'script_add.png', |
1312
70a5a9a57864
logged local commit with special action via action_logger,
Marcin Kuzminski <marcin@python-works.com>
parents:
1259
diff
changeset
|
566 'push_local':'script_edit.png', |
1114
4de3fa6290a7
#109, added manual pull of changes for repositories that have remote location filled in.
Marcin Kuzminski <marcin@python-works.com>
parents:
1105
diff
changeset
|
567 'push_remote':'connect.png', |
808
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
568 'pull':'down_16.png', |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
569 'started_following_repo':'heart_add.png', |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
570 'stopped_following_repo':'heart_delete.png', |
1af15d66838f
added icons to journal, extend show more to actually show more pushed revisions,
Marcin Kuzminski <marcin@python-works.com>
parents:
790
diff
changeset
|
571 } |
1050
cabe887a9829
removed obsolete _static flag from url, and fixed urls in webhelpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1045
diff
changeset
|
572 return literal(tmpl % ((url('/images/icons/')), |
cabe887a9829
removed obsolete _static flag from url, and fixed urls in webhelpers
Marcin Kuzminski <marcin@python-works.com>
parents:
1045
diff
changeset
|
573 map.get(action, action), action)) |
660
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
574 |
df61378032f3
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
Marcin Kuzminski <marcin@python-works.com>
parents:
653
diff
changeset
|
575 |
635
fd63782c4426
Fixed age, for new vcs implementation. Removed all obsolete date formatters
Marcin Kuzminski <marcin@python-works.com>
parents:
631
diff
changeset
|
576 #============================================================================== |
307
504feff57b49
added permission functions to webhelpers, updated dbmanage permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
293
diff
changeset
|
577 # PERMS |
635
fd63782c4426
Fixed age, for new vcs implementation. Removed all obsolete date formatters
Marcin Kuzminski <marcin@python-works.com>
parents:
631
diff
changeset
|
578 #============================================================================== |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
512
diff
changeset
|
579 from rhodecode.lib.auth import HasPermissionAny, HasPermissionAll, \ |
307
504feff57b49
added permission functions to webhelpers, updated dbmanage permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
293
diff
changeset
|
580 HasRepoPermissionAny, HasRepoPermissionAll |
282
237470e64bb8
switched filters into webhelpers for easy of usage.
Marcin Kuzminski <marcin@python-works.com>
parents:
281
diff
changeset
|
581 |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
582 |
635
fd63782c4426
Fixed age, for new vcs implementation. Removed all obsolete date formatters
Marcin Kuzminski <marcin@python-works.com>
parents:
631
diff
changeset
|
583 #============================================================================== |
398
8c50b164fb58
Implemented basic gravatar support on admin pages only for now
Marcin Kuzminski <marcin@python-works.com>
parents:
307
diff
changeset
|
584 # GRAVATAR URL |
635
fd63782c4426
Fixed age, for new vcs implementation. Removed all obsolete date formatters
Marcin Kuzminski <marcin@python-works.com>
parents:
631
diff
changeset
|
585 #============================================================================== |
282
237470e64bb8
switched filters into webhelpers for easy of usage.
Marcin Kuzminski <marcin@python-works.com>
parents:
281
diff
changeset
|
586 |
401
b1debb6c5a09
implemented gravatars to changesets, updated styling for changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
400
diff
changeset
|
587 def gravatar_url(email_address, size=30): |
1629
2196aa27954b
implements #293 gravatar link should be disabled when use_gravatar = false
Marcin Kuzminski <marcin@python-works.com>
parents:
1621
diff
changeset
|
588 if (not str2bool(config['app_conf'].get('use_gravatar')) or |
2196aa27954b
implements #293 gravatar link should be disabled when use_gravatar = false
Marcin Kuzminski <marcin@python-works.com>
parents:
1621
diff
changeset
|
589 not email_address or email_address == 'anonymous@rhodecode.org'): |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
590 f = lambda a, l: min(l, key=lambda x: abs(x - a)) |
1927
7314e8384b1b
gravatar fix to match supported sizes
Marcin Kuzminski <marcin@python-works.com>
parents:
1913
diff
changeset
|
591 return url("/images/user%s.png" % f(size, [14, 16, 20, 24, 30])) |
1110
5351a3a32381
#21 added optional flag to disable gravatar, and use local icon
Marcin Kuzminski <marcin@python-works.com>
parents:
1105
diff
changeset
|
592 |
946
f12cd4707301
patched gravatar url generation to properly support new https force flag from settings.
Marcin Kuzminski <marcin@python-works.com>
parents:
911
diff
changeset
|
593 ssl_enabled = 'https' == request.environ.get('wsgi.url_scheme') |
398
8c50b164fb58
Implemented basic gravatar support on admin pages only for now
Marcin Kuzminski <marcin@python-works.com>
parents:
307
diff
changeset
|
594 default = 'identicon' |
8c50b164fb58
Implemented basic gravatar support on admin pages only for now
Marcin Kuzminski <marcin@python-works.com>
parents:
307
diff
changeset
|
595 baseurl_nossl = "http://www.gravatar.com/avatar/" |
8c50b164fb58
Implemented basic gravatar support on admin pages only for now
Marcin Kuzminski <marcin@python-works.com>
parents:
307
diff
changeset
|
596 baseurl_ssl = "https://secure.gravatar.com/avatar/" |
8c50b164fb58
Implemented basic gravatar support on admin pages only for now
Marcin Kuzminski <marcin@python-works.com>
parents:
307
diff
changeset
|
597 baseurl = baseurl_ssl if ssl_enabled else baseurl_nossl |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
604
diff
changeset
|
598 |
1101
c1080b42a7cb
fixed problem with int. chars in gravatars
Marcin Kuzminski <marcin@python-works.com>
parents:
1100
diff
changeset
|
599 if isinstance(email_address, unicode): |
c1080b42a7cb
fixed problem with int. chars in gravatars
Marcin Kuzminski <marcin@python-works.com>
parents:
1100
diff
changeset
|
600 #hashlib crashes on unicode items |
1401
b7563ad4e7ee
Unicode fixes, added safe_str method for global str() operations +better test sandboxing
Marcin Kuzminski <marcin@python-works.com>
parents:
1373
diff
changeset
|
601 email_address = safe_str(email_address) |
398
8c50b164fb58
Implemented basic gravatar support on admin pages only for now
Marcin Kuzminski <marcin@python-works.com>
parents:
307
diff
changeset
|
602 # construct the url |
401
b1debb6c5a09
implemented gravatars to changesets, updated styling for changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
400
diff
changeset
|
603 gravatar_url = baseurl + hashlib.md5(email_address.lower()).hexdigest() + "?" |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
604 gravatar_url += urllib.urlencode({'d': default, 's': str(size)}) |
398
8c50b164fb58
Implemented basic gravatar support on admin pages only for now
Marcin Kuzminski <marcin@python-works.com>
parents:
307
diff
changeset
|
605 |
8c50b164fb58
Implemented basic gravatar support on admin pages only for now
Marcin Kuzminski <marcin@python-works.com>
parents:
307
diff
changeset
|
606 return gravatar_url |
443
e5157e2a530e
added safe unicode funtion, and implemented it in whoosh indexer
Marcin Kuzminski <marcin@python-works.com>
parents:
438
diff
changeset
|
607 |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
608 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
609 #============================================================================== |
1342
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
610 # REPO PAGER, PAGER FOR REPOSITORY |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
611 #============================================================================== |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
612 class RepoPage(Page): |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
613 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
614 def __init__(self, collection, page=1, items_per_page=20, |
1656
833f9dec0a06
implemented #44 - branch filtering in changelog, aka branch browser
Marcin Kuzminski <marcin@python-works.com>
parents:
1629
diff
changeset
|
615 item_count=None, url=None, **kwargs): |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
616 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
617 """Create a "RepoPage" instance. special pager for paging |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
618 repository |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
619 """ |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
620 self._url_generator = url |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
621 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
622 # Safe the kwargs class-wide so they can be used in the pager() method |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
623 self.kwargs = kwargs |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
624 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
625 # Save a reference to the collection |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
626 self.original_collection = collection |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
627 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
628 self.collection = collection |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
629 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
630 # The self.page is the number of the current page. |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
631 # The first page has the number 1! |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
632 try: |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
633 self.page = int(page) # make it int() if we get it as a string |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
634 except (ValueError, TypeError): |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
635 self.page = 1 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
636 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
637 self.items_per_page = items_per_page |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
638 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
639 # Unless the user tells us how many items the collections has |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
640 # we calculate that ourselves. |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
641 if item_count is not None: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
642 self.item_count = item_count |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
643 else: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
644 self.item_count = len(self.collection) |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
645 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
646 # Compute the number of the first and last available page |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
647 if self.item_count > 0: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
648 self.first_page = 1 |
1422
e69da281e235
fixed issues with repo pager
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
649 self.page_count = int(math.ceil(float(self.item_count) / |
e69da281e235
fixed issues with repo pager
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
650 self.items_per_page)) |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
651 self.last_page = self.first_page + self.page_count - 1 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
652 |
1818
cf51bbfb120e
auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
653 # Make sure that the requested page number is the range of |
1766 | 654 # valid pages |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
655 if self.page > self.last_page: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
656 self.page = self.last_page |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
657 elif self.page < self.first_page: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
658 self.page = self.first_page |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
659 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
660 # Note: the number of items on this page can be less than |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
661 # items_per_page if the last page is not full |
1422
e69da281e235
fixed issues with repo pager
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
662 self.first_item = max(0, (self.item_count) - (self.page * |
e69da281e235
fixed issues with repo pager
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
663 items_per_page)) |
e69da281e235
fixed issues with repo pager
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
664 self.last_item = ((self.item_count - 1) - items_per_page * |
e69da281e235
fixed issues with repo pager
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
665 (self.page - 1)) |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
666 |
1670
d2de0c2f02cd
#77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1656
diff
changeset
|
667 self.items = list(self.collection[self.first_item:self.last_item + 1]) |
1656
833f9dec0a06
implemented #44 - branch filtering in changelog, aka branch browser
Marcin Kuzminski <marcin@python-works.com>
parents:
1629
diff
changeset
|
668 |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
669 # Links to previous and next page |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
670 if self.page > self.first_page: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
671 self.previous_page = self.page - 1 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
672 else: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
673 self.previous_page = None |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
674 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
675 if self.page < self.last_page: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
676 self.next_page = self.page + 1 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
677 else: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
678 self.next_page = None |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
679 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
680 # No items available |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
681 else: |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
682 self.first_page = None |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
683 self.page_count = 0 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
684 self.last_page = None |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
685 self.first_item = None |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
686 self.last_item = None |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
687 self.previous_page = None |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
688 self.next_page = None |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
689 self.items = [] |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
690 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
691 # This is a subclass of the 'list' type. Initialise the list now. |
1656
833f9dec0a06
implemented #44 - branch filtering in changelog, aka branch browser
Marcin Kuzminski <marcin@python-works.com>
parents:
1629
diff
changeset
|
692 list.__init__(self, reversed(self.items)) |
1098
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
693 |
91ddd4db4614
Added dedicated repo pager to support reversed new way slicing method of vcs and get_changesets method
Marcin Kuzminski <marcin@python-works.com>
parents:
1087
diff
changeset
|
694 |
990
7a1df0130533
moved tooltip function from the for loop and from templates to helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
966
diff
changeset
|
695 def changed_tooltip(nodes): |
1342
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
696 """ |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
697 Generates a html string for changed nodes in changeset page. |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
698 It limits the output to 30 entries |
1818
cf51bbfb120e
auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
699 |
1342
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
700 :param nodes: LazyNodesGenerator |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
701 """ |
990
7a1df0130533
moved tooltip function from the for loop and from templates to helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
966
diff
changeset
|
702 if nodes: |
7a1df0130533
moved tooltip function from the for loop and from templates to helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
966
diff
changeset
|
703 pref = ': <br/> ' |
7a1df0130533
moved tooltip function from the for loop and from templates to helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
966
diff
changeset
|
704 suf = '' |
7a1df0130533
moved tooltip function from the for loop and from templates to helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
966
diff
changeset
|
705 if len(nodes) > 30: |
7a1df0130533
moved tooltip function from the for loop and from templates to helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
966
diff
changeset
|
706 suf = '<br/>' + _(' and %s more') % (len(nodes) - 30) |
1257
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
707 return literal(pref + '<br/> '.join([safe_unicode(x.path) |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
708 for x in nodes[:30]]) + suf) |
990
7a1df0130533
moved tooltip function from the for loop and from templates to helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
966
diff
changeset
|
709 else: |
7a1df0130533
moved tooltip function from the for loop and from templates to helpers
Marcin Kuzminski <marcin@python-works.com>
parents:
966
diff
changeset
|
710 return ': ' + _('No Files') |
1159
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
711 |
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
712 |
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
713 def repo_link(groups_and_repos): |
1342
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
714 """ |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
715 Makes a breadcrumbs link to repo within a group |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
716 joins » on each group to create a fancy link |
1818
cf51bbfb120e
auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
717 |
1342
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
718 ex:: |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
719 group >> subgroup >> repo |
1818
cf51bbfb120e
auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
720 |
1342
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
721 :param groups_and_repos: |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
722 """ |
1159
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
723 groups, repo_name = groups_and_repos |
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
724 |
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
725 if not groups: |
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
726 return repo_name |
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
727 else: |
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
728 def make_link(group): |
1547
fbc762ae3496
unified generation of repo groups choices
Marcin Kuzminski <marcin@python-works.com>
parents:
1478
diff
changeset
|
729 return link_to(group.name, url('repos_group_home', |
fbc762ae3496
unified generation of repo groups choices
Marcin Kuzminski <marcin@python-works.com>
parents:
1478
diff
changeset
|
730 group_name=group.group_name)) |
1159
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
731 return literal(' » '.join(map(make_link, groups)) + \ |
187a924ed653
Changes for repo groups
Marcin Kuzminski <marcin@python-works.com>
parents:
1154
diff
changeset
|
732 " » " + repo_name) |
1257
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
733 |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
734 |
1257
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
735 def fancy_file_stats(stats): |
1342
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
736 """ |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
737 Displays a fancy two colored bar for number of added/deleted |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
738 lines of code on file |
1818
cf51bbfb120e
auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
739 |
1342
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
740 :param stats: two element list of added/deleted lines of code |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
741 """ |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
742 |
1257
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
743 a, d, t = stats[0], stats[1], stats[0] + stats[1] |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
744 width = 100 |
1258
3954bdaf6243
fixed possible float division, and changeset ranges bug introduced in stat changeset.
Marcin Kuzminski <marcin@python-works.com>
parents:
1257
diff
changeset
|
745 unit = float(width) / (t or 1) |
1257
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
746 |
1342
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
747 # needs > 9% of width to be visible or 0 to be hidden |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
748 a_p = max(9, unit * a) if a > 0 else 0 |
9dacacc5b7c2
When creating a remote repository, with credentials filled, it's good to hide username and password from the clone url. Only administrators can see this in repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents:
1330
diff
changeset
|
749 d_p = max(9, unit * d) if d > 0 else 0 |
1257
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
750 p_sum = a_p + d_p |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
751 |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
752 if p_sum > width: |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
753 #adjust the percentage to be == 100% since we adjusted to 9 |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
754 if a_p > d_p: |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
755 a_p = a_p - (p_sum - width) |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
756 else: |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
757 d_p = d_p - (p_sum - width) |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
758 |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
759 a_v = a if a > 0 else '' |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
760 d_v = d if d > 0 else '' |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
761 |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
762 def cgen(l_type): |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
763 mapping = {'tr': 'top-right-rounded-corner', |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
764 'tl': 'top-left-rounded-corner', |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
765 'br': 'bottom-right-rounded-corner', |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
766 'bl': 'bottom-left-rounded-corner'} |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
767 map_getter = lambda x: mapping[x] |
1257
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
768 |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
769 if l_type == 'a' and d_v: |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
770 #case when added and deleted are present |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
771 return ' '.join(map(map_getter, ['tl', 'bl'])) |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
772 |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
773 if l_type == 'a' and not d_v: |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
774 return ' '.join(map(map_getter, ['tr', 'br', 'tl', 'bl'])) |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
775 |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
776 if l_type == 'd' and a_v: |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
777 return ' '.join(map(map_getter, ['tr', 'br'])) |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
778 |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
779 if l_type == 'd' and not a_v: |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
780 return ' '.join(map(map_getter, ['tr', 'br', 'tl', 'bl'])) |
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
781 |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
782 d_a = '<div class="added %s" style="width:%s%%">%s</div>' % ( |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
783 cgen('a'), a_p, a_v |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
784 ) |
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
785 d_d = '<div class="deleted %s" style="width:%s%%">%s</div>' % ( |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
786 cgen('d'), d_p, d_v |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
787 ) |
1257
0a2a10a1912f
Implemented --stat for changelog
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
788 return literal('<div style="width:%spx">%s%s</div>' % (width, d_a, d_d)) |
1438
002f4f465b58
Links in summary page are now active
Marcin Kuzminski <marcin@python-works.com>
parents:
1422
diff
changeset
|
789 |
002f4f465b58
Links in summary page are now active
Marcin Kuzminski <marcin@python-works.com>
parents:
1422
diff
changeset
|
790 |
1840
87920d4f58c5
added class into issue tracker link
Marcin Kuzminski <marcin@python-works.com>
parents:
1837
diff
changeset
|
791 def urlify_text(text_): |
1438
002f4f465b58
Links in summary page are now active
Marcin Kuzminski <marcin@python-works.com>
parents:
1422
diff
changeset
|
792 import re |
002f4f465b58
Links in summary page are now active
Marcin Kuzminski <marcin@python-works.com>
parents:
1422
diff
changeset
|
793 |
1766 | 794 url_pat = re.compile(r'''(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]''' |
795 '''|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)''') | |
1438
002f4f465b58
Links in summary page are now active
Marcin Kuzminski <marcin@python-works.com>
parents:
1422
diff
changeset
|
796 |
002f4f465b58
Links in summary page are now active
Marcin Kuzminski <marcin@python-works.com>
parents:
1422
diff
changeset
|
797 def url_func(match_obj): |
002f4f465b58
Links in summary page are now active
Marcin Kuzminski <marcin@python-works.com>
parents:
1422
diff
changeset
|
798 url_full = match_obj.groups()[0] |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
799 return '<a href="%(url)s">%(url)s</a>' % ({'url': url_full}) |
1438
002f4f465b58
Links in summary page are now active
Marcin Kuzminski <marcin@python-works.com>
parents:
1422
diff
changeset
|
800 |
1840
87920d4f58c5
added class into issue tracker link
Marcin Kuzminski <marcin@python-works.com>
parents:
1837
diff
changeset
|
801 return literal(url_pat.sub(url_func, text_)) |
1656
833f9dec0a06
implemented #44 - branch filtering in changelog, aka branch browser
Marcin Kuzminski <marcin@python-works.com>
parents:
1629
diff
changeset
|
802 |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
803 |
1913
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
804 def urlify_changesets(text_, repository): |
2111
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
805 """ |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
806 Extract revision ids from changeset and make link from them |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
807 |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
808 :param text_: |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
809 :param repository: |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
810 """ |
1913
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
811 import re |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
812 URL_PAT = re.compile(r'([0-9a-fA-F]{12,})') |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
813 |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
814 def url_func(match_obj): |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
815 rev = match_obj.groups()[0] |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
816 pref = '' |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
817 if match_obj.group().startswith(' '): |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
818 pref = ' ' |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
819 tmpl = ( |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
820 '%(pref)s<a class="%(cls)s" href="%(url)s">' |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
821 '%(rev)s' |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
822 '</a>' |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
823 ) |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
824 return tmpl % { |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
825 'pref': pref, |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
826 'cls': 'revision-link', |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
827 'url': url('changeset_home', repo_name=repository, revision=rev), |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
828 'rev': rev, |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
829 } |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
830 |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
831 newtext = URL_PAT.sub(url_func, text_) |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
832 |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
833 return newtext |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
834 |
1959
7a7ffe24b82c
optimized speed for browsing git changesets
Marcin Kuzminski <marcin@python-works.com>
parents:
1944
diff
changeset
|
835 |
1878
287eff9614fa
changelog: make messages be links again, and somewhat co-exist with issue tracker links (those are bold now)
Aras Pranckevicius <aras@unity3d.com>
parents:
1868
diff
changeset
|
836 def urlify_commit(text_, repository=None, link_=None): |
2028
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
837 """ |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
838 Parses given text message and makes proper links. |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
839 issues are linked to given issue-server, and rest is a changeset link |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
840 if link_ is given, in other case it's a plain text |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
841 |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
842 :param text_: |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
843 :param repository: |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
844 :param link_: changeset link |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
845 """ |
1837
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
846 import re |
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
847 import traceback |
2111
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
848 |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
849 def escaper(string): |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
850 return string.replace('<', '<').replace('>', '>') |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
851 |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
852 def linkify_others(t, l): |
1913
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
853 urls = re.compile(r'(\<a.*?\<\/a\>)',) |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
854 links = [] |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
855 for e in urls.split(t): |
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
856 if not urls.match(e): |
2012
ca39c02c7c3e
speed up generating changesets in journal log
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
857 links.append('<a class="message-link" href="%s">%s</a>' % (l, e)) |
1913
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
858 else: |
1944
5fc9c92025c1
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1933
diff
changeset
|
859 links.append(e) |
5fc9c92025c1
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1933
diff
changeset
|
860 |
1913
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
861 return ''.join(links) |
2111
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
862 |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
863 |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
864 # urlify changesets - extrac revisions and make link out of them |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
865 text_ = urlify_changesets(escaper(text_), repository) |
122f15a8f6ec
fixed issue with escaping < and > in changeset commits
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
866 |
1837
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
867 try: |
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
868 conf = config['app_conf'] |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
869 |
1933
3da456a3a211
changed default issue tracker links pattern
Marcin Kuzminski <marcin@python-works.com>
parents:
1927
diff
changeset
|
870 URL_PAT = re.compile(r'%s' % conf.get('issue_pat')) |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
871 |
1837
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
872 if URL_PAT: |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
873 ISSUE_SERVER_LNK = conf.get('issue_server_link') |
1837
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
874 ISSUE_PREFIX = conf.get('issue_prefix') |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
875 |
1837
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
876 def url_func(match_obj): |
1912
32e1e0745d3c
fixes issue with whitespace for referenced tasks in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1884
diff
changeset
|
877 pref = '' |
32e1e0745d3c
fixes issue with whitespace for referenced tasks in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1884
diff
changeset
|
878 if match_obj.group().startswith(' '): |
32e1e0745d3c
fixes issue with whitespace for referenced tasks in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1884
diff
changeset
|
879 pref = ' ' |
32e1e0745d3c
fixes issue with whitespace for referenced tasks in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1884
diff
changeset
|
880 |
1933
3da456a3a211
changed default issue tracker links pattern
Marcin Kuzminski <marcin@python-works.com>
parents:
1927
diff
changeset
|
881 issue_id = ''.join(match_obj.groups()) |
1840
87920d4f58c5
added class into issue tracker link
Marcin Kuzminski <marcin@python-works.com>
parents:
1837
diff
changeset
|
882 tmpl = ( |
1912
32e1e0745d3c
fixes issue with whitespace for referenced tasks in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1884
diff
changeset
|
883 '%(pref)s<a class="%(cls)s" href="%(url)s">' |
1865 | 884 '%(issue-prefix)s%(id-repr)s' |
1840
87920d4f58c5
added class into issue tracker link
Marcin Kuzminski <marcin@python-works.com>
parents:
1837
diff
changeset
|
885 '</a>' |
87920d4f58c5
added class into issue tracker link
Marcin Kuzminski <marcin@python-works.com>
parents:
1837
diff
changeset
|
886 ) |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
887 url = ISSUE_SERVER_LNK.replace('{id}', issue_id) |
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
888 if repository: |
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
889 url = url.replace('{repo}', repository) |
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
890 |
1913
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
891 return tmpl % { |
1912
32e1e0745d3c
fixes issue with whitespace for referenced tasks in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1884
diff
changeset
|
892 'pref': pref, |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
893 'cls': 'issue-tracker-link', |
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
894 'url': url, |
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
895 'id-repr': issue_id, |
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
896 'issue-prefix': ISSUE_PREFIX, |
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
897 'serv': ISSUE_SERVER_LNK, |
1913
08344d037ba1
added links to revisions in commit messages
Marcin Kuzminski <marcin@python-works.com>
parents:
1912
diff
changeset
|
898 } |
1944
5fc9c92025c1
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1933
diff
changeset
|
899 |
1878
287eff9614fa
changelog: make messages be links again, and somewhat co-exist with issue tracker links (those are bold now)
Aras Pranckevicius <aras@unity3d.com>
parents:
1868
diff
changeset
|
900 newtext = URL_PAT.sub(url_func, text_) |
1944
5fc9c92025c1
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1933
diff
changeset
|
901 |
2028
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
902 if link_: |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
903 # wrap not links into final link => link_ |
ef3114b01c7c
fixed issues when urlify commit created empty links when link_ param was empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2014
diff
changeset
|
904 newtext = linkify_others(newtext, link_) |
1944
5fc9c92025c1
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1933
diff
changeset
|
905 |
1878
287eff9614fa
changelog: make messages be links again, and somewhat co-exist with issue tracker links (those are bold now)
Aras Pranckevicius <aras@unity3d.com>
parents:
1868
diff
changeset
|
906 return literal(newtext) |
1837
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
907 except: |
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
908 log.error(traceback.format_exc()) |
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
909 pass |
a6a30c919513
#73 mapping of commited issues from commit message into issue tracker url.
Marcin Kuzminski <marcin@python-works.com>
parents:
1832
diff
changeset
|
910 |
1840
87920d4f58c5
added class into issue tracker link
Marcin Kuzminski <marcin@python-works.com>
parents:
1837
diff
changeset
|
911 return text_ |
1670
d2de0c2f02cd
#77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1656
diff
changeset
|
912 |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
913 |
1670
d2de0c2f02cd
#77 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1656
diff
changeset
|
914 def rst(source): |
1789
17caf4efe15c
implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents:
1781
diff
changeset
|
915 return literal('<div class="rst-block">%s</div>' % |
1766 | 916 MarkupRenderer.rst(source)) |
1789
17caf4efe15c
implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents:
1781
diff
changeset
|
917 |
1868
f26acc1b27e2
added repository name into issue tracker link to support different projects issues tracker mapping
Marcin Kuzminski <marcin@python-works.com>
parents:
1865
diff
changeset
|
918 |
1769
025f3333c769
@mention highlighting
Marcin Kuzminski <marcin@python-works.com>
parents:
1767
diff
changeset
|
919 def rst_w_mentions(source): |
025f3333c769
@mention highlighting
Marcin Kuzminski <marcin@python-works.com>
parents:
1767
diff
changeset
|
920 """ |
025f3333c769
@mention highlighting
Marcin Kuzminski <marcin@python-works.com>
parents:
1767
diff
changeset
|
921 Wrapped rst renderer with @mention highlighting |
1818
cf51bbfb120e
auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
922 |
1769
025f3333c769
@mention highlighting
Marcin Kuzminski <marcin@python-works.com>
parents:
1767
diff
changeset
|
923 :param source: |
025f3333c769
@mention highlighting
Marcin Kuzminski <marcin@python-works.com>
parents:
1767
diff
changeset
|
924 """ |
1789
17caf4efe15c
implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents:
1781
diff
changeset
|
925 return literal('<div class="rst-block">%s</div>' % |
17caf4efe15c
implements #308 rewrote diffs to enable displaying full diff on each file
Marcin Kuzminski <marcin@python-works.com>
parents:
1781
diff
changeset
|
926 MarkupRenderer.rst_with_mentions(source)) |