overhaul.py

a draft of an helper hg extension - Alessio Franceschelli, 2010-03-18 16:25

Download (832 Bytes)

 
1
# overhaul draft extension for Mercurial
2
# it's a draft to show a possible way to explore repository by the Redmine overhaul patch
3
# see: http://www.redmine.org/issues/4455
4
#
5
# Copyright 2010 Alessio Franceschelli (alefranz.net)
6
#
7
# This software may be used and distributed according to the terms of the
8
# GNU General Public License version 2 or any later version.
9

    
10
'''command to list revision of each file
11
'''
12

    
13
from mercurial import cmdutil, commands 
14
from mercurial.i18n import _ 
15

    
16
def overhaul(ui, repo, rev=None, **opts):
17
        mf = repo[rev].manifest() 
18
        for f in repo[rev]: 
19
                try: 
20
                        fctx = repo.filectx(f, fileid=mf[f]) 
21
                        ctx = fctx.changectx()
22
                        ui.write('%s\t%d\t%s\n' % 
23
                                        (ctx,fctx.size(),f)) 
24
                except LookupError: 
25
                        pass 
26

    
27
cmdtable = { 
28
    'overhaul': (overhaul,commands.templateopts, _('hg overhaul [rev]')) 
29
}