Ejemplo n.º 1
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.  :(")
Ejemplo n.º 2
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.  :(")
Ejemplo n.º 3
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.  :(")
Ejemplo n.º 4
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.  :(")
Ejemplo n.º 5
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.")
Ejemplo n.º 6
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.')
Ejemplo 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,
                                       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.")