143 |
143 |
144 return tmpl("filerevision", |
144 return tmpl("filerevision", |
145 file=f, |
145 file=f, |
146 path=webutil.up(f), |
146 path=webutil.up(f), |
147 text=lines(), |
147 text=lines(), |
148 rev=fctx.rev(), |
|
149 symrev=webutil.symrevorshortnode(req, fctx), |
148 symrev=webutil.symrevorshortnode(req, fctx), |
150 node=fctx.hex(), |
|
151 author=fctx.user(), |
|
152 date=fctx.date(), |
|
153 desc=fctx.description(), |
|
154 extra=fctx.extra(), |
|
155 branch=webutil.nodebranchnodefault(fctx), |
|
156 parent=webutil.parents(fctx), |
|
157 child=webutil.children(fctx), |
|
158 rename=webutil.renamelink(fctx), |
149 rename=webutil.renamelink(fctx), |
159 tags=webutil.nodetagsdict(web.repo, fctx.node()), |
150 permissions=fctx.manifest().flags(f), |
160 bookmarks=webutil.nodebookmarksdict(web.repo, fctx.node()), |
151 **webutil.commonentry(web.repo, fctx)) |
161 permissions=fctx.manifest().flags(f)) |
|
162 |
152 |
163 @webcommand('file') |
153 @webcommand('file') |
164 def file(web, req, tmpl): |
154 def file(web, req, tmpl): |
165 """ |
155 """ |
166 /file/{revision}[/{path}] |
156 /file/{revision}[/{path}] |
287 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) |
277 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) |
288 files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) |
278 files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) |
289 |
279 |
290 yield tmpl('searchentry', |
280 yield tmpl('searchentry', |
291 parity=parity.next(), |
281 parity=parity.next(), |
292 author=ctx.user(), |
|
293 parent=lambda **x: webutil.parents(ctx), |
|
294 child=lambda **x: webutil.children(ctx), |
|
295 changelogtag=showtags, |
282 changelogtag=showtags, |
296 desc=ctx.description(), |
|
297 extra=ctx.extra(), |
|
298 date=ctx.date(), |
|
299 files=files, |
283 files=files, |
300 rev=ctx.rev(), |
284 **webutil.commonentry(web.repo, ctx)) |
301 node=hex(n), |
|
302 tags=webutil.nodetagsdict(web.repo, n), |
|
303 bookmarks=webutil.nodebookmarksdict(web.repo, n), |
|
304 inbranch=webutil.nodeinbranch(web.repo, ctx), |
|
305 branches=webutil.nodebranchdict(web.repo, ctx)) |
|
306 |
285 |
307 if count >= revcount: |
286 if count >= revcount: |
308 break |
287 break |
309 |
288 |
310 query = req.form['rev'][0] |
289 query = req.form['rev'][0] |
570 "path": path, |
549 "path": path, |
571 "emptydirs": "/".join(emptydirs), |
550 "emptydirs": "/".join(emptydirs), |
572 "basename": d} |
551 "basename": d} |
573 |
552 |
574 return tmpl("manifest", |
553 return tmpl("manifest", |
575 rev=ctx.rev(), |
|
576 symrev=symrev, |
554 symrev=symrev, |
577 node=hex(node), |
|
578 path=abspath, |
555 path=abspath, |
579 up=webutil.up(abspath), |
556 up=webutil.up(abspath), |
580 upparity=parity.next(), |
557 upparity=parity.next(), |
581 fentries=filelist, |
558 fentries=filelist, |
582 dentries=dirlist, |
559 dentries=dirlist, |
583 archives=web.archivelist(hex(node)), |
560 archives=web.archivelist(hex(node)), |
584 tags=webutil.nodetagsdict(web.repo, node), |
561 **webutil.commonentry(web.repo, ctx)) |
585 bookmarks=webutil.nodebookmarksdict(web.repo, node), |
|
586 branch=webutil.nodebranchnodefault(ctx), |
|
587 inbranch=webutil.nodeinbranch(web.repo, ctx), |
|
588 branches=webutil.nodebranchdict(web.repo, ctx)) |
|
589 |
562 |
590 @webcommand('tags') |
563 @webcommand('tags') |
591 def tags(web, req, tmpl): |
564 def tags(web, req, tmpl): |
592 """ |
565 """ |
593 /tags |
566 /tags |
717 revs = [] |
690 revs = [] |
718 if start < end: |
691 if start < end: |
719 revs = web.repo.changelog.revs(start, end - 1) |
692 revs = web.repo.changelog.revs(start, end - 1) |
720 for i in revs: |
693 for i in revs: |
721 ctx = web.repo[i] |
694 ctx = web.repo[i] |
722 n = ctx.node() |
|
723 hn = hex(n) |
|
724 |
695 |
725 l.append(tmpl( |
696 l.append(tmpl( |
726 'shortlogentry', |
697 'shortlogentry', |
727 parity=parity.next(), |
698 parity=parity.next(), |
728 author=ctx.user(), |
699 **webutil.commonentry(web.repo, ctx))) |
729 desc=ctx.description(), |
|
730 extra=ctx.extra(), |
|
731 date=ctx.date(), |
|
732 rev=i, |
|
733 node=hn, |
|
734 tags=webutil.nodetagsdict(web.repo, n), |
|
735 bookmarks=webutil.nodebookmarksdict(web.repo, n), |
|
736 inbranch=webutil.nodeinbranch(web.repo, ctx), |
|
737 branches=webutil.nodebranchdict(web.repo, ctx))) |
|
738 |
700 |
739 l.reverse() |
701 l.reverse() |
740 yield l |
702 yield l |
741 |
703 |
742 tip = web.repo['tip'] |
704 tip = web.repo['tip'] |
777 path = webutil.cleanpath(web.repo, req.form['file'][0]) |
739 path = webutil.cleanpath(web.repo, req.form['file'][0]) |
778 if path not in ctx.files(): |
740 if path not in ctx.files(): |
779 raise |
741 raise |
780 |
742 |
781 if fctx is not None: |
743 if fctx is not None: |
782 n = fctx.node() |
|
783 path = fctx.path() |
744 path = fctx.path() |
784 ctx = fctx.changectx() |
745 ctx = fctx.changectx() |
785 else: |
|
786 n = ctx.node() |
|
787 # path already defined in except clause |
|
788 |
746 |
789 parity = paritygen(web.stripecount) |
747 parity = paritygen(web.stripecount) |
790 style = web.config('web', 'style', 'paper') |
748 style = web.config('web', 'style', 'paper') |
791 if 'style' in req.form: |
749 if 'style' in req.form: |
792 style = req.form['style'][0] |
750 style = req.form['style'][0] |
798 else: |
756 else: |
799 rename = [] |
757 rename = [] |
800 ctx = ctx |
758 ctx = ctx |
801 return tmpl("filediff", |
759 return tmpl("filediff", |
802 file=path, |
760 file=path, |
803 node=hex(n), |
|
804 rev=ctx.rev(), |
|
805 symrev=webutil.symrevorshortnode(req, ctx), |
761 symrev=webutil.symrevorshortnode(req, ctx), |
806 date=ctx.date(), |
|
807 desc=ctx.description(), |
|
808 extra=ctx.extra(), |
|
809 author=ctx.user(), |
|
810 rename=rename, |
762 rename=rename, |
811 branch=webutil.nodebranchnodefault(ctx), |
763 diff=diffs, |
812 parent=webutil.parents(ctx), |
764 **webutil.commonentry(web.repo, ctx)) |
813 child=webutil.children(ctx), |
|
814 tags=webutil.nodetagsdict(web.repo, n), |
|
815 bookmarks=webutil.nodebookmarksdict(web.repo, n), |
|
816 diff=diffs) |
|
817 |
765 |
818 diff = webcommand('diff')(filediff) |
766 diff = webcommand('diff')(filediff) |
819 |
767 |
820 @webcommand('comparison') |
768 @webcommand('comparison') |
821 def comparison(web, req, tmpl): |
769 def comparison(web, req, tmpl): |
879 else: |
827 else: |
880 rename = [] |
828 rename = [] |
881 ctx = ctx |
829 ctx = ctx |
882 return tmpl('filecomparison', |
830 return tmpl('filecomparison', |
883 file=path, |
831 file=path, |
884 node=hex(ctx.node()), |
|
885 rev=ctx.rev(), |
|
886 symrev=webutil.symrevorshortnode(req, ctx), |
832 symrev=webutil.symrevorshortnode(req, ctx), |
887 date=ctx.date(), |
|
888 desc=ctx.description(), |
|
889 extra=ctx.extra(), |
|
890 author=ctx.user(), |
|
891 rename=rename, |
833 rename=rename, |
892 branch=webutil.nodebranchnodefault(ctx), |
|
893 parent=webutil.parents(ctx), |
|
894 child=webutil.children(ctx), |
|
895 tags=webutil.nodetagsdict(web.repo, ctx.node()), |
|
896 bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()), |
|
897 leftrev=leftrev, |
834 leftrev=leftrev, |
898 leftnode=hex(leftnode), |
835 leftnode=hex(leftnode), |
899 rightrev=rightrev, |
836 rightrev=rightrev, |
900 rightnode=hex(rightnode), |
837 rightnode=hex(rightnode), |
901 comparison=comparison) |
838 comparison=comparison, |
|
839 **webutil.commonentry(web.repo, ctx)) |
902 |
840 |
903 @webcommand('annotate') |
841 @webcommand('annotate') |
904 def annotate(web, req, tmpl): |
842 def annotate(web, req, tmpl): |
905 """ |
843 """ |
906 /annotate/{revision}/{path} |
844 /annotate/{revision}/{path} |
948 |
886 |
949 return tmpl("fileannotate", |
887 return tmpl("fileannotate", |
950 file=f, |
888 file=f, |
951 annotate=annotate, |
889 annotate=annotate, |
952 path=webutil.up(f), |
890 path=webutil.up(f), |
953 rev=fctx.rev(), |
|
954 symrev=webutil.symrevorshortnode(req, fctx), |
891 symrev=webutil.symrevorshortnode(req, fctx), |
955 node=fctx.hex(), |
|
956 author=fctx.user(), |
|
957 date=fctx.date(), |
|
958 desc=fctx.description(), |
|
959 extra=fctx.extra(), |
|
960 rename=webutil.renamelink(fctx), |
892 rename=webutil.renamelink(fctx), |
961 branch=webutil.nodebranchnodefault(fctx), |
893 permissions=fctx.manifest().flags(f), |
962 parent=webutil.parents(fctx), |
894 **webutil.commonentry(web.repo, fctx)) |
963 child=webutil.children(fctx), |
|
964 tags=webutil.nodetagsdict(web.repo, fctx.node()), |
|
965 bookmarks=webutil.nodebookmarksdict(web.repo, fctx.node()), |
|
966 permissions=fctx.manifest().flags(f)) |
|
967 |
895 |
968 @webcommand('filelog') |
896 @webcommand('filelog') |
969 def filelog(web, req, tmpl): |
897 def filelog(web, req, tmpl): |
970 """ |
898 """ |
971 /filelog/{revision}/{path} |
899 /filelog/{revision}/{path} |
1023 repo = web.repo |
951 repo = web.repo |
1024 revs = fctx.filelog().revs(start, end - 1) |
952 revs = fctx.filelog().revs(start, end - 1) |
1025 for i in revs: |
953 for i in revs: |
1026 iterfctx = fctx.filectx(i) |
954 iterfctx = fctx.filectx(i) |
1027 |
955 |
1028 l.append({"parity": parity.next(), |
956 l.append(dict( |
1029 "filerev": i, |
957 parity=parity.next(), |
1030 "file": f, |
958 filerev=i, |
1031 "node": iterfctx.hex(), |
959 file=f, |
1032 "author": iterfctx.user(), |
960 rename=webutil.renamelink(iterfctx), |
1033 "date": iterfctx.date(), |
961 **webutil.commonentry(repo, iterfctx))) |
1034 "rename": webutil.renamelink(iterfctx), |
|
1035 "parent": lambda **x: webutil.parents(iterfctx), |
|
1036 "child": lambda **x: webutil.children(iterfctx), |
|
1037 "desc": iterfctx.description(), |
|
1038 "extra": iterfctx.extra(), |
|
1039 "tags": webutil.nodetagsdict(repo, iterfctx.node()), |
|
1040 "bookmarks": webutil.nodebookmarksdict( |
|
1041 repo, iterfctx.node()), |
|
1042 "branch": webutil.nodebranchnodefault(iterfctx), |
|
1043 "inbranch": webutil.nodeinbranch(repo, iterfctx), |
|
1044 "branches": webutil.nodebranchdict(repo, iterfctx)}) |
|
1045 for e in reversed(l): |
962 for e in reversed(l): |
1046 yield e |
963 yield e |
1047 |
964 |
1048 entries = list(entries()) |
965 entries = list(entries()) |
1049 latestentry = entries[:1] |
966 latestentry = entries[:1] |
1050 |
967 |
1051 revnav = webutil.filerevnav(web.repo, fctx.path()) |
968 revnav = webutil.filerevnav(web.repo, fctx.path()) |
1052 nav = revnav.gen(end - 1, revcount, count) |
969 nav = revnav.gen(end - 1, revcount, count) |
1053 return tmpl("filelog", file=f, node=fctx.hex(), nav=nav, |
970 return tmpl("filelog", |
1054 rev=fctx.rev(), |
971 file=f, |
|
972 nav=nav, |
1055 symrev=webutil.symrevorshortnode(req, fctx), |
973 symrev=webutil.symrevorshortnode(req, fctx), |
1056 branch=webutil.nodebranchnodefault(fctx), |
|
1057 tags=webutil.nodetagsdict(web.repo, fctx.node()), |
|
1058 bookmarks=webutil.nodebookmarksdict(web.repo, fctx.node()), |
|
1059 entries=entries, |
974 entries=entries, |
1060 latestentry=latestentry, |
975 latestentry=latestentry, |
1061 revcount=revcount, morevars=morevars, lessvars=lessvars) |
976 revcount=revcount, |
|
977 morevars=morevars, |
|
978 lessvars=lessvars, |
|
979 **webutil.commonentry(web.repo, fctx)) |
1062 |
980 |
1063 @webcommand('archive') |
981 @webcommand('archive') |
1064 def archive(web, req, tmpl): |
982 def archive(web, req, tmpl): |
1065 """ |
983 """ |
1066 /archive/{revision}.{format}[/{path}] |
984 /archive/{revision}.{format}[/{path}] |