Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG1fb9e01328e4: py3: use pycompat.strkwargs to convert kwargs keys to str
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
return tmpl("filerevision", | return tmpl("filerevision", | ||||
file=f, | file=f, | ||||
path=webutil.up(f), | path=webutil.up(f), | ||||
text=lines(), | text=lines(), | ||||
symrev=webutil.symrevorshortnode(req, fctx), | symrev=webutil.symrevorshortnode(req, fctx), | ||||
rename=webutil.renamelink(fctx), | rename=webutil.renamelink(fctx), | ||||
permissions=fctx.manifest().flags(f), | permissions=fctx.manifest().flags(f), | ||||
ishead=int(ishead), | ishead=int(ishead), | ||||
**webutil.commonentry(web.repo, fctx)) | **pycompat.strkwargs(webutil.commonentry(web.repo, fctx))) | ||||
@webcommand('file') | @webcommand('file') | ||||
def file(web, req, tmpl): | def file(web, req, tmpl): | ||||
""" | """ | ||||
/file/{revision}[/{path}] | /file/{revision}[/{path}] | ||||
------------------------- | ------------------------- | ||||
Show information about a directory or file in the repository. | Show information about a directory or file in the repository. | ||||
n = ctx.node() | n = ctx.node() | ||||
showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) | showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) | ||||
files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) | files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) | ||||
yield tmpl('searchentry', | yield tmpl('searchentry', | ||||
parity=next(parity), | parity=next(parity), | ||||
changelogtag=showtags, | changelogtag=showtags, | ||||
files=files, | files=files, | ||||
**webutil.commonentry(web.repo, ctx)) | **pycompat.strkwargs(webutil.commonentry(web.repo, ctx))) | ||||
if count >= revcount: | if count >= revcount: | ||||
break | break | ||||
query = req.form['rev'][0] | query = req.form['rev'][0] | ||||
revcount = web.maxchanges | revcount = web.maxchanges | ||||
if 'revcount' in req.form: | if 'revcount' in req.form: | ||||
try: | try: | ||||
if start < end: | if start < end: | ||||
revs = web.repo.changelog.revs(start, end - 1) | revs = web.repo.changelog.revs(start, end - 1) | ||||
for i in revs: | for i in revs: | ||||
ctx = web.repo[i] | ctx = web.repo[i] | ||||
l.append(tmpl( | l.append(tmpl( | ||||
'shortlogentry', | 'shortlogentry', | ||||
parity=next(parity), | parity=next(parity), | ||||
**webutil.commonentry(web.repo, ctx))) | **pycompat.strkwargs(webutil.commonentry(web.repo, ctx)))) | ||||
for entry in reversed(l): | for entry in reversed(l): | ||||
yield entry | yield entry | ||||
tip = web.repo['tip'] | tip = web.repo['tip'] | ||||
count = len(web.repo) | count = len(web.repo) | ||||
start = max(0, count - web.maxchanges) | start = max(0, count - web.maxchanges) | ||||
end = min(count, start + web.maxchanges) | end = min(count, start + web.maxchanges) | ||||
else: | else: | ||||
rename = [] | rename = [] | ||||
ctx = ctx | ctx = ctx | ||||
return tmpl("filediff", | return tmpl("filediff", | ||||
file=path, | file=path, | ||||
symrev=webutil.symrevorshortnode(req, ctx), | symrev=webutil.symrevorshortnode(req, ctx), | ||||
rename=rename, | rename=rename, | ||||
diff=diffs, | diff=diffs, | ||||
**webutil.commonentry(web.repo, ctx)) | **pycompat.strkwargs(webutil.commonentry(web.repo, ctx))) | ||||
diff = webcommand('diff')(filediff) | diff = webcommand('diff')(filediff) | ||||
@webcommand('comparison') | @webcommand('comparison') | ||||
def comparison(web, req, tmpl): | def comparison(web, req, tmpl): | ||||
""" | """ | ||||
/comparison/{revision}/{path} | /comparison/{revision}/{path} | ||||
----------------------------- | ----------------------------- | ||||
file=path, | file=path, | ||||
symrev=webutil.symrevorshortnode(req, ctx), | symrev=webutil.symrevorshortnode(req, ctx), | ||||
rename=rename, | rename=rename, | ||||
leftrev=leftrev, | leftrev=leftrev, | ||||
leftnode=hex(leftnode), | leftnode=hex(leftnode), | ||||
rightrev=rightrev, | rightrev=rightrev, | ||||
rightnode=hex(rightnode), | rightnode=hex(rightnode), | ||||
comparison=comparison, | comparison=comparison, | ||||
**webutil.commonentry(web.repo, ctx)) | **pycompat.strkwargs(webutil.commonentry(web.repo, ctx))) | ||||
@webcommand('annotate') | @webcommand('annotate') | ||||
def annotate(web, req, tmpl): | def annotate(web, req, tmpl): | ||||
""" | """ | ||||
/annotate/{revision}/{path} | /annotate/{revision}/{path} | ||||
--------------------------- | --------------------------- | ||||
Show changeset information for each line in a file. | Show changeset information for each line in a file. | ||||
file=f, | file=f, | ||||
annotate=annotate, | annotate=annotate, | ||||
path=webutil.up(f), | path=webutil.up(f), | ||||
symrev=webutil.symrevorshortnode(req, fctx), | symrev=webutil.symrevorshortnode(req, fctx), | ||||
rename=webutil.renamelink(fctx), | rename=webutil.renamelink(fctx), | ||||
permissions=fctx.manifest().flags(f), | permissions=fctx.manifest().flags(f), | ||||
ishead=int(ishead), | ishead=int(ishead), | ||||
diffopts=diffopts, | diffopts=diffopts, | ||||
**webutil.commonentry(web.repo, fctx)) | **pycompat.strkwargs(webutil.commonentry(web.repo, fctx))) | ||||
@webcommand('filelog') | @webcommand('filelog') | ||||
def filelog(web, req, tmpl): | def filelog(web, req, tmpl): | ||||
""" | """ | ||||
/filelog/{revision}/{path} | /filelog/{revision}/{path} | ||||
-------------------------- | -------------------------- | ||||
Show information about the history of a file in the repository. | Show information about the history of a file in the repository. | ||||
# follow renames accross filtered (not in range) revisions | # follow renames accross filtered (not in range) revisions | ||||
path = c.path() | path = c.path() | ||||
entries.append(dict( | entries.append(dict( | ||||
parity=next(parity), | parity=next(parity), | ||||
filerev=c.rev(), | filerev=c.rev(), | ||||
file=path, | file=path, | ||||
diff=diffs, | diff=diffs, | ||||
linerange=webutil.formatlinerange(*lr), | linerange=webutil.formatlinerange(*lr), | ||||
**webutil.commonentry(repo, c))) | **pycompat.strkwargs(webutil.commonentry(repo, c)))) | ||||
if i == revcount: | if i == revcount: | ||||
break | break | ||||
lessvars['linerange'] = webutil.formatlinerange(*lrange) | lessvars['linerange'] = webutil.formatlinerange(*lrange) | ||||
morevars['linerange'] = lessvars['linerange'] | morevars['linerange'] = lessvars['linerange'] | ||||
else: | else: | ||||
for i in revs: | for i in revs: | ||||
iterfctx = fctx.filectx(i) | iterfctx = fctx.filectx(i) | ||||
diffs = None | diffs = None | ||||
if patch: | if patch: | ||||
diffs = diff(iterfctx) | diffs = diff(iterfctx) | ||||
entries.append(dict( | entries.append(dict( | ||||
parity=next(parity), | parity=next(parity), | ||||
filerev=i, | filerev=i, | ||||
file=f, | file=f, | ||||
diff=diffs, | diff=diffs, | ||||
rename=webutil.renamelink(iterfctx), | rename=webutil.renamelink(iterfctx), | ||||
**webutil.commonentry(repo, iterfctx))) | **pycompat.strkwargs(webutil.commonentry(repo, iterfctx)))) | ||||
entries.reverse() | entries.reverse() | ||||
revnav = webutil.filerevnav(web.repo, fctx.path()) | revnav = webutil.filerevnav(web.repo, fctx.path()) | ||||
nav = revnav.gen(end - 1, revcount, count) | nav = revnav.gen(end - 1, revcount, count) | ||||
latestentry = entries[:1] | latestentry = entries[:1] | ||||
return tmpl("filelog", | return tmpl("filelog", | ||||
file=f, | file=f, | ||||
nav=nav, | nav=nav, | ||||
symrev=webutil.symrevorshortnode(req, fctx), | symrev=webutil.symrevorshortnode(req, fctx), | ||||
entries=entries, | entries=entries, | ||||
descend=descend, | descend=descend, | ||||
patch=patch, | patch=patch, | ||||
latestentry=latestentry, | latestentry=latestentry, | ||||
linerange=linerange, | linerange=linerange, | ||||
revcount=revcount, | revcount=revcount, | ||||
morevars=morevars, | morevars=morevars, | ||||
lessvars=lessvars, | lessvars=lessvars, | ||||
**webutil.commonentry(web.repo, fctx)) | **pycompat.strkwargs(webutil.commonentry(web.repo, fctx))) | ||||
@webcommand('archive') | @webcommand('archive') | ||||
def archive(web, req, tmpl): | def archive(web, req, tmpl): | ||||
""" | """ | ||||
/archive/{revision}.{format}[/{path}] | /archive/{revision}.{format}[/{path}] | ||||
------------------------------------- | ------------------------------------- | ||||
Obtain an archive of repository content. | Obtain an archive of repository content. |
basenode=basectx.hex(), | basenode=basectx.hex(), | ||||
changesettag=showtags, | changesettag=showtags, | ||||
changesetbookmark=showbookmarks, | changesetbookmark=showbookmarks, | ||||
changesetbranch=showbranch, | changesetbranch=showbranch, | ||||
files=files, | files=files, | ||||
diffsummary=lambda **x: diffsummary(diffstatsgen), | diffsummary=lambda **x: diffsummary(diffstatsgen), | ||||
diffstat=diffstats, | diffstat=diffstats, | ||||
archives=web.archivelist(ctx.hex()), | archives=web.archivelist(ctx.hex()), | ||||
**commonentry(web.repo, ctx)) | **pycompat.strkwargs(commonentry(web.repo, ctx))) | ||||
def listfilediffs(tmpl, files, node, max): | def listfilediffs(tmpl, files, node, max): | ||||
for f in files[:max]: | for f in files[:max]: | ||||
yield tmpl('filedifflink', node=hex(node), file=f) | yield tmpl('filedifflink', node=hex(node), file=f) | ||||
if len(files) > max: | if len(files) > max: | ||||
yield tmpl('fileellipses') | yield tmpl('fileellipses') | ||||
def diffs(web, tmpl, ctx, basectx, files, style, linerange=None, | def diffs(web, tmpl, ctx, basectx, files, style, linerange=None, |