756 extra = changes[5] |
756 extra = changes[5] |
757 branch = extra.get("branch") |
757 branch = extra.get("branch") |
758 |
758 |
759 hexfunc = self.ui.debugflag and hex or short |
759 hexfunc = self.ui.debugflag and hex or short |
760 |
760 |
761 parents = log.parentrevs(rev) |
761 parents = [(p, hexfunc(log.node(p))) |
762 if not self.ui.debugflag: |
762 for p in self._meaningful_parentrevs(log, rev)] |
763 if parents[1] == nullrev: |
|
764 if parents[0] >= rev - 1: |
|
765 parents = [] |
|
766 else: |
|
767 parents = [parents[0]] |
|
768 parents = [(p, hexfunc(log.node(p))) for p in parents] |
|
769 |
763 |
770 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode))) |
764 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode))) |
771 |
765 |
772 # don't show the default branch name |
766 # don't show the default branch name |
773 if branch != 'default': |
767 if branch != 'default': |
820 if self.patch: |
814 if self.patch: |
821 prev = self.repo.changelog.parents(node)[0] |
815 prev = self.repo.changelog.parents(node)[0] |
822 patch.diff(self.repo, prev, node, match=self.patch, fp=self.ui, |
816 patch.diff(self.repo, prev, node, match=self.patch, fp=self.ui, |
823 opts=patch.diffopts(self.ui)) |
817 opts=patch.diffopts(self.ui)) |
824 self.ui.write("\n") |
818 self.ui.write("\n") |
|
819 |
|
820 def _meaningful_parentrevs(self, log, rev): |
|
821 """Return list of meaningful (or all if debug) parentrevs for rev. |
|
822 |
|
823 For merges (two non-nullrev revisions) both parents are meaningful. |
|
824 Otherwise the first parent revision is considered meaningful if it |
|
825 is not the preceding revision. |
|
826 """ |
|
827 parents = log.parentrevs(rev) |
|
828 if not self.ui.debugflag and parents[1] == nullrev: |
|
829 if parents[0] >= rev - 1: |
|
830 parents = [] |
|
831 else: |
|
832 parents = [parents[0]] |
|
833 return parents |
|
834 |
825 |
835 |
826 class changeset_templater(changeset_printer): |
836 class changeset_templater(changeset_printer): |
827 '''format changeset information.''' |
837 '''format changeset information.''' |
828 |
838 |
829 def __init__(self, ui, repo, patch, mapfile, buffered): |
839 def __init__(self, ui, repo, patch, mapfile, buffered): |
917 if branch != 'default': |
927 if branch != 'default': |
918 branch = util.tolocal(branch) |
928 branch = util.tolocal(branch) |
919 return showlist('branch', [branch], plural='branches', **args) |
929 return showlist('branch', [branch], plural='branches', **args) |
920 |
930 |
921 def showparents(**args): |
931 def showparents(**args): |
922 parents = [[('rev', log.rev(p)), ('node', hex(p))] |
932 parents = [[('rev', p), ('node', hex(log.node(p)))] |
923 for p in log.parents(changenode) |
933 for p in self._meaningful_parentrevs(log, rev)] |
924 if self.ui.debugflag or p != nullid] |
|
925 if (not self.ui.debugflag and len(parents) == 1 and |
|
926 parents[0][0][1] == rev - 1): |
|
927 return |
|
928 return showlist('parent', parents, **args) |
934 return showlist('parent', parents, **args) |
929 |
935 |
930 def showtags(**args): |
936 def showtags(**args): |
931 return showlist('tag', self.repo.nodetags(changenode), **args) |
937 return showlist('tag', self.repo.nodetags(changenode), **args) |
932 |
938 |