Changeset 154:88bdee529635
- Timestamp:
- 11/29/08 20:51:16
(7 months ago)
- Author:
- shadytrees
- branch:
- default
- Message:
[NEW] History view.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r152 |
r154 |
|
| 18 | 18 | def _show(self, rev, changenode, copies, props): |
|---|
| 19 | 19 | changes = self.repo.changelog.read(changenode) |
|---|
| 20 | | self.stack.append({'rev': rev, 'date': changes[2], |
|---|
| | 20 | date = time.strftime('%Y-%m-%d %I:%M %p', time.gmtime(changes[2][0])) |
|---|
| | 21 | self.stack.append({'rev': rev, 'date': date, |
|---|
| 21 | 22 | 'files': changes[3], 'copies': copies, |
|---|
| | 23 | 'summary': changes[4], |
|---|
| 22 | 24 | }) |
|---|
| 23 | 25 | |
|---|
| r149 |
r154 |
|
| 57 | 57 | |
|---|
| 58 | 58 | def heat_up(self): |
|---|
| 59 | | miniurls = 'edit update delete'.split() |
|---|
| | 59 | miniurls = 'edit update delete history'.split() |
|---|
| 60 | 60 | heat = self.args.getfirst('heat') |
|---|
| 61 | 61 | if heat in miniurls: return heat |
|---|
| … | … | |
| 96 | 96 | self.redirect(goto) |
|---|
| 97 | 97 | |
|---|
| | 98 | def history(self): |
|---|
| | 99 | from textwrap import fill |
|---|
| | 100 | goto = './%s?heat=history' % self.file |
|---|
| | 101 | if not Administrator(self).require(goto): return |
|---|
| | 102 | self.view = 'history.html' |
|---|
| | 103 | self.rays['title'] = 'Time machine for %s' % self.file |
|---|
| | 104 | |
|---|
| | 105 | p = page.Page(self.file) |
|---|
| | 106 | if p.exists(): self.rays['history'] = p.history() |
|---|
| | 107 | else: self.rays['history'] = [] |
|---|
| | 108 | |
|---|
| 98 | 109 | def crud_magic(self): |
|---|
| 99 | 110 | """ Simple CRUD idiom available for MainPage descendants """ |
|---|
| r140 |
r154 |
|
| 42 | 42 | return self |
|---|
| 43 | 43 | |
|---|
| | 44 | def exists(self): return os.path.exists(self.path) |
|---|
| | 45 | |
|---|
| 44 | 46 | class HgPage(BasePage): |
|---|
| 45 | 47 | def __init__(self, path): |
|---|
| | 48 | """ |
|---|
| | 49 | * self.path is the path to the file. |
|---|
| | 50 | * self.file is the file name without the .txt, used for commit |
|---|
| | 51 | messages. |
|---|
| | 52 | """ |
|---|
| 46 | 53 | BasePage.__init__(self, path) |
|---|
| 47 | 54 | self.file = path |
|---|
| … | … | |
| 49 | 56 | |
|---|
| 50 | 57 | def write(self, body, user): |
|---|
| 51 | | BasePage.write(self, body,user) |
|---|
| | 58 | BasePage.write(self, body, user) |
|---|
| 52 | 59 | self.hg.addremove().commit(user, self.file) |
|---|
| 53 | 60 | |
|---|
| … | … | |
| 56 | 63 | self.hg.addremove().commit(user, self.file) |
|---|
| 57 | 64 | |
|---|
| | 65 | def history(self): |
|---|
| | 66 | return self.hg.log(self.path) |
|---|
| | 67 | |
|---|
| 58 | 68 | Page = HgPage |
|---|