29 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
29 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
30 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
30 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
31 # be specifying the version(s) of Mercurial they are tested with, or |
31 # be specifying the version(s) of Mercurial they are tested with, or |
32 # leave the attribute unspecified. |
32 # leave the attribute unspecified. |
33 testedwith = 'ships-with-hg-core' |
33 testedwith = 'ships-with-hg-core' |
34 |
|
35 def maketemplater(ui, repo, tmpl): |
|
36 return cmdutil.changeset_templater(ui, repo, False, None, tmpl, None, False) |
|
37 |
34 |
38 def changedlines(ui, repo, ctx1, ctx2, fns): |
35 def changedlines(ui, repo, ctx1, ctx2, fns): |
39 added, removed = 0, 0 |
36 added, removed = 0, 0 |
40 fmatch = scmutil.matchfiles(repo, fns) |
37 fmatch = scmutil.matchfiles(repo, fns) |
41 diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch)) |
38 diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch)) |
53 t, tz = ctx.date() |
50 t, tz = ctx.date() |
54 date = datetime.datetime(*time.gmtime(float(t) - tz)[:6]) |
51 date = datetime.datetime(*time.gmtime(float(t) - tz)[:6]) |
55 return date.strftime(opts['dateformat']) |
52 return date.strftime(opts['dateformat']) |
56 else: |
53 else: |
57 tmpl = opts.get('oldtemplate') or opts.get('template') |
54 tmpl = opts.get('oldtemplate') or opts.get('template') |
58 tmpl = maketemplater(ui, repo, tmpl) |
55 tmpl = cmdutil.makelogtemplater(ui, repo, tmpl) |
59 def getkey(ctx): |
56 def getkey(ctx): |
60 ui.pushbuffer() |
57 ui.pushbuffer() |
61 tmpl.show(ctx) |
58 tmpl.show(ctx) |
62 return ui.popbuffer() |
59 return ui.popbuffer() |
63 |
60 |