##// END OF EJS Templates
py3: handle keyword arguments in hgext/churn.py...
Pulkit Goyal -
r34975:26ed66ab default
parent child Browse files
Show More
@@ -19,6 +19,7 b' from mercurial import ('
19 cmdutil,
19 cmdutil,
20 encoding,
20 encoding,
21 patch,
21 patch,
22 pycompat,
22 registrar,
23 registrar,
23 scmutil,
24 scmutil,
24 util,
25 util,
@@ -45,6 +46,7 b' def changedlines(ui, repo, ctx1, ctx2, f'
45
46
46 def countrate(ui, repo, amap, *pats, **opts):
47 def countrate(ui, repo, amap, *pats, **opts):
47 """Calculate stats"""
48 """Calculate stats"""
49 opts = pycompat.byteskwargs(opts)
48 if opts.get('dateformat'):
50 if opts.get('dateformat'):
49 def getkey(ctx):
51 def getkey(ctx):
50 t, tz = ctx.date()
52 t, tz = ctx.date()
@@ -154,7 +156,7 b' def churn(ui, repo, *pats, **opts):'
154 return s + " " * (l - encoding.colwidth(s))
156 return s + " " * (l - encoding.colwidth(s))
155
157
156 amap = {}
158 amap = {}
157 aliases = opts.get('aliases')
159 aliases = opts.get(r'aliases')
158 if not aliases and os.path.exists(repo.wjoin('.hgchurn')):
160 if not aliases and os.path.exists(repo.wjoin('.hgchurn')):
159 aliases = repo.wjoin('.hgchurn')
161 aliases = repo.wjoin('.hgchurn')
160 if aliases:
162 if aliases:
@@ -172,7 +174,7 b' def churn(ui, repo, *pats, **opts):'
172 if not rate:
174 if not rate:
173 return
175 return
174
176
175 if opts.get('sort'):
177 if opts.get(r'sort'):
176 rate.sort()
178 rate.sort()
177 else:
179 else:
178 rate.sort(key=lambda x: (-sum(x[1]), x))
180 rate.sort(key=lambda x: (-sum(x[1]), x))
@@ -185,7 +187,7 b' def churn(ui, repo, *pats, **opts):'
185 ui.debug("assuming %i character terminal\n" % ttywidth)
187 ui.debug("assuming %i character terminal\n" % ttywidth)
186 width = ttywidth - maxname - 2 - 2 - 2
188 width = ttywidth - maxname - 2 - 2 - 2
187
189
188 if opts.get('diffstat'):
190 if opts.get(r'diffstat'):
189 width -= 15
191 width -= 15
190 def format(name, diffstat):
192 def format(name, diffstat):
191 added, removed = diffstat
193 added, removed = diffstat
General Comments 0
You need to be logged in to leave comments. Login now