| OLD | NEW |
| (Empty) |
| 1 # Copyright (C) 2009 Google Inc. All rights reserved. | |
| 2 # | |
| 3 # Redistribution and use in source and binary forms, with or without | |
| 4 # modification, are permitted provided that the following conditions are | |
| 5 # met: | |
| 6 # | |
| 7 # * Redistributions of source code must retain the above copyright | |
| 8 # notice, this list of conditions and the following disclaimer. | |
| 9 # * Redistributions in binary form must reproduce the above | |
| 10 # copyright notice, this list of conditions and the following disclaimer | |
| 11 # in the documentation and/or other materials provided with the | |
| 12 # distribution. | |
| 13 # * Neither the name of Google Inc. nor the names of its | |
| 14 # contributors may be used to endorse or promote products derived from | |
| 15 # this software without specific prior written permission. | |
| 16 # | |
| 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 28 | |
| 29 import webkitpy.thirdparty.unittest2 as unittest | |
| 30 import subprocess | |
| 31 | |
| 32 from webkitpy.tool.steps.haslanded import HasLanded | |
| 33 | |
| 34 | |
| 35 class HasLandedTest(unittest.TestCase): | |
| 36 maxDiff = None | |
| 37 | |
| 38 @unittest.skipUnless(subprocess.call('which interdiff', shell=True, stdout=s
ubprocess.PIPE, stderr=subprocess.PIPE) == 0, "requires interdiff") | |
| 39 def test_run(self): | |
| 40 # These patches require trailing whitespace to remain valid patches. | |
| 41 diff1 = """\ | |
| 42 Index: a.py | |
| 43 =================================================================== | |
| 44 --- a.py | |
| 45 +++ a.py | |
| 46 @@ -1,3 +1,5 @@ | |
| 47 A | |
| 48 B | |
| 49 C | |
| 50 +D | |
| 51 +E | |
| 52 Index: b.py | |
| 53 =================================================================== | |
| 54 --- b.py 2013-01-21 15:20:59.693887185 +1100 | |
| 55 +++ b.py 2013-01-21 15:22:24.382555711 +1100 | |
| 56 @@ -1,3 +1,5 @@ | |
| 57 1 | |
| 58 2 | |
| 59 3 | |
| 60 +4 | |
| 61 +5 | |
| 62 """ | |
| 63 | |
| 64 diff1_add_line = """\ | |
| 65 Index: a.py | |
| 66 =================================================================== | |
| 67 --- a.py | |
| 68 +++ a.py | |
| 69 @@ -1,3 +1,6 @@ | |
| 70 A | |
| 71 B | |
| 72 C | |
| 73 +D | |
| 74 +E | |
| 75 +F | |
| 76 Index: b.py | |
| 77 =================================================================== | |
| 78 --- b.py | |
| 79 +++ b.py | |
| 80 @@ -1,3 +1,5 @@ | |
| 81 1 | |
| 82 2 | |
| 83 3 | |
| 84 +4 | |
| 85 +5 | |
| 86 """ | |
| 87 | |
| 88 diff1_remove_line = """\ | |
| 89 Index: a.py | |
| 90 =================================================================== | |
| 91 --- a.py | |
| 92 +++ a.py | |
| 93 @@ -1,3 +1,4 @@ | |
| 94 A | |
| 95 B | |
| 96 C | |
| 97 +D | |
| 98 Index: b.py | |
| 99 =================================================================== | |
| 100 --- b.py | |
| 101 +++ b.py | |
| 102 @@ -1,3 +1,5 @@ | |
| 103 1 | |
| 104 2 | |
| 105 3 | |
| 106 +4 | |
| 107 +5 | |
| 108 """ | |
| 109 | |
| 110 diff1_add_file = diff1 + """\ | |
| 111 Index: c.py | |
| 112 =================================================================== | |
| 113 --- c.py | |
| 114 +++ c.py | |
| 115 @@ -1,3 +1,5 @@ | |
| 116 1 | |
| 117 2 | |
| 118 3 | |
| 119 +4 | |
| 120 +5 | |
| 121 """ | |
| 122 | |
| 123 diff1_remove_file = """\ | |
| 124 Index: a.py | |
| 125 =================================================================== | |
| 126 --- a.py | |
| 127 +++ a.py | |
| 128 @@ -1,3 +1,5 @@ | |
| 129 A | |
| 130 B | |
| 131 C | |
| 132 +D | |
| 133 +E | |
| 134 """ | |
| 135 self.assertMultiLineEqual( | |
| 136 HasLanded.diff_diff(diff1, diff1_add_line, '', 'add-line'), | |
| 137 """\ | |
| 138 diff -u a.py a.py | |
| 139 --- a.py | |
| 140 +++ a.py | |
| 141 @@ -5,0 +6 @@ | |
| 142 +F | |
| 143 """) | |
| 144 | |
| 145 self.assertMultiLineEqual( | |
| 146 HasLanded.diff_diff(diff1, diff1_remove_line, '', 'remove-line'), | |
| 147 """\ | |
| 148 diff -u a.py a.py | |
| 149 --- a.py | |
| 150 +++ a.py | |
| 151 @@ -5 +4,0 @@ | |
| 152 -E | |
| 153 """) | |
| 154 self.assertMultiLineEqual( | |
| 155 HasLanded.diff_diff(diff1, diff1_add_file, '', 'add-file'), | |
| 156 """\ | |
| 157 only in patch2: | |
| 158 unchanged: | |
| 159 --- c.py | |
| 160 +++ c.py | |
| 161 @@ -1,3 +1,5 @@ | |
| 162 1 | |
| 163 2 | |
| 164 3 | |
| 165 +4 | |
| 166 +5 | |
| 167 """) | |
| 168 self.assertMultiLineEqual( | |
| 169 HasLanded.diff_diff(diff1, diff1_remove_file, '', 'remove-file'), | |
| 170 """\ | |
| 171 reverted: | |
| 172 --- b.py 2013-01-21 15:22:24.382555711 +1100 | |
| 173 +++ b.py 2013-01-21 15:20:59.693887185 +1100 | |
| 174 @@ -1,5 +1,3 @@ | |
| 175 1 | |
| 176 2 | |
| 177 3 | |
| 178 -4 | |
| 179 -5 | |
| 180 """) | |
| 181 | |
| 182 def test_convert_to_svn_and_strip_change_log(self): | |
| 183 # These patches require trailing whitespace to remain valid patches. | |
| 184 testbefore1 = HasLanded.convert_to_svn("""\ | |
| 185 diff --git a/Tools/ChangeLog b/Tools/ChangeLog | |
| 186 index 219ba72..0390b73 100644 | |
| 187 --- a/Tools/ChangeLog | |
| 188 +++ b/Tools/ChangeLog | |
| 189 @@ -1,3 +1,32 @@ | |
| 190 +2013-01-17 Tim 'mithro' Ansell <mithro@mithis.com> | |
| 191 + | |
| 192 + Adding "has-landed" command to webkit-patch which allows a person to | |
| 193 + Reviewed by NOBODY (OOPS!). | |
| 194 + | |
| 195 2013-01-20 Tim 'mithro' Ansell <mithro@mithis.com> | |
| 196 | |
| 197 Extend diff_parser to support the --full-index output. | |
| 198 diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py b/Tools/Scripts/w
ebkitpy/common/net/bugzilla/bug.py | |
| 199 index 4bf8ec6..3a128cb 100644 | |
| 200 --- a/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 201 +++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 202 @@ -28,6 +28,8 @@ | |
| 203 +import re | |
| 204 + | |
| 205 from .attachment import Attachment | |
| 206 | |
| 207 """) | |
| 208 testafter1 = HasLanded.convert_to_svn("""\ | |
| 209 diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py b/Tools/Scripts/w
ebkitpy/common/net/bugzilla/bug.py | |
| 210 index 4bf8ec6..3a128cb 100644 | |
| 211 --- a/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 212 +++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 213 @@ -28,6 +28,8 @@ | |
| 214 +import re | |
| 215 + | |
| 216 from .attachment import Attachment | |
| 217 | |
| 218 diff --git a/Tools/ChangeLog b/Tools/ChangeLog | |
| 219 index 219ba72..0390b73 100644 | |
| 220 --- a/Tools/ChangeLog | |
| 221 +++ b/Tools/ChangeLog | |
| 222 @@ -1,3 +1,32 @@ | |
| 223 +2013-01-17 Tim 'mithro' Ansell <mithro@mithis.com> | |
| 224 + | |
| 225 + Adding "has-landed" command to webkit-patch which allows a person to | |
| 226 + Reviewed by NOBODY (OOPS!). | |
| 227 + | |
| 228 2013-01-20 Tim 'mithro' Ansell <mithro@mithis.com> | |
| 229 | |
| 230 Extend diff_parser to support the --full-index output. | |
| 231 """) | |
| 232 testexpected1 = """\ | |
| 233 Index: Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 234 =================================================================== | |
| 235 --- Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 236 +++ Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 237 @@ -28,6 +28,8 @@ | |
| 238 +import re | |
| 239 + | |
| 240 from .attachment import Attachment | |
| 241 | |
| 242 """ | |
| 243 testmiddle1 = HasLanded.convert_to_svn("""\ | |
| 244 diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py b/Tools/Scripts/w
ebkitpy/common/net/bugzilla/bug.py | |
| 245 index 4bf8ec6..3a128cb 100644 | |
| 246 --- a/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 247 +++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 248 @@ -28,6 +28,8 @@ | |
| 249 +import re | |
| 250 + | |
| 251 from .attachment import Attachment | |
| 252 | |
| 253 diff --git a/ChangeLog b/ChangeLog | |
| 254 index 219ba72..0390b73 100644 | |
| 255 --- a/ChangeLog | |
| 256 +++ b/ChangeLog | |
| 257 @@ -1,3 +1,32 @@ | |
| 258 +2013-01-17 Tim 'mithro' Ansell <mithro@mithis.com> | |
| 259 + | |
| 260 + Adding "has-landed" command to webkit-patch which allows a person to | |
| 261 + Reviewed by NOBODY (OOPS!). | |
| 262 + | |
| 263 2013-01-20 Tim 'mithro' Ansell <mithro@mithis.com> | |
| 264 | |
| 265 Extend diff_parser to support the --full-index output. | |
| 266 diff --git a/Tools/Scripts/webkitpy/common/other.py b/Tools/Scripts/webkitpy/com
mon/other.py | |
| 267 index 4bf8ec6..3a128cb 100644 | |
| 268 --- a/Tools/Scripts/webkitpy/common/other.py | |
| 269 +++ b/Tools/Scripts/webkitpy/common/other.py | |
| 270 @@ -28,6 +28,8 @@ | |
| 271 +import re | |
| 272 + | |
| 273 from .attachment import Attachment | |
| 274 | |
| 275 """) | |
| 276 testexpected2 = """\ | |
| 277 Index: Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 278 =================================================================== | |
| 279 --- Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 280 +++ Tools/Scripts/webkitpy/common/net/bugzilla/bug.py | |
| 281 @@ -28,6 +28,8 @@ | |
| 282 +import re | |
| 283 + | |
| 284 from .attachment import Attachment | |
| 285 | |
| 286 Index: Tools/Scripts/webkitpy/common/other.py | |
| 287 =================================================================== | |
| 288 --- Tools/Scripts/webkitpy/common/other.py | |
| 289 +++ Tools/Scripts/webkitpy/common/other.py | |
| 290 @@ -28,6 +28,8 @@ | |
| 291 +import re | |
| 292 + | |
| 293 from .attachment import Attachment | |
| 294 | |
| 295 """ | |
| 296 | |
| 297 self.assertMultiLineEqual(testexpected1, HasLanded.strip_change_log(test
before1)) | |
| 298 self.assertMultiLineEqual(testexpected1, HasLanded.strip_change_log(test
after1)) | |
| 299 self.assertMultiLineEqual(testexpected2, HasLanded.strip_change_log(test
middle1)) | |
| OLD | NEW |