| Index: testing_support/patches_data.py
|
| diff --git a/testing_support/patches_data.py b/testing_support/patches_data.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1acd83265f2aaf64a82570ce7e8593685cbe667b
|
| --- /dev/null
|
| +++ b/testing_support/patches_data.py
|
| @@ -0,0 +1,351 @@
|
| +# coding: utf-8
|
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +"""Samples patches to test patch.py."""
|
| +
|
| +
|
| +class RAW(object):
|
| + PATCH = (
|
| + 'Index: chrome/file.cc\n'
|
| + '===================================================================\n'
|
| + '--- chrome/file.cc\t(revision 74690)\n'
|
| + '+++ chrome/file.cc\t(working copy)\n'
|
| + '@@ -3,6 +3,7 @@ bb\n'
|
| + ' ccc\n'
|
| + ' dd\n'
|
| + ' e\n'
|
| + '+FOO!\n'
|
| + ' ff\n'
|
| + ' ggg\n'
|
| + ' hh\n')
|
| +
|
| + NEW = (
|
| + '--- /dev/null\n'
|
| + '+++ foo\n'
|
| + '@@ -0,0 +1 @@\n'
|
| + '+bar\n')
|
| +
|
| + NEW_NOT_NULL = (
|
| + '--- file_a\n'
|
| + '+++ file_a\n'
|
| + '@@ -0,0 +1 @@\n'
|
| + '+foo\n')
|
| +
|
| + MINIMAL_NEW = (
|
| + '--- /dev/null\t2\n'
|
| + '+++ chrome/file.cc\tfoo\n')
|
| +
|
| + MINIMAL = (
|
| + '--- file_a\n'
|
| + '+++ file_a\n')
|
| +
|
| + MINIMAL_RENAME = (
|
| + '--- file_a\n'
|
| + '+++ file_b\n')
|
| +
|
| + DELETE = (
|
| + '--- tools/clang_check/README.chromium\n'
|
| + '+++ /dev/null\n'
|
| + '@@ -1,1 +0,0 @@\n'
|
| + '-bar\n')
|
| +
|
| + MINIMAL_DELETE = (
|
| + '--- chrome/file.cc\tbar\n'
|
| + '+++ /dev/null\tfoo\n')
|
| +
|
| + DELETE2 = (
|
| + 'Index: browser/extensions/extension_sidebar_api.cc\n'
|
| + '===================================================================\n'
|
| + '--- browser/extensions/extension_sidebar_api.cc\t(revision 116830)\n'
|
| + '+++ browser/extensions/extension_sidebar_api.cc\t(working copy)\n'
|
| + '@@ -1,19 +0,0 @@\n'
|
| + '-// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n'
|
| + '-// Use of this source code is governed by a BSD-style license that\n'
|
| + '-// found in the LICENSE file.\n'
|
| + '-\n'
|
| + '-#include "base/command_line.h"\n'
|
| + '-#include "chrome/browser/extensions/extension_apitest.h"\n'
|
| + '-#include "chrome/common/chrome_switches.h"\n'
|
| + '-\n'
|
| + '-class SidebarApiTest : public ExtensionApiTest {\n'
|
| + '- public:\n'
|
| + '- void SetUpCommandLine(CommandLine* command_line) {\n'
|
| + '- ExtensionApiTest::SetUpCommandLine(command_line);\n'
|
| + '- command_line->AppendSwitch(switches::Bleh);\n'
|
| + '- }\n'
|
| + '-};\n'
|
| + '-\n'
|
| + '-IN_PROC_BROWSER_TEST_F(SidebarApiTest, Sidebar) {\n'
|
| + '- ASSERT_TRUE(RunExtensionTest("sidebar")) << message_;\n'
|
| + '-}\n')
|
| +
|
| + # http://codereview.chromium.org/api/7530007/5001
|
| + # http://codereview.chromium.org/download/issue7530007_5001_4011.diff
|
| + CRAP_ONLY = (
|
| + 'Index: scripts/master/factory/skia/__init__.py\n'
|
| + '===================================================================\n')
|
| +
|
| + TWO_HUNKS = (
|
| + 'Index: chrome/app/generated_resources.grd\n'
|
| + '===================================================================\n'
|
| + '--- chrome/app/generated_resources.grd\t(revision 116830)\n'
|
| + '+++ chrome/app/generated_resources.grd\t(working copy)\n'
|
| + '@@ -4169,9 +4169,6 @@\n'
|
| + ' <message name="IDS_EXTENSION_LOAD_OPTIONS_PAGE_FAILED" desc="">\n'
|
| + ' Could not load options page \'<ph name="OPTIONS_PAGE">$1<ex....\n'
|
| + ' </message>\n'
|
| + '- <message name="IDS_EXTENSION_LOAD_SIDEBAR_PAGE_FAILED" desc="">\n'
|
| + '- Could not load sidebar page \'<ph name="SIDEBAR_PAGE">$1<e...\n'
|
| + '- </message>\n'
|
| + ' <if expr="is_win">\n'
|
| + ' <message name="IDS_EXTENSION_UNPACK_FAILED" desc="On wind...\n'
|
| + ' Can not unpack extension. To safely unpack an extensio...\n'
|
| + '@@ -5593,9 +5590,6 @@\n'
|
| + ' <message name="IDS_ACCNAME_WEB_CONTENTS" desc="The acces...\n'
|
| + ' Web Contents\n'
|
| + ' </message>\n'
|
| + '- <message name="IDS_ACCNAME_SIDE_BAR" desc="The acces...\n'
|
| + '- Sidebar\n'
|
| + '- </message>\n'
|
| + ' \n'
|
| + ' <!-- Browser Hung Plugin Detector -->\n'
|
| + ' <message name="IDS_UNKNOWN_PLUGIN_NAME" ...\n')
|
| +
|
| + # http://codereview.chromium.org/download/issue9091003_9005_8009.diff
|
| + DIFFERENT = (
|
| + 'Index: master/unittests/data/processes-summary.dat\n'
|
| + '===================================================================\n'
|
| + '--- master/unittests/data/processes-summary.dat\t(revision 116240)\n'
|
| + '+++ master/unittests/data/processes-summary.dat\t(working copy)\n'
|
| + '@@ -1 +1 @@\n'
|
| + '-{"traces": {"1t_proc": ["2.0", "0.0"], "1t_proc_ref": ["1.0", ...\n'
|
| + '+{"traces": {"1t_proc": ["2.0", "0.0"], "1t_proc_ref": ["1.0", ...\n')
|
| +
|
| + RENAME_UTF8 = (
|
| + u'--- file_à\n'
|
| + u'+++ filé_b\n'
|
| + u'@@ -3,6 +3,7 @@ bb\n'
|
| + u' ccc\n'
|
| + u' ddé\n'
|
| + u' e\n'
|
| + u'+FÔÒ!\n'
|
| + u' ff\n'
|
| + u' ggg\n'
|
| + u' hh\n').encode('utf-8')
|
| +
|
| +
|
| +class GIT(object):
|
| + """Sample patches generated by git diff."""
|
| + PATCH = (
|
| + 'diff --git a/chrome/file.cc b/chrome/file.cc\n'
|
| + 'index 0e4de76..8320059 100644\n'
|
| + '--- a/chrome/file.cc\n'
|
| + '+++ b/chrome/file.cc\n'
|
| + '@@ -3,6 +3,7 @@ bb\n'
|
| + ' ccc\n'
|
| + ' dd\n'
|
| + ' e\n'
|
| + '+FOO!\n'
|
| + ' ff\n'
|
| + ' ggg\n'
|
| + ' hh\n')
|
| +
|
| + # http://codereview.chromium.org/download/issue10868039_12001_10003.diff
|
| + PATCH_SHORT_HUNK_HEADER = (
|
| + 'Index: chrome/browser/api/OWNERS\n'
|
| + 'diff --git a/chrome/browser/api/OWNERS b/chrome/browser/api/OWNERS\n'
|
| + '--- a/chrome/browser/api/OWNERS\n'
|
| + '+++ b/chrome/browser/api/OWNERS\n'
|
| + '@@ -1 +1,2 @@\n'
|
| + '+erikwright@chromium.org\n'
|
| + ' joi@chromium.org\n')
|
| +
|
| + # http://codereview.chromium.org/download/issue6368055_22_29.diff
|
| + DELETE = (
|
| + 'Index: tools/clang_check/README.chromium\n'
|
| + 'diff --git a/tools/clang_check/README.chromium '
|
| + 'b/tools/clang_check/README.chromium\n'
|
| + 'deleted file mode 100644\n'
|
| + 'index fcaa7e0e94bb604a026c4f478fecb1c5796f5413..'
|
| + '0000000000000000000000000000000000000000\n'
|
| + '--- a/tools/clang_check/README.chromium\n'
|
| + '+++ /dev/null\n'
|
| + '@@ -1,9 +0,0 @@\n'
|
| + '-These are terrible, terrible hacks.\n'
|
| + '-\n'
|
| + '-They are meant \n'
|
| + '-AND doing the normal \n'
|
| + '-run during normal \n'
|
| + '-build system to do a syntax check.\n'
|
| + '-\n'
|
| + '-Also see\n'
|
| + '\n')
|
| +
|
| + # http://codereview.chromium.org/download/issue8508015_6001_7001.diff
|
| + DELETE_EMPTY = (
|
| + 'Index: tests/__init__.py\n'
|
| + 'diff --git a/tests/__init__.py b/tests/__init__.py\n'
|
| + 'deleted file mode 100644\n'
|
| + 'index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..'
|
| + '0000000000000000000000000000000000000000\n')
|
| +
|
| + # http://codereview.chromium.org/download/issue6250123_3013_6010.diff
|
| + RENAME_PARTIAL = (
|
| + 'Index: chromeos/views/webui_menu_widget.h\n'
|
| + 'diff --git a/chromeos/views/DOMui_menu_widget.h '
|
| + 'b/chromeos/views/webui_menu_widget.h\n'
|
| + 'similarity index 79%\n'
|
| + 'rename from chromeos/views/DOMui_menu_widget.h\n'
|
| + 'rename to chromeos/views/webui_menu_widget.h\n'
|
| + 'index 095d4c474fd9718f5aebfa41a1ccb2d951356d41..'
|
| + '157925075434b590e8acaaf605a64f24978ba08b 100644\n'
|
| + '--- a/chromeos/views/DOMui_menu_widget.h\n'
|
| + '+++ b/chromeos/views/webui_menu_widget.h\n'
|
| + '@@ -1,9 +1,9 @@\n'
|
| + '-// Copyright (c) 2010\n'
|
| + '+// Copyright (c) 2011\n'
|
| + ' // Use of this source code\n'
|
| + ' // found in the LICENSE file.\n'
|
| + ' \n'
|
| + '-#ifndef DOM\n'
|
| + '-#define DOM\n'
|
| + '+#ifndef WEB\n'
|
| + '+#define WEB\n'
|
| + ' #pragma once\n'
|
| + ' \n'
|
| + ' #include <string>\n')
|
| +
|
| + # http://codereview.chromium.org/download/issue6287022_3001_4010.diff
|
| + RENAME = (
|
| + 'Index: tools/run_local_server.sh\n'
|
| + 'diff --git a/tools/run_local_server.PY b/tools/run_local_server.sh\n'
|
| + 'similarity index 100%\n'
|
| + 'rename from tools/run_local_server.PY\n'
|
| + 'rename to tools/run_local_server.sh\n')
|
| +
|
| + COPY = (
|
| + 'diff --git a/PRESUBMIT.py b/pp\n'
|
| + 'similarity index 100%\n'
|
| + 'copy from PRESUBMIT.py\n'
|
| + 'copy to pp\n')
|
| +
|
| + COPY_PARTIAL = (
|
| + 'diff --git a/wtf b/wtf2\n'
|
| + 'similarity index 98%\n'
|
| + 'copy from wtf\n'
|
| + 'copy to wtf2\n'
|
| + 'index 79fbaf3..3560689 100755\n'
|
| + '--- a/wtf\n'
|
| + '+++ b/wtf2\n'
|
| + '@@ -1,4 +1,4 @@\n'
|
| + '-#!/usr/bin/env python\n'
|
| + '+#!/usr/bin/env python1.3\n'
|
| + ' # Copyright (c) 2010 The Chromium Authors. All rights reserved.\n'
|
| + ' # blah blah blah as\n'
|
| + ' # found in the LICENSE file.\n')
|
| +
|
| + NEW = (
|
| + 'diff --git a/foo b/foo\n'
|
| + 'new file mode 100644\n'
|
| + 'index 0000000..5716ca5\n'
|
| + '--- /dev/null\n'
|
| + '+++ b/foo\n'
|
| + '@@ -0,0 +1 @@\n'
|
| + '+bar\n')
|
| +
|
| + NEW_EXE = (
|
| + 'diff --git a/natsort_test.py b/natsort_test.py\n'
|
| + 'new file mode 100755\n'
|
| + '--- /dev/null\n'
|
| + '+++ b/natsort_test.py\n'
|
| + '@@ -0,0 +1,1 @@\n'
|
| + '+#!/usr/bin/env python\n')
|
| +
|
| + # To make sure the subdirectory was created as needed.
|
| + NEW_SUBDIR = (
|
| + 'diff --git a/new_dir/subdir/new_file b/new_dir/subdir/new_file\n'
|
| + 'new file mode 100644\n'
|
| + '--- /dev/null\n'
|
| + '+++ b/new_dir/subdir/new_file\n'
|
| + '@@ -0,0 +1,2 @@\n'
|
| + '+A new file\n'
|
| + '+should exist.\n')
|
| +
|
| + NEW_MODE = (
|
| + 'diff --git a/natsort_test.py b/natsort_test.py\n'
|
| + 'new file mode 100644\n'
|
| + '--- /dev/null\n'
|
| + '+++ b/natsort_test.py\n'
|
| + '@@ -0,0 +1,1 @@\n'
|
| + '+#!/usr/bin/env python\n')
|
| +
|
| + MODE_EXE = (
|
| + 'diff --git a/git_cl/git-cl b/git_cl/git-cl\n'
|
| + 'old mode 100644\n'
|
| + 'new mode 100755\n')
|
| +
|
| + MODE_EXE_JUNK = (
|
| + 'Index: Junk\n'
|
| + 'diff --git a/git_cl/git-cl b/git_cl/git-cl\n'
|
| + 'old mode 100644\n'
|
| + 'new mode 100755\n')
|
| +
|
| + NEW_NOT_EXECUTABLE = (
|
| + 'diff --git a/build/android/ant/create.js b/build/android/ant/create.js\n'
|
| + 'new file mode 100644\n'
|
| + 'index 0000000000000000000..542a89e978feada38dd\n'
|
| + '--- /dev/null\n'
|
| + '+++ b/build/android/ant/create.js\n'
|
| + '@@ -0,0 +1,1 @@\n'
|
| + '+// Copyright (c) 2012 The Chromium Authors. All rights reserved.\n'
|
| + )
|
| +
|
| + FOUR_HUNKS = (
|
| + 'Index: presubmit_support.py\n'
|
| + 'diff --git a/presubmit_support.py b/presubmit_support.py\n'
|
| + 'index 52416d3f..d56512f2 100755\n'
|
| + '--- a/presubmit_support.py\n'
|
| + '+++ b/presubmit_support.py\n'
|
| + '@@ -558,6 +558,7 @@ class SvnAffectedFile(AffectedFile):\n'
|
| + ' AffectedFile.__init__(self, *args, **kwargs)\n'
|
| + ' self._server_path = None\n'
|
| + ' self._is_text_file = None\n'
|
| + '+ self._diff = None\n'
|
| + ' \n'
|
| + ' def ServerPath(self):\n'
|
| + ' if self._server_path is None:\n'
|
| + '@@ -598,8 +599,10 @@ class SvnAffectedFile(AffectedFile):\n'
|
| + ' return self._is_text_file\n'
|
| + ' \n'
|
| + ' def GenerateScmDiff(self):\n'
|
| + '- return scm.SVN.GenerateDiff(\n'
|
| + '- [self.LocalPath()], self._local_root, False, None)\n'
|
| + '+ if self._diff is None:\n'
|
| + '+ self._diff = scm.SVN.GenerateDiff(\n'
|
| + '+ [self.LocalPath()], self._local_root, False, None)\n'
|
| + '+ return self._diff\n'
|
| + ' \n'
|
| + ' \n'
|
| + ' class GitAffectedFile(AffectedFile):\n'
|
| + '@@ -611,6 +614,7 @@ class GitAffectedFile(AffectedFile):\n'
|
| + ' AffectedFile.__init__(self, *args, **kwargs)\n'
|
| + ' self._server_path = None\n'
|
| + ' self._is_text_file = None\n'
|
| + '+ self._diff = None\n'
|
| + ' \n'
|
| + ' def ServerPath(self):\n'
|
| + ' if self._server_path is None:\n'
|
| + '@@ -645,7 +649,10 @@ class GitAffectedFile(AffectedFile):\n'
|
| + ' return self._is_text_file\n'
|
| + ' \n'
|
| + ' def GenerateScmDiff(self):\n'
|
| + '- return scm.GIT.GenerateDiff(self._local_root, files=[self.Lo...\n'
|
| + '+ if self._diff is None:\n'
|
| + '+ self._diff = scm.GIT.GenerateDiff(\n'
|
| + '+ self._local_root, files=[self.LocalPath(),])\n'
|
| + '+ return self._diff\n'
|
| + ' \n'
|
| + ' \n'
|
| + ' class Change(object):\n')
|
|
|