OLD | NEW |
(Empty) | |
| 1 # coding: utf-8 |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 """Samples patches to test patch.py.""" |
| 7 |
| 8 |
| 9 class RAW(object): |
| 10 PATCH = ( |
| 11 'Index: chrome/file.cc\n' |
| 12 '===================================================================\n' |
| 13 '--- chrome/file.cc\t(revision 74690)\n' |
| 14 '+++ chrome/file.cc\t(working copy)\n' |
| 15 '@@ -3,6 +3,7 @@ bb\n' |
| 16 ' ccc\n' |
| 17 ' dd\n' |
| 18 ' e\n' |
| 19 '+FOO!\n' |
| 20 ' ff\n' |
| 21 ' ggg\n' |
| 22 ' hh\n') |
| 23 |
| 24 NEW = ( |
| 25 '--- /dev/null\n' |
| 26 '+++ foo\n' |
| 27 '@@ -0,0 +1 @@\n' |
| 28 '+bar\n') |
| 29 |
| 30 NEW_NOT_NULL = ( |
| 31 '--- file_a\n' |
| 32 '+++ file_a\n' |
| 33 '@@ -0,0 +1 @@\n' |
| 34 '+foo\n') |
| 35 |
| 36 MINIMAL_NEW = ( |
| 37 '--- /dev/null\t2\n' |
| 38 '+++ chrome/file.cc\tfoo\n') |
| 39 |
| 40 MINIMAL = ( |
| 41 '--- file_a\n' |
| 42 '+++ file_a\n') |
| 43 |
| 44 MINIMAL_RENAME = ( |
| 45 '--- file_a\n' |
| 46 '+++ file_b\n') |
| 47 |
| 48 DELETE = ( |
| 49 '--- tools/clang_check/README.chromium\n' |
| 50 '+++ /dev/null\n' |
| 51 '@@ -1,1 +0,0 @@\n' |
| 52 '-bar\n') |
| 53 |
| 54 MINIMAL_DELETE = ( |
| 55 '--- chrome/file.cc\tbar\n' |
| 56 '+++ /dev/null\tfoo\n') |
| 57 |
| 58 DELETE2 = ( |
| 59 'Index: browser/extensions/extension_sidebar_api.cc\n' |
| 60 '===================================================================\n' |
| 61 '--- browser/extensions/extension_sidebar_api.cc\t(revision 116830)\n' |
| 62 '+++ browser/extensions/extension_sidebar_api.cc\t(working copy)\n' |
| 63 '@@ -1,19 +0,0 @@\n' |
| 64 '-// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n' |
| 65 '-// Use of this source code is governed by a BSD-style license that\n' |
| 66 '-// found in the LICENSE file.\n' |
| 67 '-\n' |
| 68 '-#include "base/command_line.h"\n' |
| 69 '-#include "chrome/browser/extensions/extension_apitest.h"\n' |
| 70 '-#include "chrome/common/chrome_switches.h"\n' |
| 71 '-\n' |
| 72 '-class SidebarApiTest : public ExtensionApiTest {\n' |
| 73 '- public:\n' |
| 74 '- void SetUpCommandLine(CommandLine* command_line) {\n' |
| 75 '- ExtensionApiTest::SetUpCommandLine(command_line);\n' |
| 76 '- command_line->AppendSwitch(switches::Bleh);\n' |
| 77 '- }\n' |
| 78 '-};\n' |
| 79 '-\n' |
| 80 '-IN_PROC_BROWSER_TEST_F(SidebarApiTest, Sidebar) {\n' |
| 81 '- ASSERT_TRUE(RunExtensionTest("sidebar")) << message_;\n' |
| 82 '-}\n') |
| 83 |
| 84 # http://codereview.chromium.org/api/7530007/5001 |
| 85 # http://codereview.chromium.org/download/issue7530007_5001_4011.diff |
| 86 CRAP_ONLY = ( |
| 87 'Index: scripts/master/factory/skia/__init__.py\n' |
| 88 '===================================================================\n') |
| 89 |
| 90 TWO_HUNKS = ( |
| 91 'Index: chrome/app/generated_resources.grd\n' |
| 92 '===================================================================\n' |
| 93 '--- chrome/app/generated_resources.grd\t(revision 116830)\n' |
| 94 '+++ chrome/app/generated_resources.grd\t(working copy)\n' |
| 95 '@@ -4169,9 +4169,6 @@\n' |
| 96 ' <message name="IDS_EXTENSION_LOAD_OPTIONS_PAGE_FAILED" desc="">\n' |
| 97 ' Could not load options page \'<ph name="OPTIONS_PAGE">$1<ex....\n' |
| 98 ' </message>\n' |
| 99 '- <message name="IDS_EXTENSION_LOAD_SIDEBAR_PAGE_FAILED" desc="">\n' |
| 100 '- Could not load sidebar page \'<ph name="SIDEBAR_PAGE">$1<e...\n' |
| 101 '- </message>\n' |
| 102 ' <if expr="is_win">\n' |
| 103 ' <message name="IDS_EXTENSION_UNPACK_FAILED" desc="On wind...\n' |
| 104 ' Can not unpack extension. To safely unpack an extensio...\n' |
| 105 '@@ -5593,9 +5590,6 @@\n' |
| 106 ' <message name="IDS_ACCNAME_WEB_CONTENTS" desc="The acces...\n' |
| 107 ' Web Contents\n' |
| 108 ' </message>\n' |
| 109 '- <message name="IDS_ACCNAME_SIDE_BAR" desc="The acces...\n' |
| 110 '- Sidebar\n' |
| 111 '- </message>\n' |
| 112 ' \n' |
| 113 ' <!-- Browser Hung Plugin Detector -->\n' |
| 114 ' <message name="IDS_UNKNOWN_PLUGIN_NAME" ...\n') |
| 115 |
| 116 # http://codereview.chromium.org/download/issue9091003_9005_8009.diff |
| 117 DIFFERENT = ( |
| 118 'Index: master/unittests/data/processes-summary.dat\n' |
| 119 '===================================================================\n' |
| 120 '--- master/unittests/data/processes-summary.dat\t(revision 116240)\n' |
| 121 '+++ master/unittests/data/processes-summary.dat\t(working copy)\n' |
| 122 '@@ -1 +1 @@\n' |
| 123 '-{"traces": {"1t_proc": ["2.0", "0.0"], "1t_proc_ref": ["1.0", ...\n' |
| 124 '+{"traces": {"1t_proc": ["2.0", "0.0"], "1t_proc_ref": ["1.0", ...\n') |
| 125 |
| 126 RENAME_UTF8 = ( |
| 127 u'--- file_à\n' |
| 128 u'+++ filé_b\n' |
| 129 u'@@ -3,6 +3,7 @@ bb\n' |
| 130 u' ccc\n' |
| 131 u' ddé\n' |
| 132 u' e\n' |
| 133 u'+FÔÒ!\n' |
| 134 u' ff\n' |
| 135 u' ggg\n' |
| 136 u' hh\n').encode('utf-8') |
| 137 |
| 138 |
| 139 class GIT(object): |
| 140 """Sample patches generated by git diff.""" |
| 141 PATCH = ( |
| 142 'diff --git a/chrome/file.cc b/chrome/file.cc\n' |
| 143 'index 0e4de76..8320059 100644\n' |
| 144 '--- a/chrome/file.cc\n' |
| 145 '+++ b/chrome/file.cc\n' |
| 146 '@@ -3,6 +3,7 @@ bb\n' |
| 147 ' ccc\n' |
| 148 ' dd\n' |
| 149 ' e\n' |
| 150 '+FOO!\n' |
| 151 ' ff\n' |
| 152 ' ggg\n' |
| 153 ' hh\n') |
| 154 |
| 155 # http://codereview.chromium.org/download/issue10868039_12001_10003.diff |
| 156 PATCH_SHORT_HUNK_HEADER = ( |
| 157 'Index: chrome/browser/api/OWNERS\n' |
| 158 'diff --git a/chrome/browser/api/OWNERS b/chrome/browser/api/OWNERS\n' |
| 159 '--- a/chrome/browser/api/OWNERS\n' |
| 160 '+++ b/chrome/browser/api/OWNERS\n' |
| 161 '@@ -1 +1,2 @@\n' |
| 162 '+erikwright@chromium.org\n' |
| 163 ' joi@chromium.org\n') |
| 164 |
| 165 # http://codereview.chromium.org/download/issue6368055_22_29.diff |
| 166 DELETE = ( |
| 167 'Index: tools/clang_check/README.chromium\n' |
| 168 'diff --git a/tools/clang_check/README.chromium ' |
| 169 'b/tools/clang_check/README.chromium\n' |
| 170 'deleted file mode 100644\n' |
| 171 'index fcaa7e0e94bb604a026c4f478fecb1c5796f5413..' |
| 172 '0000000000000000000000000000000000000000\n' |
| 173 '--- a/tools/clang_check/README.chromium\n' |
| 174 '+++ /dev/null\n' |
| 175 '@@ -1,9 +0,0 @@\n' |
| 176 '-These are terrible, terrible hacks.\n' |
| 177 '-\n' |
| 178 '-They are meant \n' |
| 179 '-AND doing the normal \n' |
| 180 '-run during normal \n' |
| 181 '-build system to do a syntax check.\n' |
| 182 '-\n' |
| 183 '-Also see\n' |
| 184 '\n') |
| 185 |
| 186 # http://codereview.chromium.org/download/issue8508015_6001_7001.diff |
| 187 DELETE_EMPTY = ( |
| 188 'Index: tests/__init__.py\n' |
| 189 'diff --git a/tests/__init__.py b/tests/__init__.py\n' |
| 190 'deleted file mode 100644\n' |
| 191 'index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..' |
| 192 '0000000000000000000000000000000000000000\n') |
| 193 |
| 194 # http://codereview.chromium.org/download/issue6250123_3013_6010.diff |
| 195 RENAME_PARTIAL = ( |
| 196 'Index: chromeos/views/webui_menu_widget.h\n' |
| 197 'diff --git a/chromeos/views/DOMui_menu_widget.h ' |
| 198 'b/chromeos/views/webui_menu_widget.h\n' |
| 199 'similarity index 79%\n' |
| 200 'rename from chromeos/views/DOMui_menu_widget.h\n' |
| 201 'rename to chromeos/views/webui_menu_widget.h\n' |
| 202 'index 095d4c474fd9718f5aebfa41a1ccb2d951356d41..' |
| 203 '157925075434b590e8acaaf605a64f24978ba08b 100644\n' |
| 204 '--- a/chromeos/views/DOMui_menu_widget.h\n' |
| 205 '+++ b/chromeos/views/webui_menu_widget.h\n' |
| 206 '@@ -1,9 +1,9 @@\n' |
| 207 '-// Copyright (c) 2010\n' |
| 208 '+// Copyright (c) 2011\n' |
| 209 ' // Use of this source code\n' |
| 210 ' // found in the LICENSE file.\n' |
| 211 ' \n' |
| 212 '-#ifndef DOM\n' |
| 213 '-#define DOM\n' |
| 214 '+#ifndef WEB\n' |
| 215 '+#define WEB\n' |
| 216 ' #pragma once\n' |
| 217 ' \n' |
| 218 ' #include <string>\n') |
| 219 |
| 220 # http://codereview.chromium.org/download/issue6287022_3001_4010.diff |
| 221 RENAME = ( |
| 222 'Index: tools/run_local_server.sh\n' |
| 223 'diff --git a/tools/run_local_server.PY b/tools/run_local_server.sh\n' |
| 224 'similarity index 100%\n' |
| 225 'rename from tools/run_local_server.PY\n' |
| 226 'rename to tools/run_local_server.sh\n') |
| 227 |
| 228 COPY = ( |
| 229 'diff --git a/PRESUBMIT.py b/pp\n' |
| 230 'similarity index 100%\n' |
| 231 'copy from PRESUBMIT.py\n' |
| 232 'copy to pp\n') |
| 233 |
| 234 COPY_PARTIAL = ( |
| 235 'diff --git a/wtf b/wtf2\n' |
| 236 'similarity index 98%\n' |
| 237 'copy from wtf\n' |
| 238 'copy to wtf2\n' |
| 239 'index 79fbaf3..3560689 100755\n' |
| 240 '--- a/wtf\n' |
| 241 '+++ b/wtf2\n' |
| 242 '@@ -1,4 +1,4 @@\n' |
| 243 '-#!/usr/bin/env python\n' |
| 244 '+#!/usr/bin/env python1.3\n' |
| 245 ' # Copyright (c) 2010 The Chromium Authors. All rights reserved.\n' |
| 246 ' # blah blah blah as\n' |
| 247 ' # found in the LICENSE file.\n') |
| 248 |
| 249 NEW = ( |
| 250 'diff --git a/foo b/foo\n' |
| 251 'new file mode 100644\n' |
| 252 'index 0000000..5716ca5\n' |
| 253 '--- /dev/null\n' |
| 254 '+++ b/foo\n' |
| 255 '@@ -0,0 +1 @@\n' |
| 256 '+bar\n') |
| 257 |
| 258 NEW_EXE = ( |
| 259 'diff --git a/natsort_test.py b/natsort_test.py\n' |
| 260 'new file mode 100755\n' |
| 261 '--- /dev/null\n' |
| 262 '+++ b/natsort_test.py\n' |
| 263 '@@ -0,0 +1,1 @@\n' |
| 264 '+#!/usr/bin/env python\n') |
| 265 |
| 266 # To make sure the subdirectory was created as needed. |
| 267 NEW_SUBDIR = ( |
| 268 'diff --git a/new_dir/subdir/new_file b/new_dir/subdir/new_file\n' |
| 269 'new file mode 100644\n' |
| 270 '--- /dev/null\n' |
| 271 '+++ b/new_dir/subdir/new_file\n' |
| 272 '@@ -0,0 +1,2 @@\n' |
| 273 '+A new file\n' |
| 274 '+should exist.\n') |
| 275 |
| 276 NEW_MODE = ( |
| 277 'diff --git a/natsort_test.py b/natsort_test.py\n' |
| 278 'new file mode 100644\n' |
| 279 '--- /dev/null\n' |
| 280 '+++ b/natsort_test.py\n' |
| 281 '@@ -0,0 +1,1 @@\n' |
| 282 '+#!/usr/bin/env python\n') |
| 283 |
| 284 MODE_EXE = ( |
| 285 'diff --git a/git_cl/git-cl b/git_cl/git-cl\n' |
| 286 'old mode 100644\n' |
| 287 'new mode 100755\n') |
| 288 |
| 289 MODE_EXE_JUNK = ( |
| 290 'Index: Junk\n' |
| 291 'diff --git a/git_cl/git-cl b/git_cl/git-cl\n' |
| 292 'old mode 100644\n' |
| 293 'new mode 100755\n') |
| 294 |
| 295 NEW_NOT_EXECUTABLE = ( |
| 296 'diff --git a/build/android/ant/create.js b/build/android/ant/create.js\n' |
| 297 'new file mode 100644\n' |
| 298 'index 0000000000000000000..542a89e978feada38dd\n' |
| 299 '--- /dev/null\n' |
| 300 '+++ b/build/android/ant/create.js\n' |
| 301 '@@ -0,0 +1,1 @@\n' |
| 302 '+// Copyright (c) 2012 The Chromium Authors. All rights reserved.\n' |
| 303 ) |
| 304 |
| 305 FOUR_HUNKS = ( |
| 306 'Index: presubmit_support.py\n' |
| 307 'diff --git a/presubmit_support.py b/presubmit_support.py\n' |
| 308 'index 52416d3f..d56512f2 100755\n' |
| 309 '--- a/presubmit_support.py\n' |
| 310 '+++ b/presubmit_support.py\n' |
| 311 '@@ -558,6 +558,7 @@ class SvnAffectedFile(AffectedFile):\n' |
| 312 ' AffectedFile.__init__(self, *args, **kwargs)\n' |
| 313 ' self._server_path = None\n' |
| 314 ' self._is_text_file = None\n' |
| 315 '+ self._diff = None\n' |
| 316 ' \n' |
| 317 ' def ServerPath(self):\n' |
| 318 ' if self._server_path is None:\n' |
| 319 '@@ -598,8 +599,10 @@ class SvnAffectedFile(AffectedFile):\n' |
| 320 ' return self._is_text_file\n' |
| 321 ' \n' |
| 322 ' def GenerateScmDiff(self):\n' |
| 323 '- return scm.SVN.GenerateDiff(\n' |
| 324 '- [self.LocalPath()], self._local_root, False, None)\n' |
| 325 '+ if self._diff is None:\n' |
| 326 '+ self._diff = scm.SVN.GenerateDiff(\n' |
| 327 '+ [self.LocalPath()], self._local_root, False, None)\n' |
| 328 '+ return self._diff\n' |
| 329 ' \n' |
| 330 ' \n' |
| 331 ' class GitAffectedFile(AffectedFile):\n' |
| 332 '@@ -611,6 +614,7 @@ class GitAffectedFile(AffectedFile):\n' |
| 333 ' AffectedFile.__init__(self, *args, **kwargs)\n' |
| 334 ' self._server_path = None\n' |
| 335 ' self._is_text_file = None\n' |
| 336 '+ self._diff = None\n' |
| 337 ' \n' |
| 338 ' def ServerPath(self):\n' |
| 339 ' if self._server_path is None:\n' |
| 340 '@@ -645,7 +649,10 @@ class GitAffectedFile(AffectedFile):\n' |
| 341 ' return self._is_text_file\n' |
| 342 ' \n' |
| 343 ' def GenerateScmDiff(self):\n' |
| 344 '- return scm.GIT.GenerateDiff(self._local_root, files=[self.Lo...\n' |
| 345 '+ if self._diff is None:\n' |
| 346 '+ self._diff = scm.GIT.GenerateDiff(\n' |
| 347 '+ self._local_root, files=[self.LocalPath(),])\n' |
| 348 '+ return self._diff\n' |
| 349 ' \n' |
| 350 ' \n' |
| 351 ' class Change(object):\n') |
OLD | NEW |