def test_pretty_print_empty_string(self):
        if not self.check_ruby():
            return

        # Make sure that an empty diff does not hang the process.
        pretty_patch = PrettyPatch(Executive(), self._webkit_root())
        self.assertEqual(pretty_patch.pretty_diff(""), "")
    def test_pretty_diff_encodings(self):
        if not self.check_ruby():
            return

        pretty_patch = PrettyPatch(Executive(), self._webkit_root())
        pretty = pretty_patch.pretty_diff(self._diff_with_multiple_encodings)
        self.assertTrue(pretty)  # We got some output
        self.assertTrue(isinstance(pretty, str))  # It's a byte array, not unicode
Exemplo n.º 3
0
    def test_pretty_diff_encodings(self):
        if not self.check_ruby():
            return

        if sys.platform == 'win32':
            # FIXME: disabled due to https://bugs.webkit.org/show_bug.cgi?id=93192
            return

        pretty_patch = PrettyPatch(Executive(), self._webkit_root())
        pretty = pretty_patch.pretty_diff(self._diff_with_multiple_encodings)
        self.assertTrue(pretty)  # We got some output
        self.assertIsInstance(pretty, str)  # It's a byte array, not unicode
Exemplo n.º 4
0
 def _show_pretty_diff(self, diff):
     try:
         pretty_patch = PrettyPatch(self._tool.executive,
                                    self._tool.scm().checkout_root)
         pretty_diff_file = pretty_patch.pretty_diff_file(diff)
         url = "file://%s" % urllib.quote(pretty_diff_file.name)
         self._tool.user.open_url(url)
         # We return the pretty_diff_file here because we need to keep the
         # file alive until the user has had a chance to confirm the diff.
         return pretty_diff_file
     except ScriptError, e:
         _log.warning("PrettyPatch failed.  :(")
Exemplo n.º 5
0
    def test_pretty_diff_encodings(self):
        if not self.check_ruby():
            return

        if sys.platform == 'win32':
            # FIXME: disabled due to https://bugs.webkit.org/show_bug.cgi?id=93192
            return

        pretty_patch = PrettyPatch(Executive(), self._webkit_root())
        pretty = pretty_patch.pretty_diff(self._diff_with_multiple_encodings)
        self.assertTrue(pretty)  # We got some output
        self.assertTrue(isinstance(pretty,
                                   str))  # It's a byte array, not unicode
Exemplo n.º 6
0
    def _show_pretty_diff(self):
        if not self._tool.user.can_open_url():
            return None

        try:
            pretty_patch = PrettyPatch(self._tool.executive)
            pretty_diff_file = pretty_patch.pretty_diff_file(self.diff())
            url = "file://%s" % urllib.quote(pretty_diff_file.name)
            self._tool.user.open_url(url)
            # We return the pretty_diff_file here because we need to keep the
            # file alive until the user has had a chance to confirm the diff.
            return pretty_diff_file
        except ScriptError, e:
            _log.warning("PrettyPatch failed.  :(")
Exemplo n.º 7
0
    def _show_pretty_diff(self, diff):
        if not self._tool.user.can_open_url():
            return None

        try:
            pretty_patch = PrettyPatch(self._tool.executive)
            pretty_diff_file = pretty_patch.pretty_diff_file(diff)
            url = "file://%s" % urllib.quote(pretty_diff_file.name)
            self._tool.user.open_url(url)
            # We return the pretty_diff_file here because we need to keep the
            # file alive until the user has had a chance to confirm the diff.
            return pretty_diff_file
        except ScriptError, e:
            _log.warning("PrettyPatch failed.  :(")
Exemplo n.º 8
0
    def test_pretty_diff_encodings(self):
        if not self.check_ruby():
            self.skipTest("no/unsupported Ruby")
            return

        if sys.platform.startswith('win'):
            self.skipTest(
                "FIXME: disabled due to https://bugs.webkit.org/show_bug.cgi?id=93192"
            )
            return

        pretty_patch = PrettyPatch(Executive(), self._webkit_root())
        pretty = pretty_patch.pretty_diff(self._diff_with_multiple_encodings)
        self.assertTrue(pretty)  # We got some output
        self.assertIsInstance(pretty, bytes)  # It's a byte array, not unicode
Exemplo n.º 9
0
 def _show_pretty_diff(self, options):
     if not self._tool.user.can_open_url():
         return None
     try:
         pretty_patch = PrettyPatch(self._tool.executive)
         patch = self._diff(options)
         pretty_diff_file = pretty_patch.pretty_diff_file(patch)
         self._open_pretty_diff(pretty_diff_file.name)
         # We return the pretty_diff_file here because we need to keep the
         # file alive until the user has had a chance to confirm the diff.
         return pretty_diff_file
     except ScriptError as e:
         _log.warning("PrettyPatch failed.  :(")
         _log.error(e.message_with_output())
         self._exit(e.exit_code or 2)
     except OSError:
         _log.warning("PrettyPatch unavailable.")
Exemplo n.º 10
0
 def _show_pretty_diff(self, options):
     if not self._tool.user.can_open_url():
         return None
     try:
         pretty_patch = PrettyPatch(self._tool.executive)
         patch = self._diff(options)
         pretty_diff_file = pretty_patch.pretty_diff_file(patch)
         self._open_pretty_diff(pretty_diff_file.name)
         # We return the pretty_diff_file here because we need to keep the
         # file alive until the user has had a chance to confirm the diff.
         return pretty_diff_file
     except ScriptError as error:
         _log.warning('PrettyPatch failed.  :(')
         _log.error(error.message_with_output())
         self._exit(error.exit_code or 2)
     except OSError:
         _log.warning('PrettyPatch unavailable.')
Exemplo n.º 11
0
    def _show_pretty_diff(self, diff):
        if not self._tool.user.can_open_url():
            return None

        try:
            pretty_patch = PrettyPatch(self._tool.executive,
                                       self._tool.scm().checkout_root)
            pretty_diff_file = pretty_patch.pretty_diff_file(diff)
            url = "file://%s" % pathname2url(pretty_diff_file.name)
            self._tool.user.open_url(url)
            # We return the pretty_diff_file here because we need to keep the
            # file alive until the user has had a chance to confirm the diff.
            return pretty_diff_file
        except ScriptError:
            _log.warning("PrettyPatch failed.  :(")
        except OSError:
            _log.warning("PrettyPatch unavailable.")
Exemplo n.º 12
0
 def test_pretty_print_empty_string(self):
     # Make sure that an empty diff does not hang the process.
     pretty_patch = PrettyPatch(Executive(), self._webkit_root())
     self.assertEqual(pretty_patch.pretty_diff(""), "")
Exemplo n.º 13
0
 def test_pretty_diff_encodings(self):
     pretty_patch = PrettyPatch(Executive(), self._webkit_root())
     pretty = pretty_patch.pretty_diff(self._diff_with_multiple_encodings)
     self.assertTrue(pretty)  # We got some output
     self.assertTrue(isinstance(pretty, str))  # It's a byte array, not unicode