Assembla home | Assembla project page
 

Changeset 154:88bdee529635

Show
Ignore:
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
  • lib/simple_hg.py

    r152 r154  
    1818    def _show(self, rev, changenode, copies, props): 
    1919        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, 
    2122                           'files': changes[3], 'copies': copies, 
     23                           'summary': changes[4], 
    2224                           }) 
    2325 
  • ovenfreak/logics/main.py

    r149 r154  
    5757 
    5858    def heat_up(self): 
    59         miniurls = 'edit update delete'.split() 
     59        miniurls = 'edit update delete history'.split() 
    6060        heat = self.args.getfirst('heat') 
    6161        if heat in miniurls: return heat 
     
    9696        self.redirect(goto) 
    9797 
     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 
    98109    def crud_magic(self): 
    99110        """ Simple CRUD idiom available for MainPage descendants """ 
  • ovenfreak/page.py

    r140 r154  
    4242        return self 
    4343 
     44    def exists(self): return os.path.exists(self.path) 
     45 
    4446class HgPage(BasePage): 
    4547    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        """ 
    4653        BasePage.__init__(self, path) 
    4754        self.file = path 
     
    4956 
    5057    def write(self, body, user): 
    51         BasePage.write(self, body,user) 
     58        BasePage.write(self, body, user) 
    5259        self.hg.addremove().commit(user, self.file) 
    5360 
     
    5663        self.hg.addremove().commit(user, self.file) 
    5764 
     65    def history(self): 
     66        return self.hg.log(self.path) 
     67 
    5868Page = HgPage