Mercurial > wikked
changeset 81:05d0a7cd85e8
Fixed site-wide history page.
TODO: Add ability to show diffs.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 27 Feb 2013 22:55:11 -0800 |
parents | 91c5ea6e9027 |
children | 9afe4a1dbd1e |
files | static/tpl/special-changes.html wikked/scm.py |
diffstat | 2 files changed, 44 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/static/tpl/special-changes.html Wed Feb 27 22:13:42 2013 -0800 +++ b/static/tpl/special-changes.html Wed Feb 27 22:55:11 2013 -0800 @@ -6,31 +6,37 @@ <table class="table table-hover"> <thead> <tr> - <th>Rev.</th> - <th>Date</th> - <th>Author</th> - <th>Changes</th> - <th>Comment</th> - <th><button id="diff-revs" class="btn btn-primary">Show Diff.</button></th> + <th>Revision</th> + <th>Information</th> </tr> </thead> <tbody> {{#eachr history}} <tr> - <td>{{rev_id}}</td> - <td>{{date timestamp}}</td> - <td>{{author}}</td> + <td>{{rev_name}}</td> <td> - {{#each changes}} - <a href="/#/read/{{url}}">{{url}}</a> - {{#if is_edit}}(edit) {{/if}} - {{#if is_add}}(added) {{/if}} - {{#if is_delete}}(deleted) {{/if}} - <br/> - {{/each}} + <dl class="dl-horizontal"> + <dt>Date</dt> + <dd>{{date_from_now timestamp}}</dd> + <dt>Author</dt> + <dd>{{author}}</dd> + <dt>Pages</dt> + <dd> + <ul class="unstyled"> + {{#each changes}} + <li> + <a href="/#/read/{{url}}">{{url}}</a> + {{#if is_edit}}(edit) {{/if}} + {{#if is_add}}(added) {{/if}} + {{#if is_delete}}(deleted) {{/if}} + </li> + {{/each}} + </ul> + </dd> + <dt>Comment</dt> + <dd>{{description}}</dd> + </dl> </td> - <td>{{description}}</td> - <td></td> </tr> {{/eachr}} </tbody>
--- a/wikked/scm.py Wed Feb 27 22:13:42 2013 -0800 +++ b/wikked/scm.py Wed Feb 27 22:55:11 2013 -0800 @@ -71,6 +71,11 @@ def __init__(self, root, logger=None): SourceControl.__init__(self, logger) self.root = root + self.actions = { + 'A': ACTION_ADD, + 'R': ACTION_DELETE, + 'M': ACTION_EDIT + } def initRepo(self): # Make a Mercurial repo if there's none. @@ -107,11 +112,6 @@ self.hg = 'hg' self.log_style = os.path.join(os.path.dirname(__file__), 'resources', 'hg_log.style') - self.actions = { - 'A': ACTION_ADD, - 'R': ACTION_DELETE, - 'M': ACTION_EDIT - } def getHistory(self, path=None): if path is not None: @@ -211,7 +211,10 @@ for j in range(i + 1, len(lines)): if lines[j] == '': continue - rev.files.append({'path': lines[j][2:], 'action': self.actions[lines[j][0]]}) + rev.files.append({ + 'path': lines[j][2:], + 'action': self.actions[lines[j][0]] + }) return rev @@ -230,10 +233,12 @@ if len(status) > 0 and status[0] == '?': return [] + needs_files = False if path is not None: - repo_revs = self.client.log(files=[path]) + repo_revs = self.client.log(files=[path], follow=True) else: - repo_revs = self.client.log() + needs_files = True + repo_revs = self.client.log(follow=True) revisions = [] for rev in repo_revs: r = Revision(rev.node) @@ -241,6 +246,13 @@ r.author = rev.author r.timestamp = time.mktime(rev.date.timetuple()) r.description = rev.desc + if needs_files: + rev_statuses = self.client.status(change=rev.node) + for rev_status in rev_statuses: + r.files.append({ + 'path': rev_status[1], + 'action': self.actions[rev_status[0]] + }) revisions.append(r) return revisions