Skip to content

Instantly share code, notes, and snippets.

/diff

Created December 3, 2014 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/888fc4688c4827ff2b98 to your computer and use it in GitHub Desktop.
Save anonymous/888fc4688c4827ff2b98 to your computer and use it in GitHub Desktop.
generated by webkit-patch command
Subversion Revision: 176716
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 887ab504e78dc426f37fac9ec38a78c5a604bb9b..1af40329aea178c95c5165cc7689a75a1159e37e 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,18 @@
+2014-12-03 Gergo Balogh <geryxyz@inf.u-szeged.hu>
+
+ Add support to upload to gist in webkit-patch.
+ https://bugs.webkit.org/show_bug.cgi?id=107941
+
+ Reviewed by NOBODY (OOPS!).
+
+ * Scripts/webkitpy/tool/commands/__init__.py:
+ * Scripts/webkitpy/tool/commands/gist.py: Added.
+ (Gist):
+ * Scripts/webkitpy/tool/steps/__init__.py:
+ * Scripts/webkitpy/tool/steps/uploadanonymousgist.py: Added.
+ (UploadAnonymousGist):
+ (UploadAnonymousGist.run):
+
2014-12-03 Zsolt Borbely <zsborbely.u-szeged@partner.samsung.com>
Remove unused JSC runtime options
diff --git a/Tools/Scripts/webkitpy/tool/commands/__init__.py b/Tools/Scripts/webkitpy/tool/commands/__init__.py
index 97c6b278f95f58215034da2e4ecc679994bea84b..94476bace10a2bd540a866ed659f6ff6eeed840c 100644
--- a/Tools/Scripts/webkitpy/tool/commands/__init__.py
+++ b/Tools/Scripts/webkitpy/tool/commands/__init__.py
@@ -21,5 +21,6 @@ from webkitpy.tool.commands.setupgitclone import SetupGitClone
from webkitpy.tool.commands.sheriffbot import *
from webkitpy.tool.commands.upload import *
from webkitpy.tool.commands.suggestnominations import *
+from webkitpy.tool.commands.gist import Gist
AbstractEarlyWarningSystem.load_ews_classes()
diff --git a/Tools/Scripts/webkitpy/tool/commands/gist.py b/Tools/Scripts/webkitpy/tool/commands/gist.py
new file mode 100644
index 0000000000000000000000000000000000000000..b243f496e84c98cdaff26297a81203a62ba79c6d
--- /dev/null
+++ b/Tools/Scripts/webkitpy/tool/commands/gist.py
@@ -0,0 +1,42 @@
+# Copyright (c) 2013 University of Szeged.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+
+from webkitpy.tool import steps
+
+from webkitpy.tool.commands.abstractsequencedcommand import AbstractSequencedCommand
+from webkitpy.tool.commands.stepsequence import StepSequence
+
+_log = logging.getLogger(__name__)
+
+
+class Gist(AbstractSequencedCommand):
+ name = "gist"
+ help_text = "Upload the diff into gist as anonymous"
+ steps = [
+ steps.ValidateChangeLogs,
+ steps.CheckStyle,
+ steps.ConfirmDiff,
+ steps.UploadAnonymousGist]
diff --git a/Tools/Scripts/webkitpy/tool/steps/__init__.py b/Tools/Scripts/webkitpy/tool/steps/__init__.py
index 655f7d50a5c4a7eeb2980a39e790c8b6d6ad2e30..018ef62943b82bd5f0901ebc240077440bc582e3 100644
--- a/Tools/Scripts/webkitpy/tool/steps/__init__.py
+++ b/Tools/Scripts/webkitpy/tool/steps/__init__.py
@@ -62,3 +62,4 @@ from webkitpy.tool.steps.update import Update
from webkitpy.tool.steps.updatechangelogswithreviewer import UpdateChangeLogsWithReviewer
from webkitpy.tool.steps.validatechangelogs import ValidateChangeLogs
from webkitpy.tool.steps.validatereviewer import ValidateReviewer
+from webkitpy.tool.steps.uploadanonymousgist import UploadAnonymousGist
diff --git a/Tools/Scripts/webkitpy/tool/steps/uploadanonymousgist.py b/Tools/Scripts/webkitpy/tool/steps/uploadanonymousgist.py
new file mode 100644
index 0000000000000000000000000000000000000000..3212979e227c6eeb57083ef03f514e939a18a6d2
--- /dev/null
+++ b/Tools/Scripts/webkitpy/tool/steps/uploadanonymousgist.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2013 University of Szeged.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+import json
+import urllib2
+
+from webkitpy.tool.steps.abstractstep import AbstractStep
+from webkitpy.tool.steps.options import Options
+
+_log = logging.getLogger(__name__)
+
+
+class UploadAnonymousGist(AbstractStep):
+ def run(self, state):
+ diff = self.cached_lookup(state, "diff")
+ gist_data = json.dumps({
+ 'description': 'generated by webkit-patch command',
+ 'public': True,
+ 'files': {
+ 'diff': {
+ 'content': diff}}})
+
+ url = 'https://api.github.com/gists'
+ try:
+ request = urllib2.Request(url, gist_data)
+ response = urllib2.urlopen(request)
+ except:
+ print('Fail to send gist to the GitHub server.')
+ self._exit(1)
+ if response.getcode() == 201:
+ print('New gist uploaded.')
+ new_gist = json.loads(response.read())
+ print(new_gist['html_url'])
+ else:
+ try:
+ new_gist = json.loads(response.read())
+ print(json.dumps(new_gist, sort_keys=True, indent=4, separators=(',', ': ')))
+ except:
+ print('Error, response code: %s' % response.getcode())
+ self._exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment