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