patches_data.py 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. """Samples patches to test patch.py."""
  5. class RAW(object):
  6. PATCH = (
  7. 'Index: chrome/file.cc\n'
  8. '===================================================================\n'
  9. '--- chrome/file.cc\t(revision 74690)\n'
  10. '+++ chrome/file.cc\t(working copy)\n'
  11. '@@ -3,6 +3,7 @@ bb\n'
  12. ' ccc\n'
  13. ' dd\n'
  14. ' e\n'
  15. '+FOO!\n'
  16. ' ff\n'
  17. ' ggg\n'
  18. ' hh\n')
  19. NEW = (
  20. '--- /dev/null\n'
  21. '+++ foo\n'
  22. '@@ -0,0 +1 @@\n'
  23. '+bar\n')
  24. NEW_NOT_NULL = (
  25. '--- file_a\n'
  26. '+++ file_a\n'
  27. '@@ -0,0 +1 @@\n'
  28. '+foo\n')
  29. MINIMAL_NEW = (
  30. '--- /dev/null\t2\n'
  31. '+++ chrome/file.cc\tfoo\n')
  32. MINIMAL = (
  33. '--- file_a\n'
  34. '+++ file_a\n')
  35. MINIMAL_RENAME = (
  36. '--- file_a\n'
  37. '+++ file_b\n')
  38. DELETE = (
  39. '--- tools/clang_check/README.chromium\n'
  40. '+++ /dev/null\n'
  41. '@@ -1,1 +0,0 @@\n'
  42. '-bar\n')
  43. MINIMAL_DELETE = (
  44. '--- chrome/file.cc\tbar\n'
  45. '+++ /dev/null\tfoo\n')
  46. # http://codereview.chromium.org/api/7530007/5001
  47. # http://codereview.chromium.org/download/issue7530007_5001_4011.diff
  48. CRAP_ONLY = (
  49. 'Index: scripts/master/factory/skia/__init__.py\n'
  50. '===================================================================\n')
  51. class GIT(object):
  52. """Sample patches generated by git diff."""
  53. PATCH = (
  54. 'diff --git a/chrome/file.cc b/chrome/file.cc\n'
  55. 'index 0e4de76..8320059 100644\n'
  56. '--- a/chrome/file.cc\n'
  57. '+++ b/chrome/file.cc\n'
  58. '@@ -3,6 +3,7 @@ bb\n'
  59. ' ccc\n'
  60. ' dd\n'
  61. ' e\n'
  62. '+FOO!\n'
  63. ' ff\n'
  64. ' ggg\n'
  65. ' hh\n')
  66. # http://codereview.chromium.org/download/issue6368055_22_29.diff
  67. DELETE = (
  68. 'Index: tools/clang_check/README.chromium\n'
  69. 'diff --git a/tools/clang_check/README.chromium '
  70. 'b/tools/clang_check/README.chromium\n'
  71. 'deleted file mode 100644\n'
  72. 'index fcaa7e0e94bb604a026c4f478fecb1c5796f5413..'
  73. '0000000000000000000000000000000000000000\n'
  74. '--- a/tools/clang_check/README.chromium\n'
  75. '+++ /dev/null\n'
  76. '@@ -1,9 +0,0 @@\n'
  77. '-These are terrible, terrible hacks.\n'
  78. '-\n'
  79. '-They are meant \n'
  80. '-AND doing the normal \n'
  81. '-run during normal \n'
  82. '-build system to do a syntax check.\n'
  83. '-\n'
  84. '-Also see\n'
  85. '\n')
  86. # http://codereview.chromium.org/download/issue6250123_3013_6010.diff
  87. RENAME_PARTIAL = (
  88. 'Index: chromeos/views/webui_menu_widget.h\n'
  89. 'diff --git a/chromeos/views/DOMui_menu_widget.h '
  90. 'b/chromeos/views/webui_menu_widget.h\n'
  91. 'similarity index 79%\n'
  92. 'rename from chromeos/views/DOMui_menu_widget.h\n'
  93. 'rename to chromeos/views/webui_menu_widget.h\n'
  94. 'index 095d4c474fd9718f5aebfa41a1ccb2d951356d41..'
  95. '157925075434b590e8acaaf605a64f24978ba08b 100644\n'
  96. '--- a/chromeos/views/DOMui_menu_widget.h\n'
  97. '+++ b/chromeos/views/webui_menu_widget.h\n'
  98. '@@ -1,9 +1,9 @@\n'
  99. '-// Copyright (c) 2010\n'
  100. '+// Copyright (c) 2011\n'
  101. ' // Use of this source code\n'
  102. ' // found in the LICENSE file.\n'
  103. ' \n'
  104. '-#ifndef DOM\n'
  105. '-#define DOM\n'
  106. '+#ifndef WEB\n'
  107. '+#define WEB\n'
  108. ' #pragma once\n'
  109. ' \n'
  110. ' #include <string>\n')
  111. # http://codereview.chromium.org/download/issue6287022_3001_4010.diff
  112. RENAME = (
  113. 'Index: tools/run_local_server.sh\n'
  114. 'diff --git a/tools/run_local_server.PY b/tools/run_local_server.sh\n'
  115. 'similarity index 100%\n'
  116. 'rename from tools/run_local_server.PY\n'
  117. 'rename to tools/run_local_server.sh\n')
  118. COPY = (
  119. 'diff --git a/PRESUBMIT.py b/pp\n'
  120. 'similarity index 100%\n'
  121. 'copy from PRESUBMIT.py\n'
  122. 'copy to pp\n')
  123. COPY_PARTIAL = (
  124. 'diff --git a/wtf b/wtf2\n'
  125. 'similarity index 98%\n'
  126. 'copy from wtf\n'
  127. 'copy to wtf2\n'
  128. 'index 79fbaf3..3560689 100755\n'
  129. '--- a/wtf\n'
  130. '+++ b/wtf2\n'
  131. '@@ -1,4 +1,4 @@\n'
  132. '-#!/usr/bin/env python\n'
  133. '+#!/usr/bin/env python1.3\n'
  134. ' # Copyright (c) 2010 The Chromium Authors. All rights reserved.\n'
  135. ' # blah blah blah as\n'
  136. ' # found in the LICENSE file.\n')
  137. NEW = (
  138. 'diff --git a/foo b/foo\n'
  139. 'new file mode 100644\n'
  140. 'index 0000000..5716ca5\n'
  141. '--- /dev/null\n'
  142. '+++ b/foo\n'
  143. '@@ -0,0 +1 @@\n'
  144. '+bar\n')
  145. NEW_EXE = (
  146. 'diff --git a/natsort_test.py b/natsort_test.py\n'
  147. 'new file mode 100755\n'
  148. '--- /dev/null\n'
  149. '+++ b/natsort_test.py\n'
  150. '@@ -0,0 +1,1 @@\n'
  151. '+#!/usr/bin/env python\n')
  152. # To make sure the subdirectory was created as needed.
  153. NEW_SUBDIR = (
  154. 'diff --git a/new_dir/subdir/new_file b/new_dir/subdir/new_file\n'
  155. 'new file mode 100644\n'
  156. '--- /dev/null\n'
  157. '+++ b/new_dir/subdir/new_file\n'
  158. '@@ -0,0 +1,2 @@\n'
  159. '+A new file\n'
  160. '+should exist.\n')
  161. NEW_MODE = (
  162. 'diff --git a/natsort_test.py b/natsort_test.py\n'
  163. 'new file mode 100644\n'
  164. '--- /dev/null\n'
  165. '+++ b/natsort_test.py\n'
  166. '@@ -0,0 +1,1 @@\n'
  167. '+#!/usr/bin/env python\n')
  168. MODE_EXE = (
  169. 'diff --git a/git_cl/git-cl b/git_cl/git-cl\n'
  170. 'old mode 100644\n'
  171. 'new mode 100755\n')
  172. MODE_EXE_JUNK = (
  173. 'Index: Junk\n'
  174. 'diff --git a/git_cl/git-cl b/git_cl/git-cl\n'
  175. 'old mode 100644\n'
  176. 'new mode 100755\n')