177 if self.filter is False: |
177 if self.filter is False: |
178 succs = self.repo.obsstore.successors.get(changenode, ()) |
178 succs = self.repo.obsstore.successors.get(changenode, ()) |
179 succs = sorted(succs) |
179 succs = sorted(succs) |
180 |
180 |
181 for successor in succs: |
181 for successor in succs: |
182 _debugobshistorydisplaymarker(markerfm, successor, |
182 _debugobshistorydisplaymarker(self.ui, markerfm, successor, |
183 ctx.node(), self.repo, |
183 ctx.node(), self.repo, |
184 self._includediff) |
184 self._includediff) |
185 |
185 |
186 else: |
186 else: |
187 r = _successorsandmarkers(self.repo, ctx) |
187 r = _successorsandmarkers(self.repo, ctx) |
189 for succset in sorted(r): |
189 for succset in sorted(r): |
190 markers = succset[b"markers"] |
190 markers = succset[b"markers"] |
191 if not markers: |
191 if not markers: |
192 continue |
192 continue |
193 successors = succset[b"successors"] |
193 successors = succset[b"successors"] |
194 _debugobshistorydisplaysuccsandmarkers(markerfm, successors, markers, ctx.node(), self.repo, self._includediff) |
194 _debugobshistorydisplaysuccsandmarkers(self.ui, markerfm, successors, markers, ctx.node(), self.repo, self._includediff) |
195 |
195 |
196 markerfm.end() |
196 markerfm.end() |
197 |
197 |
198 fm.plain(b'\n') |
198 fm.plain(b'\n') |
199 fm.end() |
199 fm.end() |
453 succs = successors.get(ctxnode, ()) |
453 succs = successors.get(ctxnode, ()) |
454 |
454 |
455 markerfm = fm.nested(b"markers") |
455 markerfm = fm.nested(b"markers") |
456 for successor in sorted(succs): |
456 for successor in sorted(succs): |
457 includediff = opts and opts.get("patch") |
457 includediff = opts and opts.get("patch") |
458 _debugobshistorydisplaymarker(markerfm, successor, ctxnode, unfi, includediff) |
458 _debugobshistorydisplaymarker(ui, markerfm, successor, ctxnode, unfi, includediff) |
459 markerfm.end() |
459 markerfm.end() |
460 |
460 |
461 precs = precursors.get(ctxnode, ()) |
461 precs = precursors.get(ctxnode, ()) |
462 for p in sorted(precs): |
462 for p in sorted(precs): |
463 # Only show nodes once |
463 # Only show nodes once |
495 fm.startitem() |
495 fm.startitem() |
496 fm.write(b'node', b'%s', hexnode, |
496 fm.write(b'node', b'%s', hexnode, |
497 label=b"evolve.node evolve.missing_change_ctx") |
497 label=b"evolve.node evolve.missing_change_ctx") |
498 fm.plain(b'\n') |
498 fm.plain(b'\n') |
499 |
499 |
500 def _debugobshistorydisplaymarker(fm, marker, node, repo, includediff=False): |
500 def _debugobshistorydisplaymarker(ui, fm, marker, node, repo, includediff=False): |
501 succnodes = marker[1] |
501 succnodes = marker[1] |
502 date = marker[4] |
502 date = marker[4] |
503 metadata = dict(marker[3]) |
503 metadata = dict(marker[3]) |
504 |
504 |
505 fm.startitem() |
505 fm.startitem() |
591 descriptionpatch = diffheader + descriptionpatch |
591 descriptionpatch = diffheader + descriptionpatch |
592 |
592 |
593 def tolist(text): |
593 def tolist(text): |
594 return [text] |
594 return [text] |
595 |
595 |
596 fm.plain(b"\n") |
596 ui.pushbuffer(labeled=True) |
|
597 ui.write(b"\n") |
597 |
598 |
598 for chunk, label in patch.difflabel(tolist, descriptionpatch): |
599 for chunk, label in patch.difflabel(tolist, descriptionpatch): |
599 chunk = chunk.strip(b'\t') |
600 chunk = chunk.strip(b'\t') |
600 if chunk and chunk != b'\n': |
601 if chunk and chunk != b'\n': |
601 fm.plain(b' ') |
602 ui.write(b' ') |
602 fm.write(b'descdiff', b'%s', chunk, label=label) |
603 ui.write(chunk, label=label) |
|
604 fm.write(b'descdiff', b'%s', ui.popbuffer()) |
603 |
605 |
604 # Content patch |
606 # Content patch |
|
607 ui.pushbuffer(labeled=True) |
605 diffopts = patch.diffallopts(repo.ui, {}) |
608 diffopts = patch.diffallopts(repo.ui, {}) |
606 matchfn = scmutil.matchall(repo) |
609 matchfn = scmutil.matchall(repo) |
607 firstline = True |
610 firstline = True |
608 linestart = True |
611 linestart = True |
609 for chunk, label in patch.diffui(repo, node, succ, matchfn, |
612 for chunk, label in patch.diffui(repo, node, succ, matchfn, |
610 opts=diffopts): |
613 opts=diffopts): |
611 if firstline: |
614 if firstline: |
612 fm.plain(b'\n') |
615 ui.write(b'\n') |
613 firstline = False |
616 firstline = False |
614 if linestart: |
617 if linestart: |
615 fm.plain(b' ') |
618 ui.write(b' ') |
616 linestart = False |
619 linestart = False |
617 if chunk == b'\n': |
620 if chunk == b'\n': |
618 linestart = True |
621 linestart = True |
619 fm.write(b'patch', b'%s', chunk, label=label) |
622 ui.write(chunk, label=label) |
|
623 fm.write(b'patch', b'%s', ui.popbuffer()) |
620 else: |
624 else: |
621 nopatch = b" (No patch available, %s)" % _patchavailable[1] |
625 nopatch = b" (No patch available, %s)" % _patchavailable[1] |
622 fm.plain(b"\n") |
626 fm.plain(b"\n") |
623 # TODO: should be in json too |
627 # TODO: should be in json too |
624 fm.plain(nopatch) |
628 fm.plain(nopatch) |
625 |
629 |
626 fm.plain(b"\n") |
630 fm.plain(b"\n") |
627 |
631 |
628 def _debugobshistorydisplaysuccsandmarkers(fm, succnodes, markers, node, repo, includediff=False): |
632 def _debugobshistorydisplaysuccsandmarkers(ui, fm, succnodes, markers, node, repo, includediff=False): |
629 """ |
633 """ |
630 This function is a duplication of _debugobshistorydisplaymarker modified |
634 This function is a duplication of _debugobshistorydisplaymarker modified |
631 to accept multiple markers as input. |
635 to accept multiple markers as input. |
632 """ |
636 """ |
633 fm.startitem() |
637 fm.startitem() |
731 descriptionpatch = diffheader + descriptionpatch |
735 descriptionpatch = diffheader + descriptionpatch |
732 |
736 |
733 def tolist(text): |
737 def tolist(text): |
734 return [text] |
738 return [text] |
735 |
739 |
736 fm.plain(b"\n") |
740 ui.pushbuffer(labeled=True) |
|
741 ui.write(b"\n") |
737 |
742 |
738 for chunk, label in patch.difflabel(tolist, descriptionpatch): |
743 for chunk, label in patch.difflabel(tolist, descriptionpatch): |
739 chunk = chunk.strip(b'\t') |
744 chunk = chunk.strip(b'\t') |
740 if chunk and chunk != b'\n': |
745 if chunk and chunk != b'\n': |
741 fm.plain(b' ') |
746 ui.write(b' ') |
742 fm.write(b'descdiff', b'%s', chunk, label=label) |
747 ui.write(chunk, label=label) |
|
748 fm.write(b'descdiff', b'%s', ui.popbuffer()) |
743 |
749 |
744 # Content patch |
750 # Content patch |
|
751 ui.pushbuffer(labeled=True) |
745 diffopts = patch.diffallopts(repo.ui, {}) |
752 diffopts = patch.diffallopts(repo.ui, {}) |
746 matchfn = scmutil.matchall(repo) |
753 matchfn = scmutil.matchall(repo) |
747 firstline = True |
754 firstline = True |
748 linestart = True |
755 linestart = True |
749 for chunk, label in patch.diffui(repo, node, succ, matchfn, |
756 for chunk, label in patch.diffui(repo, node, succ, matchfn, |
750 opts=diffopts): |
757 opts=diffopts): |
751 if firstline: |
758 if firstline: |
752 fm.plain(b'\n') |
759 ui.write(b'\n') |
753 firstline = False |
760 firstline = False |
754 if linestart: |
761 if linestart: |
755 fm.plain(b' ') |
762 ui.write(b' ') |
756 linestart = False |
763 linestart = False |
757 if chunk == b'\n': |
764 if chunk == b'\n': |
758 linestart = True |
765 linestart = True |
759 fm.write(b'patch', b'%s', chunk, label=label) |
766 ui.write(chunk, label=label) |
|
767 fm.write(b'patch', b'%s', ui.popbuffer()) |
760 else: |
768 else: |
761 nopatch = b" (No patch available, %s)" % _patchavailable[1] |
769 nopatch = b" (No patch available, %s)" % _patchavailable[1] |
762 fm.plain(b"\n") |
770 fm.plain(b"\n") |
763 # TODO: should be in json too |
771 # TODO: should be in json too |
764 fm.plain(nopatch) |
772 fm.plain(nopatch) |