Show More
@@ -710,13 +710,20 b' class changeset_templater(changeset_prin' | |||
|
710 | 710 | '''set template string to use''' |
|
711 | 711 | self.t.cache['changeset'] = t |
|
712 | 712 | |
|
713 | def _meaningful_parentrevs(self, ctx): | |
|
714 | """Return list of meaningful (or all if debug) parentrevs for rev. | |
|
715 | """ | |
|
716 | parents = ctx.parents() | |
|
717 | if len(parents) > 1: | |
|
718 | return parents | |
|
719 | if self.ui.debugflag: | |
|
720 | return [parents[0], self.repo['null']] | |
|
721 | if parents[0].rev() >= ctx.rev() - 1: | |
|
722 | return [] | |
|
723 | return parents | |
|
724 | ||
|
713 | 725 | def _show(self, ctx, copies, props): |
|
714 | 726 | '''show a single changeset or file revision''' |
|
715 | changenode = ctx.node() | |
|
716 | rev = ctx.rev() | |
|
717 | ||
|
718 | log = self.repo.changelog | |
|
719 | changes = log.read(changenode) | |
|
720 | 727 | |
|
721 | 728 | def showlist(name, values, plural=None, **args): |
|
722 | 729 | '''expand set of values. |
@@ -780,21 +787,21 b' class changeset_templater(changeset_prin' | |||
|
780 | 787 | yield self.t(endname, **args) |
|
781 | 788 | |
|
782 | 789 | def showbranches(**args): |
|
783 |
branch = c |
|
|
790 | branch = ctx.branch() | |
|
784 | 791 | if branch != 'default': |
|
785 | 792 | branch = util.tolocal(branch) |
|
786 | 793 | return showlist('branch', [branch], plural='branches', **args) |
|
787 | 794 | |
|
788 | 795 | def showparents(**args): |
|
789 |
parents = [[('rev', p), ('node', hex( |
|
|
790 |
for p in self._meaningful_parentrevs( |
|
|
796 | parents = [[('rev', p.rev()), ('node', p.hex())] | |
|
797 | for p in self._meaningful_parentrevs(ctx)] | |
|
791 | 798 | return showlist('parent', parents, **args) |
|
792 | 799 | |
|
793 | 800 | def showtags(**args): |
|
794 |
return showlist('tag', |
|
|
801 | return showlist('tag', ctx.tags(), **args) | |
|
795 | 802 | |
|
796 | 803 | def showextras(**args): |
|
797 |
for key, value in util.sort(c |
|
|
804 | for key, value in util.sort(ctx.extra().items()): | |
|
798 | 805 | args = args.copy() |
|
799 | 806 | args.update(dict(key=key, value=value)) |
|
800 | 807 | yield self.t('extra', **args) |
@@ -806,11 +813,11 b' class changeset_templater(changeset_prin' | |||
|
806 | 813 | files = [] |
|
807 | 814 | def getfiles(): |
|
808 | 815 | if not files: |
|
809 | files[:] = self.repo.status( | |
|
810 | log.parents(changenode)[0], changenode)[:3] | |
|
816 | files[:] = self.repo.status(ctx.parents()[0].node(), | |
|
817 | ctx.node())[:3] | |
|
811 | 818 | return files |
|
812 | 819 | def showfiles(**args): |
|
813 |
return showlist('file', c |
|
|
820 | return showlist('file', ctx.files(), **args) | |
|
814 | 821 | def showmods(**args): |
|
815 | 822 | return showlist('file_mod', getfiles()[0], **args) |
|
816 | 823 | def showadds(**args): |
@@ -819,24 +826,24 b' class changeset_templater(changeset_prin' | |||
|
819 | 826 | return showlist('file_del', getfiles()[2], **args) |
|
820 | 827 | def showmanifest(**args): |
|
821 | 828 | args = args.copy() |
|
822 | args.update(dict(rev=self.repo.manifest.rev(changes[0]), | |
|
823 | node=hex(changes[0]))) | |
|
829 | args.update(dict(rev=self.repo.manifest.rev(ctx.changeset()[0]), | |
|
830 | node=hex(ctx.changeset()[0]))) | |
|
824 | 831 | return self.t('manifest', **args) |
|
825 | 832 | |
|
826 | 833 | defprops = { |
|
827 |
'author': c |
|
|
834 | 'author': ctx.user(), | |
|
828 | 835 | 'branches': showbranches, |
|
829 |
'date': c |
|
|
830 |
'desc': c |
|
|
836 | 'date': ctx.date(), | |
|
837 | 'desc': ctx.description().strip(), | |
|
831 | 838 | 'file_adds': showadds, |
|
832 | 839 | 'file_dels': showdels, |
|
833 | 840 | 'file_mods': showmods, |
|
834 | 841 | 'files': showfiles, |
|
835 | 842 | 'file_copies': showcopies, |
|
836 | 843 | 'manifest': showmanifest, |
|
837 |
'node': hex( |
|
|
844 | 'node': ctx.hex(), | |
|
838 | 845 | 'parents': showparents, |
|
839 | 'rev': rev, | |
|
846 | 'rev': ctx.rev(), | |
|
840 | 847 | 'tags': showtags, |
|
841 | 848 | 'extras': showextras, |
|
842 | 849 | } |
@@ -857,7 +864,7 b' class changeset_templater(changeset_prin' | |||
|
857 | 864 | if key: |
|
858 | 865 | h = templater.stringify(self.t(key, **props)) |
|
859 | 866 | if self.buffered: |
|
860 | self.header[rev] = h | |
|
867 | self.header[ctx.rev()] = h | |
|
861 | 868 | else: |
|
862 | 869 | self.ui.write(h) |
|
863 | 870 | if self.ui.debugflag and 'changeset_debug' in self.t: |
@@ -869,7 +876,7 b' class changeset_templater(changeset_prin' | |||
|
869 | 876 | else: |
|
870 | 877 | key = 'changeset' |
|
871 | 878 | self.ui.write(templater.stringify(self.t(key, **props))) |
|
872 |
self.showpatch(c |
|
|
879 | self.showpatch(ctx.node()) | |
|
873 | 880 | except KeyError, inst: |
|
874 | 881 | raise util.Abort(_("%s: no key named '%s'") % (self.t.mapfile, |
|
875 | 882 | inst.args[0])) |
General Comments 0
You need to be logged in to leave comments.
Login now