Beispiel #1
0
 def test_delta_show_long_status_single_file_filter(self):
     d, long_status, short_status = self._get_delta()
     out = StringIO()
     def only_f2(path, file_id):
         return path == 'f2'
     _mod_delta.report_delta(out, d, short_status=False, filter=only_f2)
     self.assertEqual("added:\n  f2\n", out.getvalue())
Beispiel #2
0
 def test_delta_show_short_status_single_file_id_filter(self):
     d, long_status, short_status = self._get_delta()
     out = StringIO()
     def only_f2_id(path, file_id):
         return file_id == 'f2-id'
     _mod_delta.report_delta(out, d, short_status=True, filter=only_f2_id)
     self.assertEqual("A  f2\n", out.getvalue())
Beispiel #3
0
 def test_delta_show_short_status_single_file_id_filter(self):
     d, long_status, short_status = self._get_delta()
     out = StringIO()
     def only_f2_id(path, file_id):
         return file_id == 'f2-id'
     _mod_delta.report_delta(out, d, short_status=True, filter=only_f2_id)
     self.assertEquals("A  f2\n", out.getvalue())
Beispiel #4
0
 def test_delta_show_no_filter(self):
     d, long_status, short_status = self._get_delta()
     out = StringIO()
     def not_a_filter(path, file_id):
         return True
     _mod_delta.report_delta(out, d, short_status=True, filter=not_a_filter)
     self.assertEqual(short_status, out.getvalue())
Beispiel #5
0
 def test_delta_show_long_status_single_file_filter(self):
     d, long_status, short_status = self._get_delta()
     out = StringIO()
     def only_f2(path, file_id):
         return path == 'f2'
     _mod_delta.report_delta(out, d, short_status=False, filter=only_f2)
     self.assertEquals("added:\n  f2\n", out.getvalue())
Beispiel #6
0
 def test_delta_show_no_filter(self):
     d, long_status, short_status = self._get_delta()
     out = StringIO()
     def not_a_filter(path, file_id):
         return True
     _mod_delta.report_delta(out, d, short_status=True, filter=not_a_filter)
     self.assertEquals(short_status, out.getvalue())
Beispiel #7
0
 def test_delta_show_long_status_no_filter(self):
     d, long_status, short_status = self._get_delta()
     out = StringIO()
     _mod_delta.report_delta(out, d, short_status=False)
     self.assertEqual(long_status, out.getvalue())
Beispiel #8
0
 def show_string(self, delta, *args,  **kwargs):
     to_file = StringIO()
     _mod_delta.report_delta(to_file, delta, *args, **kwargs)
     return to_file.getvalue()
Beispiel #9
0
    def log_revision(self, revision):
        # We need two indents: one per depth and one for the information
        # relative to that indent. Most mainline revnos are 5 chars or
        # less while dotted revnos are typically 11 chars or less. Once
        # calculated, we need to remember the offset for a given depth
        # as we might be starting from a dotted revno in the first column
        # and we want subsequent mainline revisions to line up.
        depth = revision.merge_depth
        indent = "    " * depth
        global logvar
        revno_width = self.revno_width_by_depth.get(depth)
        if revno_width is None:
            if revision.revno is None or revision.revno.find(".") == -1:
                # mainline revno, e.g. 12345
                revno_width = 5
            else:
                # dotted revno, e.g. 12345.10.55
                revno_width = 11
            self.revno_width_by_depth[depth] = revno_width
        offset = " " * (revno_width + 1)

        to_file = self.to_file
        tags = ""
        if revision.tags:
            tags = " {%s}" % (", ".join(revision.tags))
        logvar += '<div id="%s" class="revision">' % revision.revno
        logvar += '<div class="revdate">%s</div>' % format_date(
            revision.rev.timestamp,
            revision.rev.timezone or 0,
            self.show_timezone,
            date_fmt="%Y-%m-%d",
            show_offset=False,
        )

        logvar += '<div class="revbody">'
        logvar += '<p class="revinfo">%s committed revision <span class="hl">%s</span> %s</p>' % (
            self.short_author(revision.rev),
            revision.revno or "",
            self.merge_marker(revision),
        )
        if tags != "":
            logvar += '<p class="tags">%s</p>' % tags

        self.show_properties(revision.rev, indent + offset)
        if self.show_ids or revision.revno is None:
            logvar += '<p class="revmessage">revision-id:%s</p>' % revision.rev.revision_id
        if not revision.rev.message:
            logvar += '<p class="revmessage">(no message)</p>'
        else:
            message = revision.rev.message.rstrip("\r\n")
            for l in message.split("\n"):
                logvar += '<p class="revmessage">%s</p>' % web.net.websafe(l)

        if revision.delta is not None:
            # Use the standard status output to display changes
            from bzrlib.delta import report_delta

            report_delta(
                to_file,
                revision.delta,
                short_status=self.delta_format == 1,
                show_ids=self.show_ids,
                indent=indent + offset,
            )
        if revision.diff is not None:
            self.show_diff(self.to_exact_file, revision.diff, "      ")
        logvar += '</div><div class="clear"></div></div>'
Beispiel #10
0
 def test_delta_show_long_status_no_filter(self):
     d, long_status, short_status = self._get_delta()
     out = StringIO()
     _mod_delta.report_delta(out, d, short_status=False)
     self.assertEquals(long_status, out.getvalue())
Beispiel #11
0
 def show_string(self, delta, *args,  **kwargs):
     to_file = StringIO()
     _mod_delta.report_delta(to_file, delta, *args, **kwargs)
     return to_file.getvalue()