Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: tools/push-to-trunk/test_scripts.py

Issue 702843002: Make merge_to_branch more git-friendly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/push-to-trunk/releases.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 the V8 project authors. All rights reserved. 2 # Copyright 2013 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 Cmd("git fetch", ""), 496 Cmd("git fetch", ""),
497 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), 497 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
498 Cmd("git fetch", ""), 498 Cmd("git fetch", ""),
499 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), 499 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
500 Cmd("git fetch", ""), 500 Cmd("git fetch", ""),
501 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), 501 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
502 Cmd("git fetch", ""), 502 Cmd("git fetch", ""),
503 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), 503 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
504 ]) 504 ])
505 args = ["--branch", "candidates", "--vc-interface", "git_read_svn_write", 505 args = ["--branch", "candidates", "--vc-interface", "git_read_svn_write",
506 "12345"] 506 "ab12345"]
507 self._state["version"] = "tag_name" 507 self._state["version"] = "tag_name"
508 self._state["commit_title"] = "Title" 508 self._state["commit_title"] = "Title"
509 self.assertRaises(Exception, 509 self.assertRaises(Exception,
510 lambda: self.RunStep(MergeToBranch, TagRevision, args)) 510 lambda: self.RunStep(MergeToBranch, TagRevision, args))
511 511
512 def testReadAndPersistVersion(self): 512 def testReadAndPersistVersion(self):
513 self.WriteFakeVersionFile(build=5) 513 self.WriteFakeVersionFile(build=5)
514 step = self.MakeStep() 514 step = self.MakeStep()
515 step.ReadAndPersistVersion() 515 step.ReadAndPersistVersion()
516 self.assertEquals("3", step["major"]) 516 self.assertEquals("3", step["major"])
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile() 1218 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile()
1219 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) 1219 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
1220 self.WriteFakeVersionFile(build=5) 1220 self.WriteFakeVersionFile(build=5)
1221 os.environ["EDITOR"] = "vi" 1221 os.environ["EDITOR"] = "vi"
1222 extra_patch = self.MakeEmptyTempFile() 1222 extra_patch = self.MakeEmptyTempFile()
1223 1223
1224 def VerifyPatch(patch): 1224 def VerifyPatch(patch):
1225 return lambda: self.assertEquals(patch, 1225 return lambda: self.assertEquals(patch,
1226 FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"])) 1226 FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"]))
1227 1227
1228 msg = """Version 3.22.5.1 (merged r12345, r23456, r34567, r45678, r56789) 1228 msg = """Version 3.22.5.1 (cherry-pick)
1229
1230 Merged ab12345
1231 Merged ab23456
1232 Merged ab34567
1233 Merged ab45678
1234 Merged ab56789
1229 1235
1230 Title4 1236 Title4
1231 1237
1232 Title2
1233
1234 Title3
1235
1236 Title1
1237
1238 Revert "Something"
1239
1240 BUG=123,234,345,456,567,v8:123
1241 LOG=N
1242 """
1243
1244 def VerifySVNCommit():
1245 commit = FileToText(TEST_CONFIG["COMMITMSG_FILE"])
1246 self.assertEquals(msg, commit)
1247 version = FileToText(
1248 os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE))
1249 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version))
1250 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version))
1251 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+1", version))
1252 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version))
1253
1254 self.Expect([
1255 Cmd("git status -s -uno", ""),
1256 Cmd("git status -s -b -uno", "## some_branch\n"),
1257 Cmd("git svn fetch", ""),
1258 Cmd("git branch", " branch1\n* branch2\n"),
1259 Cmd("git new-branch %s --upstream svn/trunk" % TEST_CONFIG["BRANCHNAME"],
1260 ""),
1261 Cmd(("git log --format=%H --grep=\"Port r12345\" "
1262 "--reverse svn/bleeding_edge"),
1263 "hash1\nhash2"),
1264 Cmd("git svn find-rev hash1 svn/bleeding_edge", "45678"),
1265 Cmd("git log -1 --format=%s hash1", "Title1"),
1266 Cmd("git svn find-rev hash2 svn/bleeding_edge", "23456"),
1267 Cmd("git log -1 --format=%s hash2", "Title2"),
1268 Cmd(("git log --format=%H --grep=\"Port r23456\" "
1269 "--reverse svn/bleeding_edge"),
1270 ""),
1271 Cmd(("git log --format=%H --grep=\"Port r34567\" "
1272 "--reverse svn/bleeding_edge"),
1273 "hash3"),
1274 Cmd("git svn find-rev hash3 svn/bleeding_edge", "56789"),
1275 Cmd("git log -1 --format=%s hash3", "Title3"),
1276 RL("Y"), # Automatically add corresponding ports (34567, 56789)?
1277 Cmd("git svn find-rev r12345 svn/bleeding_edge", "hash4"),
1278 # Simulate svn being down which stops the script.
1279 Cmd("git svn find-rev r23456 svn/bleeding_edge", None),
1280 # Restart script in the failing step.
1281 Cmd("git svn find-rev r12345 svn/bleeding_edge", "hash4"),
1282 Cmd("git svn find-rev r23456 svn/bleeding_edge", "hash2"),
1283 Cmd("git svn find-rev r34567 svn/bleeding_edge", "hash3"),
1284 Cmd("git svn find-rev r45678 svn/bleeding_edge", "hash1"),
1285 Cmd("git svn find-rev r56789 svn/bleeding_edge", "hash5"),
1286 Cmd("git log -1 --format=%s hash4", "Title4"),
1287 Cmd("git log -1 --format=%s hash2", "Title2"),
1288 Cmd("git log -1 --format=%s hash3", "Title3"),
1289 Cmd("git log -1 --format=%s hash1", "Title1"),
1290 Cmd("git log -1 --format=%s hash5", "Revert \"Something\""),
1291 Cmd("git log -1 hash4", "Title4\nBUG=123\nBUG=234"),
1292 Cmd("git log -1 hash2", "Title2\n BUG = v8:123,345"),
1293 Cmd("git log -1 hash3", "Title3\nLOG=n\nBUG=567, 456"),
1294 Cmd("git log -1 hash1", "Title1\nBUG="),
1295 Cmd("git log -1 hash5", "Revert \"Something\"\nBUG=none"),
1296 Cmd("git log -1 -p hash4", "patch4"),
1297 Cmd(("git apply --index --reject \"%s\"" %
1298 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1299 "", cb=VerifyPatch("patch4")),
1300 Cmd("git log -1 -p hash2", "patch2"),
1301 Cmd(("git apply --index --reject \"%s\"" %
1302 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1303 "", cb=VerifyPatch("patch2")),
1304 Cmd("git log -1 -p hash3", "patch3"),
1305 Cmd(("git apply --index --reject \"%s\"" %
1306 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1307 "", cb=VerifyPatch("patch3")),
1308 Cmd("git log -1 -p hash1", "patch1"),
1309 Cmd(("git apply --index --reject \"%s\"" %
1310 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1311 "", cb=VerifyPatch("patch1")),
1312 Cmd("git log -1 -p hash5", "patch5\n"),
1313 Cmd(("git apply --index --reject \"%s\"" %
1314 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1315 "", cb=VerifyPatch("patch5\n")),
1316 Cmd("git apply --index --reject \"%s\"" % extra_patch, ""),
1317 RL("Y"), # Automatically increment patch level?
1318 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], ""),
1319 RL("reviewer@chromium.org"), # V8 reviewer.
1320 Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\" "
1321 "--bypass-hooks --cc \"ulan@chromium.org\"", ""),
1322 Cmd("git checkout -f %s" % TEST_CONFIG["BRANCHNAME"], ""),
1323 RL("LGTM"), # Enter LGTM for V8 CL.
1324 Cmd("git cl presubmit", "Presubmit successfull\n"),
1325 Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n",
1326 cb=VerifySVNCommit),
1327 Cmd("git svn fetch", ""),
1328 Cmd("git rebase svn/trunk", ""),
1329 Cmd("git svn tag 3.22.5.1 -m \"Tagging version 3.22.5.1\"", ""),
1330 Cmd("git checkout -f some_branch", ""),
1331 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
1332 ])
1333
1334 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS
1335 # ports of r12345. r56789 is the MIPS port of r34567.
1336 args = ["-f", "-p", extra_patch, "--branch", "trunk",
1337 "--vc-interface", "git_svn", "12345", "23456", "34567"]
1338
1339 # The first run of the script stops because of the svn being down.
1340 self.assertRaises(GitFailedException,
1341 lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
1342
1343 # Test that state recovery after restarting the script works.
1344 args += ["-s", "4"]
1345 MergeToBranch(TEST_CONFIG, self).Run(args)
1346
1347 def testMergeToBranchNewGit(self):
1348 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile()
1349 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
1350 self.WriteFakeVersionFile(build=5)
1351 os.environ["EDITOR"] = "vi"
1352 extra_patch = self.MakeEmptyTempFile()
1353
1354 def VerifyPatch(patch):
1355 return lambda: self.assertEquals(patch,
1356 FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"]))
1357
1358 msg = """Version 3.22.5.1 (merged r12345, r23456, r34567, r45678, r56789)
1359
1360 Title4
1361
1362 Title2 1238 Title2
1363 1239
1364 Title3 1240 Title3
1365 1241
1366 Title1 1242 Title1
1367 1243
1368 Revert "Something" 1244 Revert "Something"
1369 1245
1370 BUG=123,234,345,456,567,v8:123 1246 BUG=123,234,345,456,567,v8:123
1371 LOG=N 1247 LOG=N
(...skipping 10 matching lines...) Expand all
1382 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) 1258 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version))
1383 1259
1384 self.Expect([ 1260 self.Expect([
1385 Cmd("git status -s -uno", ""), 1261 Cmd("git status -s -uno", ""),
1386 Cmd("git status -s -b -uno", "## some_branch\n"), 1262 Cmd("git status -s -b -uno", "## some_branch\n"),
1387 Cmd("git fetch", ""), 1263 Cmd("git fetch", ""),
1388 Cmd("git svn fetch", ""), 1264 Cmd("git svn fetch", ""),
1389 Cmd("git branch", " branch1\n* branch2\n"), 1265 Cmd("git branch", " branch1\n* branch2\n"),
1390 Cmd("git new-branch %s --upstream origin/candidates" % 1266 Cmd("git new-branch %s --upstream origin/candidates" %
1391 TEST_CONFIG["BRANCHNAME"], ""), 1267 TEST_CONFIG["BRANCHNAME"], ""),
1392 Cmd(("git log --format=%H --grep=\"Port r12345\" " 1268 Cmd(("git log --format=%H --grep=\"Port ab12345\" "
1393 "--reverse origin/master"), 1269 "--reverse origin/master"),
1394 "hash1\nhash2"), 1270 "ab45678\nab23456"),
1395 Cmd("git svn find-rev hash1 origin/master", "45678"), 1271 Cmd("git log -1 --format=%s ab45678", "Title1"),
1396 Cmd("git log -1 --format=%s hash1", "Title1"), 1272 Cmd("git log -1 --format=%s ab23456", "Title2"),
1397 Cmd("git svn find-rev hash2 origin/master", "23456"), 1273 Cmd(("git log --format=%H --grep=\"Port ab23456\" "
1398 Cmd("git log -1 --format=%s hash2", "Title2"),
1399 Cmd(("git log --format=%H --grep=\"Port r23456\" "
1400 "--reverse origin/master"), 1274 "--reverse origin/master"),
1401 ""), 1275 ""),
1402 Cmd(("git log --format=%H --grep=\"Port r34567\" " 1276 Cmd(("git log --format=%H --grep=\"Port ab34567\" "
1403 "--reverse origin/master"), 1277 "--reverse origin/master"),
1404 "hash3"), 1278 "ab56789"),
1405 Cmd("git svn find-rev hash3 origin/master", "56789"), 1279 Cmd("git log -1 --format=%s ab56789", "Title3"),
1406 Cmd("git log -1 --format=%s hash3", "Title3"), 1280 RL("Y"), # Automatically add corresponding ports (ab34567, ab56789)?
1407 RL("Y"), # Automatically add corresponding ports (34567, 56789)? 1281 # Simulate git being down which stops the script.
1408 Cmd("git svn find-rev r12345 origin/master", 1282 Cmd("git log -1 --format=%s ab12345", None),
1409 "Partial-rebuilding bla\nDone rebuilding blub\nhash4"),
1410 # Simulate svn being down which stops the script.
1411 Cmd("git svn find-rev r23456 origin/master", None),
1412 # Restart script in the failing step. 1283 # Restart script in the failing step.
1413 Cmd("git svn find-rev r12345 origin/master", "hash4"), 1284 Cmd("git log -1 --format=%s ab12345", "Title4"),
1414 Cmd("git svn find-rev r23456 origin/master", "hash2"), 1285 Cmd("git log -1 --format=%s ab23456", "Title2"),
1415 Cmd("git svn find-rev r34567 origin/master", "hash3"), 1286 Cmd("git log -1 --format=%s ab34567", "Title3"),
1416 Cmd("git svn find-rev r45678 origin/master", "hash1"), 1287 Cmd("git log -1 --format=%s ab45678", "Title1"),
1417 Cmd("git svn find-rev r56789 origin/master", "hash5"), 1288 Cmd("git log -1 --format=%s ab56789", "Revert \"Something\""),
1418 Cmd("git log -1 --format=%s hash4", "Title4"), 1289 Cmd("git log -1 ab12345", "Title4\nBUG=123\nBUG=234"),
1419 Cmd("git log -1 --format=%s hash2", "Title2"), 1290 Cmd("git log -1 ab23456", "Title2\n BUG = v8:123,345"),
1420 Cmd("git log -1 --format=%s hash3", "Title3"), 1291 Cmd("git log -1 ab34567", "Title3\nLOG=n\nBUG=567, 456"),
1421 Cmd("git log -1 --format=%s hash1", "Title1"), 1292 Cmd("git log -1 ab45678", "Title1\nBUG="),
1422 Cmd("git log -1 --format=%s hash5", "Revert \"Something\""), 1293 Cmd("git log -1 ab56789", "Revert \"Something\"\nBUG=none"),
1423 Cmd("git log -1 hash4", "Title4\nBUG=123\nBUG=234"), 1294 Cmd("git log -1 -p ab12345", "patch4"),
1424 Cmd("git log -1 hash2", "Title2\n BUG = v8:123,345"),
1425 Cmd("git log -1 hash3", "Title3\nLOG=n\nBUG=567, 456"),
1426 Cmd("git log -1 hash1", "Title1\nBUG="),
1427 Cmd("git log -1 hash5", "Revert \"Something\"\nBUG=none"),
1428 Cmd("git log -1 -p hash4", "patch4"),
1429 Cmd(("git apply --index --reject \"%s\"" % 1295 Cmd(("git apply --index --reject \"%s\"" %
1430 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), 1296 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1431 "", cb=VerifyPatch("patch4")), 1297 "", cb=VerifyPatch("patch4")),
1432 Cmd("git log -1 -p hash2", "patch2"), 1298 Cmd("git log -1 -p ab23456", "patch2"),
1433 Cmd(("git apply --index --reject \"%s\"" % 1299 Cmd(("git apply --index --reject \"%s\"" %
1434 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), 1300 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1435 "", cb=VerifyPatch("patch2")), 1301 "", cb=VerifyPatch("patch2")),
1436 Cmd("git log -1 -p hash3", "patch3"), 1302 Cmd("git log -1 -p ab34567", "patch3"),
1437 Cmd(("git apply --index --reject \"%s\"" % 1303 Cmd(("git apply --index --reject \"%s\"" %
1438 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), 1304 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1439 "", cb=VerifyPatch("patch3")), 1305 "", cb=VerifyPatch("patch3")),
1440 Cmd("git log -1 -p hash1", "patch1"), 1306 Cmd("git log -1 -p ab45678", "patch1"),
1441 Cmd(("git apply --index --reject \"%s\"" % 1307 Cmd(("git apply --index --reject \"%s\"" %
1442 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), 1308 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1443 "", cb=VerifyPatch("patch1")), 1309 "", cb=VerifyPatch("patch1")),
1444 Cmd("git log -1 -p hash5", "patch5\n"), 1310 Cmd("git log -1 -p ab56789", "patch5\n"),
1445 Cmd(("git apply --index --reject \"%s\"" % 1311 Cmd(("git apply --index --reject \"%s\"" %
1446 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), 1312 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1447 "", cb=VerifyPatch("patch5\n")), 1313 "", cb=VerifyPatch("patch5\n")),
1448 Cmd("git apply --index --reject \"%s\"" % extra_patch, ""), 1314 Cmd("git apply --index --reject \"%s\"" % extra_patch, ""),
1449 RL("Y"), # Automatically increment patch level? 1315 RL("Y"), # Automatically increment patch level?
1450 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], ""), 1316 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], ""),
1451 RL("reviewer@chromium.org"), # V8 reviewer. 1317 RL("reviewer@chromium.org"), # V8 reviewer.
1452 Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\" " 1318 Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\" "
1453 "--bypass-hooks --cc \"ulan@chromium.org\"", ""), 1319 "--bypass-hooks --cc \"ulan@chromium.org\"", ""),
1454 Cmd("git checkout -f %s" % TEST_CONFIG["BRANCHNAME"], ""), 1320 Cmd("git checkout -f %s" % TEST_CONFIG["BRANCHNAME"], ""),
1455 RL("LGTM"), # Enter LGTM for V8 CL. 1321 RL("LGTM"), # Enter LGTM for V8 CL.
1456 Cmd("git cl presubmit", "Presubmit successfull\n"), 1322 Cmd("git cl presubmit", "Presubmit successfull\n"),
1457 Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n", 1323 Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n",
1458 cb=VerifySVNCommit), 1324 cb=VerifySVNCommit),
1459 Cmd("git fetch", ""), 1325 Cmd("git fetch", ""),
1460 Cmd("git log -1 --format=%H --grep=\"" 1326 Cmd("git log -1 --format=%H --grep=\""
1461 "Version 3.22.5.1 (merged r12345, r23456, r34567, r45678, r56789)" 1327 "Version 3.22.5.1 (cherry-pick)"
1462 "\" origin/candidates", 1328 "\" origin/candidates",
1463 ""), 1329 ""),
1464 Cmd("git fetch", ""), 1330 Cmd("git fetch", ""),
1465 Cmd("git log -1 --format=%H --grep=\"" 1331 Cmd("git log -1 --format=%H --grep=\""
1466 "Version 3.22.5.1 (merged r12345, r23456, r34567, r45678, r56789)" 1332 "Version 3.22.5.1 (cherry-pick)"
1467 "\" origin/candidates", 1333 "\" origin/candidates",
1468 "hsh_to_tag"), 1334 "hsh_to_tag"),
1469 Cmd("git tag 3.22.5.1 hsh_to_tag", ""), 1335 Cmd("git tag 3.22.5.1 hsh_to_tag", ""),
1470 Cmd("git push origin 3.22.5.1", ""), 1336 Cmd("git push origin 3.22.5.1", ""),
1471 Cmd("git checkout -f some_branch", ""), 1337 Cmd("git checkout -f some_branch", ""),
1472 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), 1338 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
1473 ]) 1339 ])
1474 1340
1475 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS 1341 # ab12345 and ab34567 are patches. ab23456 (included) and ab45678 are the
1476 # ports of r12345. r56789 is the MIPS port of r34567. 1342 # MIPS ports of ab12345. ab56789 is the MIPS port of ab34567.
1477 args = ["-f", "-p", extra_patch, "--branch", "candidates", 1343 args = ["-f", "-p", extra_patch, "--branch", "candidates",
1478 "--vc-interface", "git_read_svn_write", "12345", "23456", "34567"] 1344 "ab12345", "ab23456", "ab34567"]
1479 1345
1480 # The first run of the script stops because of the svn being down. 1346 # The first run of the script stops because of git being down.
1481 self.assertRaises(GitFailedException, 1347 self.assertRaises(GitFailedException,
1482 lambda: MergeToBranch(TEST_CONFIG, self).Run(args)) 1348 lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
1483 1349
1484 # Test that state recovery after restarting the script works. 1350 # Test that state recovery after restarting the script works.
1485 args += ["-s", "4"] 1351 args += ["-s", "4"]
1486 MergeToBranch(TEST_CONFIG, self).Run(args) 1352 MergeToBranch(TEST_CONFIG, self).Run(args)
1487 1353
1488 def testReleases(self): 1354 def testReleases(self):
1489 tag_response_text = """ 1355 tag_response_text = """
1490 ------------------------------------------------------------------------ 1356 ------------------------------------------------------------------------
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 Cmd("git branch", " branch1\n* branch2\n"), 1428 Cmd("git branch", " branch1\n* branch2\n"),
1563 Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], ""), 1429 Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], ""),
1564 Cmd("git branch -r", " branch-heads/3.21\n branch-heads/3.3\n"), 1430 Cmd("git branch -r", " branch-heads/3.21\n branch-heads/3.3\n"),
1565 Cmd("git reset --hard branch-heads/3.3", ""), 1431 Cmd("git reset --hard branch-heads/3.3", ""),
1566 Cmd("git log --format=%H", "hash1\nhash_234"), 1432 Cmd("git log --format=%H", "hash1\nhash_234"),
1567 Cmd("git diff --name-only hash1 hash1^", ""), 1433 Cmd("git diff --name-only hash1 hash1^", ""),
1568 Cmd("git diff --name-only hash_234 hash_234^", VERSION_FILE), 1434 Cmd("git diff --name-only hash_234 hash_234^", VERSION_FILE),
1569 Cmd("git checkout -f hash_234 -- %s" % VERSION_FILE, "", 1435 Cmd("git checkout -f hash_234 -- %s" % VERSION_FILE, "",
1570 cb=ResetVersion(3, 1, 1)), 1436 cb=ResetVersion(3, 1, 1)),
1571 Cmd("git log -1 --format=%B hash_234", 1437 Cmd("git log -1 --format=%B hash_234",
1572 "Version 3.3.1.1 (merged 12)\n\nReview URL: fake.com\n"), 1438 "Version 3.3.1.1 (cherry-pick).\n\n"
1439 "Merged abc12.\n\n"
1440 "Review URL: fake.com\n"),
1573 Cmd("git log -1 --format=%s hash_234", ""), 1441 Cmd("git log -1 --format=%s hash_234", ""),
1574 Cmd("git svn find-rev hash_234", "234"), 1442 Cmd("git svn find-rev hash_234", "234"),
1575 Cmd("git log -1 --format=%ci hash_234", "18:15"), 1443 Cmd("git log -1 --format=%ci hash_234", "18:15"),
1576 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", 1444 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "",
1577 cb=ResetVersion(22, 5)), 1445 cb=ResetVersion(22, 5)),
1578 Cmd("git reset --hard branch-heads/3.21", ""), 1446 Cmd("git reset --hard branch-heads/3.21", ""),
1579 Cmd("git log --format=%H", "hash_123\nhash4\nhash5\n"), 1447 Cmd("git log --format=%H", "hash_123\nhash4\nhash5\n"),
1580 Cmd("git diff --name-only hash_123 hash_123^", VERSION_FILE), 1448 Cmd("git diff --name-only hash_123 hash_123^", VERSION_FILE),
1581 Cmd("git checkout -f hash_123 -- %s" % VERSION_FILE, "", 1449 Cmd("git checkout -f hash_123 -- %s" % VERSION_FILE, "",
1582 cb=ResetVersion(21, 2)), 1450 cb=ResetVersion(21, 2)),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 "--json", json_output, 1516 "--json", json_output,
1649 "--csv", csv_output, 1517 "--csv", csv_output,
1650 "--max-releases", "1"] 1518 "--max-releases", "1"]
1651 Releases(TEST_CONFIG, self).Run(args) 1519 Releases(TEST_CONFIG, self).Run(args)
1652 1520
1653 # Check expected output. 1521 # Check expected output.
1654 csv = ("3.28.41,master,22626,,\r\n" 1522 csv = ("3.28.41,master,22626,,\r\n"
1655 "3.28.40,master,22624,4567,\r\n" 1523 "3.28.40,master,22624,4567,\r\n"
1656 "3.22.3,candidates,345,3456:4566,\r\n" 1524 "3.22.3,candidates,345,3456:4566,\r\n"
1657 "3.21.2,3.21,123,,\r\n" 1525 "3.21.2,3.21,123,,\r\n"
1658 "3.3.1.1,3.3,234,,12\r\n") 1526 "3.3.1.1,3.3,234,,abc12\r\n")
1659 self.assertEquals(csv, FileToText(csv_output)) 1527 self.assertEquals(csv, FileToText(csv_output))
1660 1528
1661 expected_json = [ 1529 expected_json = [
1662 { 1530 {
1663 "revision": "22626", 1531 "revision": "22626",
1664 "revision_git": "hash_22626", 1532 "revision_git": "hash_22626",
1665 "bleeding_edge": "22626", 1533 "bleeding_edge": "22626",
1666 "bleeding_edge_git": "hash_22626", 1534 "bleeding_edge_git": "hash_22626",
1667 "patches_merged": "", 1535 "patches_merged": "",
1668 "version": "3.28.41", 1536 "version": "3.28.41",
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 "chromium_revision": "", 1579 "chromium_revision": "",
1712 "branch": "3.21", 1580 "branch": "3.21",
1713 "review_link": "", 1581 "review_link": "",
1714 "date": "03:15", 1582 "date": "03:15",
1715 "chromium_branch": "", 1583 "chromium_branch": "",
1716 "revision_link": "https://code.google.com/p/v8/source/detail?r=123", 1584 "revision_link": "https://code.google.com/p/v8/source/detail?r=123",
1717 }, 1585 },
1718 { 1586 {
1719 "revision": "234", 1587 "revision": "234",
1720 "revision_git": "hash_234", 1588 "revision_git": "hash_234",
1721 "patches_merged": "12", 1589 "patches_merged": "abc12",
1722 "bleeding_edge": "", 1590 "bleeding_edge": "",
1723 "bleeding_edge_git": "", 1591 "bleeding_edge_git": "",
1724 "version": "3.3.1.1", 1592 "version": "3.3.1.1",
1725 "chromium_revision": "", 1593 "chromium_revision": "",
1726 "branch": "3.3", 1594 "branch": "3.3",
1727 "review_link": "fake.com", 1595 "review_link": "fake.com",
1728 "date": "18:15", 1596 "date": "18:15",
1729 "chromium_branch": "", 1597 "chromium_branch": "",
1730 "revision_link": "https://code.google.com/p/v8/source/detail?r=234", 1598 "revision_link": "https://code.google.com/p/v8/source/detail?r=234",
1731 }, 1599 },
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 1731
1864 Review URL: https://codereview.chromium.org/83173002 1732 Review URL: https://codereview.chromium.org/83173002
1865 1733
1866 ------------------------------------------------------------------------""") 1734 ------------------------------------------------------------------------""")
1867 self.assertEquals( 1735 self.assertEquals(
1868 """Prepare push to trunk. Now working on version 3.23.11. 1736 """Prepare push to trunk. Now working on version 3.23.11.
1869 1737
1870 R=danno@chromium.org 1738 R=danno@chromium.org
1871 1739
1872 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1740 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/releases.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698