Skip to content

Commit

Permalink
Added option one_line_comment_max_len.
Browse files Browse the repository at this point in the history
  • Loading branch information
danfis committed Apr 20, 2010
1 parent 6527aa4 commit d14bcbf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pitweb.py
Expand Up @@ -17,6 +17,10 @@
# Default value is 15 # Default value is 15
commits_in_summary = 15 commits_in_summary = 15


### Maximal length of one line comment (shown for example in log)
# Default value is 50
one_line_comment_max_len = 50

### Description of project - will be shown in summary ### Description of project - will be shown in summary
description = 'Some description of your project' description = 'Some description of your project'


Expand Down
8 changes: 8 additions & 0 deletions project.py
Expand Up @@ -89,6 +89,7 @@ def _config(self):
self._owner = self._configParam(config, 'owner', None) self._owner = self._configParam(config, 'owner', None)
self._urls = self._configParam(config, 'urls', []) self._urls = self._configParam(config, 'urls', [])
self._homepage = self._configParam(config, 'homepage', None) self._homepage = self._configParam(config, 'homepage', None)
self._one_line_comment_max_len = self._configParam(config, 'one_line_comment_max_len', 50)
self._setSnapshots(config) self._setSnapshots(config)


def _configParam(self, config, name, default): def _configParam(self, config, name, default):
Expand Down Expand Up @@ -605,7 +606,10 @@ def _fHeads(self, heads):
comm = h.commit() comm = h.commit()


line = self._esc(comm.commentFirstLine()) line = self._esc(comm.commentFirstLine())
if len(line) > self._one_line_comment_max_len:
line = line[:self._one_line_comment_max_len] + '...'
line = line.replace('{', '{{').replace('}', '}}') line = line.replace('{', '{{').replace('}', '}}')

v = { 'a' : 'log', v = { 'a' : 'log',
'id' : comm.id } 'id' : comm.id }
commanchor = self.anchor(line, v = v, cls = 'comment') commanchor = self.anchor(line, v = v, cls = 'comment')
Expand Down Expand Up @@ -679,6 +683,8 @@ def _fRemotes(self, remotes):
comm = r.commit() comm = r.commit()


line = self._esc(comm.commentFirstLine()) line = self._esc(comm.commentFirstLine())
if len(line) > self._one_line_comment_max_len:
line = line[:self._one_line_comment_max_len] + '...'
line = line.replace('{', '{{').replace('}', '}}') line = line.replace('{', '{{').replace('}', '}}')


v = { 'a' : 'log', v = { 'a' : 'log',
Expand Down Expand Up @@ -767,6 +773,8 @@ def _fLog(self, commits, id = 'HEAD', longcomment = False, showmsg = False, page
<td>''' <td>'''


line = self._esc(commit.commentFirstLine()) line = self._esc(commit.commentFirstLine())
if not showmsg and len(line) > self._one_line_comment_max_len:
line = line[:self._one_line_comment_max_len] + '...'
line = line.replace('{', '{{') line = line.replace('{', '{{')
line = line.replace('}', '}}') line = line.replace('}', '}}')


Expand Down

0 comments on commit d14bcbf

Please sign in to comment.