hgext/churn.py
changeset 14322 a90131b85fd8
parent 14040 9d2be7e17fc1
child 14671 35c2cc322ba8
equal deleted inserted replaced
14321:003d63bb4fa5 14322:a90131b85fd8
     7 # GNU General Public License version 2 or any later version.
     7 # GNU General Public License version 2 or any later version.
     8 
     8 
     9 '''command to display statistics about repository history'''
     9 '''command to display statistics about repository history'''
    10 
    10 
    11 from mercurial.i18n import _
    11 from mercurial.i18n import _
    12 from mercurial import patch, cmdutil, util, templater, commands
    12 from mercurial import patch, cmdutil, scmutil, util, templater, commands
    13 import os
    13 import os
    14 import time, datetime
    14 import time, datetime
    15 
    15 
    16 def maketemplater(ui, repo, tmpl):
    16 def maketemplater(ui, repo, tmpl):
    17     tmpl = templater.parsestring(tmpl, quoted=False)
    17     tmpl = templater.parsestring(tmpl, quoted=False)
    22     t.use_template(tmpl)
    22     t.use_template(tmpl)
    23     return t
    23     return t
    24 
    24 
    25 def changedlines(ui, repo, ctx1, ctx2, fns):
    25 def changedlines(ui, repo, ctx1, ctx2, fns):
    26     added, removed = 0, 0
    26     added, removed = 0, 0
    27     fmatch = cmdutil.matchfiles(repo, fns)
    27     fmatch = scmutil.matchfiles(repo, fns)
    28     diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch))
    28     diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch))
    29     for l in diff.split('\n'):
    29     for l in diff.split('\n'):
    30         if l.startswith("+") and not l.startswith("+++ "):
    30         if l.startswith("+") and not l.startswith("+++ "):
    31             added += 1
    31             added += 1
    32         elif l.startswith("-") and not l.startswith("--- "):
    32         elif l.startswith("-") and not l.startswith("--- "):
    52     rate = {}
    52     rate = {}
    53     df = False
    53     df = False
    54     if opts.get('date'):
    54     if opts.get('date'):
    55         df = util.matchdate(opts['date'])
    55         df = util.matchdate(opts['date'])
    56 
    56 
    57     m = cmdutil.match(repo, pats, opts)
    57     m = scmutil.match(repo, pats, opts)
    58     def prep(ctx, fns):
    58     def prep(ctx, fns):
    59         rev = ctx.rev()
    59         rev = ctx.rev()
    60         if df and not df(ctx.date()[0]): # doesn't match date format
    60         if df and not df(ctx.date()[0]): # doesn't match date format
    61             return
    61             return
    62 
    62