[release] Get tools main-branch ready
No-Try: true Bug: chromium:1222092 Change-Id: I9f662691f1cd1a221162052789a66ea99b98d371 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3135579 Auto-Submit: Michael Achenbach <machenbach@chromium.org> Reviewed-by: Almothana Athamneh <almuthanna@chromium.org> Commit-Queue: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/main@{#76647}
This commit is contained in:
parent
b8feade615
commit
0508f27705
@ -2,7 +2,13 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
def CheckChangeOnCommit(input_api, output_api):
|
||||
def _CommonChecks(input_api, output_api):
|
||||
tests = input_api.canned_checks.GetUnitTestsInDirectory(
|
||||
input_api, output_api, '.', files_to_check=['test_scripts.py$'])
|
||||
return input_api.RunTests(tests)
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
return _CommonChecks(input_api, output_api)
|
||||
|
||||
def CheckChangeOnCommit(input_api, output_api):
|
||||
return _CommonChecks(input_api, output_api)
|
||||
|
@ -23,7 +23,7 @@ class Preparation(Step):
|
||||
|
||||
self.CommonPrepare()
|
||||
self.PrepareBranch()
|
||||
self.GitCheckout("master")
|
||||
self.GitCheckout("main")
|
||||
self.vc.Pull()
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ import urllib2
|
||||
|
||||
# Constants to git repos.
|
||||
BASE_URL = "https://chromium.googlesource.com"
|
||||
DEPS_LOG = BASE_URL + "/chromium/src/+log/master/DEPS?format=JSON"
|
||||
DEPS_LOG = BASE_URL + "/chromium/src/+log/main/DEPS?format=JSON"
|
||||
|
||||
# Constants for retrieving v8 rolls.
|
||||
CRREV = "https://cr-rev.appspot.com/_ah/api/crrev/v1/commit/%s"
|
||||
|
@ -214,13 +214,13 @@ class VCInterface(object):
|
||||
def GetBranches(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def MasterBranch(self):
|
||||
def MainBranch(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def CandidateBranch(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def RemoteMasterBranch(self):
|
||||
def RemoteMainBranch(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def RemoteCandidateBranch(self):
|
||||
@ -258,14 +258,14 @@ class GitInterface(VCInterface):
|
||||
# Remove 'branch-heads/' prefix.
|
||||
return map(lambda s: s[13:], branches)
|
||||
|
||||
def MasterBranch(self):
|
||||
return "master"
|
||||
def MainBranch(self):
|
||||
return "main"
|
||||
|
||||
def CandidateBranch(self):
|
||||
return "candidates"
|
||||
|
||||
def RemoteMasterBranch(self):
|
||||
return "origin/master"
|
||||
def RemoteMainBranch(self):
|
||||
return "origin/main"
|
||||
|
||||
def RemoteCandidateBranch(self):
|
||||
return "origin/candidates"
|
||||
@ -275,7 +275,7 @@ class GitInterface(VCInterface):
|
||||
# want.
|
||||
if name.startswith('refs/'):
|
||||
return name
|
||||
if name in ["candidates", "master"]:
|
||||
if name in ["candidates", "main"]:
|
||||
return "refs/remotes/origin/%s" % name
|
||||
try:
|
||||
# Check if branch is in heads.
|
||||
@ -474,8 +474,8 @@ class Step(GitRecipesMixin):
|
||||
if not self.GitIsWorkdirClean(): # pragma: no cover
|
||||
self.Die("Workspace is not clean. Please commit or undo your changes.")
|
||||
|
||||
# Checkout master in case the script was left on a work branch.
|
||||
self.GitCheckout('origin/master')
|
||||
# Checkout main in case the script was left on a work branch.
|
||||
self.GitCheckout('origin/main')
|
||||
|
||||
# Fetch unfetched revisions.
|
||||
self.vc.Fetch()
|
||||
@ -485,7 +485,7 @@ class Step(GitRecipesMixin):
|
||||
self.DeleteBranch(self._config["BRANCHNAME"])
|
||||
|
||||
def CommonCleanup(self):
|
||||
self.GitCheckout('origin/master')
|
||||
self.GitCheckout('origin/main')
|
||||
self.GitDeleteBranch(self._config["BRANCHNAME"])
|
||||
|
||||
# Clean up all temporary files.
|
||||
@ -605,13 +605,13 @@ class Step(GitRecipesMixin):
|
||||
if match:
|
||||
# Legacy: In the old process there's one level of indirection. The
|
||||
# version is on the candidates branch and points to the real release
|
||||
# base on master through the commit message.
|
||||
# base on main through the commit message.
|
||||
return match.group("git_rev")
|
||||
match = PUSH_MSG_NEW_RE.match(title)
|
||||
if match:
|
||||
# This is a new-style v8 version branched from master. The commit
|
||||
# This is a new-style v8 version branched from main. The commit
|
||||
# "latest_hash" is the version-file change. Its parent is the release
|
||||
# base on master.
|
||||
# base on main.
|
||||
return self.GitLog(n=1, format="%H", git_hash="%s^" % latest_hash)
|
||||
|
||||
self.Die("Unknown latest release: %s" % latest_hash)
|
||||
|
@ -19,7 +19,7 @@ class Preparation(Step):
|
||||
|
||||
def RunStep(self):
|
||||
self.Git("fetch origin +refs/heads/*:refs/heads/*")
|
||||
self.GitCheckout("origin/master")
|
||||
self.GitCheckout("origin/main")
|
||||
self.DeleteBranch("work-branch")
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ class PrepareBranchRevision(Step):
|
||||
|
||||
def RunStep(self):
|
||||
self["push_hash"] = (self._options.revision or
|
||||
self.GitLog(n=1, format="%H", branch="origin/master"))
|
||||
self.GitLog(n=1, format="%H", branch="origin/main"))
|
||||
assert self["push_hash"]
|
||||
print("Release revision %s" % self["push_hash"])
|
||||
|
||||
@ -39,16 +39,16 @@ class IncrementVersion(Step):
|
||||
def RunStep(self):
|
||||
latest_version = self.GetLatestVersion()
|
||||
|
||||
# The version file on master can be used to bump up major/minor at
|
||||
# The version file on main can be used to bump up major/minor at
|
||||
# branch time.
|
||||
self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteMasterBranch())
|
||||
self.ReadAndPersistVersion("master_")
|
||||
master_version = self.ArrayToVersion("master_")
|
||||
self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteMainBranch())
|
||||
self.ReadAndPersistVersion("main_")
|
||||
main_version = self.ArrayToVersion("main_")
|
||||
|
||||
# Use the highest version from master or from tags to determine the new
|
||||
# Use the highest version from main or from tags to determine the new
|
||||
# version.
|
||||
authoritative_version = sorted(
|
||||
[master_version, latest_version], key=SortingKey)[1]
|
||||
[main_version, latest_version], key=SortingKey)[1]
|
||||
self.StoreVersion(authoritative_version, "authoritative_")
|
||||
|
||||
# Variables prefixed with 'new_' contain the new version numbers for the
|
||||
@ -74,7 +74,7 @@ class DetectLastRelease(Step):
|
||||
MESSAGE = "Detect commit ID of last release base."
|
||||
|
||||
def RunStep(self):
|
||||
self["last_push_master"] = self.GetLatestReleaseBase()
|
||||
self["last_push_main"] = self.GetLatestReleaseBase()
|
||||
|
||||
|
||||
class DeleteBranchRef(Step):
|
||||
@ -107,7 +107,7 @@ class MakeBranch(Step):
|
||||
MESSAGE = "Create the branch."
|
||||
|
||||
def RunStep(self):
|
||||
self.Git("reset --hard origin/master")
|
||||
self.Git("reset --hard origin/main")
|
||||
self.Git("new-branch work-branch --upstream origin/%s" % self["version"])
|
||||
self.GitCheckoutFile(VERSION_FILE, self["latest_version"])
|
||||
|
||||
@ -186,7 +186,7 @@ class CleanUp(Step):
|
||||
print("Congratulations, you have successfully created version %s."
|
||||
% self["version"])
|
||||
|
||||
self.GitCheckout("origin/master")
|
||||
self.GitCheckout("origin/main")
|
||||
self.DeleteBranch("work-branch")
|
||||
self.Git("gc")
|
||||
|
||||
|
@ -77,7 +77,7 @@ class SearchArchitecturePorts(Step):
|
||||
# Search for commits which matches the "Port XXX" pattern.
|
||||
git_hashes = self.GitLog(reverse=True, format="%H",
|
||||
grep="^[Pp]ort %s" % revision,
|
||||
branch=self.vc.RemoteMasterBranch())
|
||||
branch=self.vc.RemoteMainBranch())
|
||||
for git_hash in git_hashes.splitlines():
|
||||
revision_title = self.GitLog(n=1, format="%s", git_hash=git_hash)
|
||||
|
||||
@ -198,7 +198,7 @@ class CleanUp(Step):
|
||||
class MergeToBranch(ScriptsBase):
|
||||
def _Description(self):
|
||||
return ("Performs the necessary steps to merge revisions from "
|
||||
"master to release branches like 4.5. This script does not "
|
||||
"main to release branches like 4.5. This script does not "
|
||||
"version the commit. See http://goo.gl/9ke2Vw for more "
|
||||
"information.")
|
||||
|
||||
|
@ -30,25 +30,25 @@ def describe_commit(git_working_dir, hash_to_search, one_line=False):
|
||||
|
||||
def get_followup_commits(git_working_dir, hash_to_search):
|
||||
cmd = ['log', '--grep=' + hash_to_search, GIT_OPTION_HASH_ONLY,
|
||||
'remotes/origin/master'];
|
||||
'remotes/origin/main'];
|
||||
return git_execute(git_working_dir, cmd).strip().splitlines()
|
||||
|
||||
def get_merge_commits(git_working_dir, hash_to_search):
|
||||
merges = get_related_commits_not_on_master(git_working_dir, hash_to_search)
|
||||
false_merges = get_related_commits_not_on_master(
|
||||
merges = get_related_commits_not_on_main(git_working_dir, hash_to_search)
|
||||
false_merges = get_related_commits_not_on_main(
|
||||
git_working_dir, 'Cr-Branched-From: ' + hash_to_search)
|
||||
false_merges = set(false_merges)
|
||||
return ([merge_commit for merge_commit in merges
|
||||
if merge_commit not in false_merges])
|
||||
|
||||
def get_related_commits_not_on_master(git_working_dir, grep_command):
|
||||
def get_related_commits_not_on_main(git_working_dir, grep_command):
|
||||
commits = git_execute(git_working_dir, ['log',
|
||||
'--all',
|
||||
'--grep=' + grep_command,
|
||||
GIT_OPTION_ONELINE,
|
||||
'--decorate',
|
||||
'--not',
|
||||
'remotes/origin/master',
|
||||
'remotes/origin/main',
|
||||
GIT_OPTION_HASH_ONLY])
|
||||
return commits.splitlines()
|
||||
|
||||
|
@ -78,7 +78,7 @@ class SearchArchitecturePorts(Step):
|
||||
# Search for commits which matches the "Port XXX" pattern.
|
||||
git_hashes = self.GitLog(reverse=True, format="%H",
|
||||
grep="Port %s" % revision,
|
||||
branch=self.vc.RemoteMasterBranch())
|
||||
branch=self.vc.RemoteMainBranch())
|
||||
for git_hash in git_hashes.splitlines():
|
||||
revision_title = self.GitLog(n=1, format="%s", git_hash=git_hash)
|
||||
|
||||
@ -226,7 +226,7 @@ class CleanUp(Step):
|
||||
class RollMerge(ScriptsBase):
|
||||
def _Description(self):
|
||||
return ("Performs the necessary steps to merge revisions from "
|
||||
"master to other branches, including candidates and roll branches.")
|
||||
"main to other branches, including candidates and roll branches.")
|
||||
|
||||
def _PrepareOptions(self, parser):
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
|
@ -200,7 +200,7 @@ if __name__ == "__main__": # pragma: no cover
|
||||
"This tool analyzes the commit range between <of> and <until>. "
|
||||
"It finds commits which belong together e.g. Implement/Revert pairs and "
|
||||
"Implement/Port/Revert triples. All supplied hashes need to be "
|
||||
"from the same branch e.g. master.")
|
||||
"from the same branch e.g. main.")
|
||||
parser.add_argument("-g", "--git-dir", required=False, default=".",
|
||||
help="The path to your git working directory.")
|
||||
parser.add_argument("--verbose", action="store_true",
|
||||
|
@ -31,7 +31,7 @@ class TestMergeInfo(unittest.TestCase):
|
||||
return output
|
||||
|
||||
def _update_origin(self):
|
||||
# Fetch from origin to get/update the origin/master branch
|
||||
# Fetch from origin to get/update the origin/main branch
|
||||
self._execute_git(['fetch', 'origin'])
|
||||
|
||||
def setUp(self):
|
||||
@ -54,10 +54,10 @@ class TestMergeInfo(unittest.TestCase):
|
||||
|
||||
def _assert_correct_standard_result(
|
||||
self, result, all_commits, hash_of_first_commit):
|
||||
self.assertEqual(len(result), 1, "Master commit not found")
|
||||
self.assertEqual(len(result), 1, "Main commit not found")
|
||||
self.assertTrue(
|
||||
result.get(hash_of_first_commit),
|
||||
"Master commit is wrong")
|
||||
"Main commit is wrong")
|
||||
|
||||
self.assertEqual(
|
||||
len(result[hash_of_first_commit]),
|
||||
@ -124,7 +124,7 @@ class TestMergeInfo(unittest.TestCase):
|
||||
|
||||
def testSearchMerges(self):
|
||||
self._execute_git(['branch', 'test'])
|
||||
self._execute_git(['checkout', 'master'])
|
||||
self._execute_git(['checkout', 'main'])
|
||||
message = 'real initial commit'
|
||||
self._make_empty_commit(message)
|
||||
commits = self._get_commits()
|
||||
@ -142,7 +142,7 @@ class TestMergeInfo(unittest.TestCase):
|
||||
message = 'Cr-Branched-From: ' + hash_of_first_commit
|
||||
hash_of_ignored = self._make_empty_commit(message)
|
||||
|
||||
self._execute_git(['checkout', 'master'])
|
||||
self._execute_git(['checkout', 'main'])
|
||||
|
||||
followups = mergeinfo.get_followup_commits(
|
||||
self.base_dir,
|
||||
|
@ -300,7 +300,7 @@ class ScriptTest(unittest.TestCase):
|
||||
def testCommonPrepareDefault(self):
|
||||
self.Expect([
|
||||
Cmd("git status -s -uno", ""),
|
||||
Cmd("git checkout -f origin/master", ""),
|
||||
Cmd("git checkout -f origin/main", ""),
|
||||
Cmd("git fetch", ""),
|
||||
Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]),
|
||||
RL("Y"),
|
||||
@ -312,7 +312,7 @@ class ScriptTest(unittest.TestCase):
|
||||
def testCommonPrepareNoConfirm(self):
|
||||
self.Expect([
|
||||
Cmd("git status -s -uno", ""),
|
||||
Cmd("git checkout -f origin/master", ""),
|
||||
Cmd("git checkout -f origin/main", ""),
|
||||
Cmd("git fetch", ""),
|
||||
Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]),
|
||||
RL("n"),
|
||||
@ -323,7 +323,7 @@ class ScriptTest(unittest.TestCase):
|
||||
def testCommonPrepareDeleteBranchFailure(self):
|
||||
self.Expect([
|
||||
Cmd("git status -s -uno", ""),
|
||||
Cmd("git checkout -f origin/master", ""),
|
||||
Cmd("git checkout -f origin/main", ""),
|
||||
Cmd("git fetch", ""),
|
||||
Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]),
|
||||
RL("Y"),
|
||||
@ -395,13 +395,13 @@ class ScriptTest(unittest.TestCase):
|
||||
test_tag
|
||||
"""
|
||||
|
||||
# Version as tag: 3.22.4.0. Version on master: 3.22.6.
|
||||
# Version as tag: 3.22.4.0. Version on main: 3.22.6.
|
||||
# Make sure that the latest version is 3.22.6.0.
|
||||
def testIncrementVersion(self):
|
||||
self.Expect([
|
||||
Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
|
||||
Cmd("git tag", self.TAGS),
|
||||
Cmd("git checkout -f origin/master -- include/v8-version.h",
|
||||
Cmd("git checkout -f origin/main -- include/v8-version.h",
|
||||
"", cb=lambda: self.WriteFakeVersionFile(3, 22, 6)),
|
||||
])
|
||||
|
||||
@ -430,7 +430,7 @@ test_tag
|
||||
def testCreateRelease(self):
|
||||
TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
|
||||
|
||||
# The version file on master has build level 5.
|
||||
# The version file on main has build level 5.
|
||||
self.WriteFakeVersionFile(build=5)
|
||||
|
||||
commit_msg = """Version 3.22.5"""
|
||||
@ -449,18 +449,18 @@ test_tag
|
||||
|
||||
expectations = [
|
||||
Cmd("git fetch origin +refs/heads/*:refs/heads/*", ""),
|
||||
Cmd("git checkout -f origin/master", "", cb=self.WriteFakeWatchlistsFile),
|
||||
Cmd("git checkout -f origin/main", "", cb=self.WriteFakeWatchlistsFile),
|
||||
Cmd("git branch", ""),
|
||||
Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
|
||||
Cmd("git tag", self.TAGS),
|
||||
Cmd("git checkout -f origin/master -- include/v8-version.h",
|
||||
Cmd("git checkout -f origin/main -- include/v8-version.h",
|
||||
"", cb=self.WriteFakeVersionFile),
|
||||
Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"),
|
||||
Cmd("git log -1 --format=%s release_hash", "Version 3.22.4\n"),
|
||||
Cmd("git log -1 --format=%H release_hash^", "abc3\n"),
|
||||
Cmd("git log --format=%H abc3..push_hash", "rev1\n"),
|
||||
Cmd("git push origin push_hash:refs/heads/3.22.5", ""),
|
||||
Cmd("git reset --hard origin/master", ""),
|
||||
Cmd("git reset --hard origin/main", ""),
|
||||
Cmd("git new-branch work-branch --upstream origin/3.22.5", ""),
|
||||
Cmd("git checkout -f 3.22.4 -- include/v8-version.h", "",
|
||||
cb=self.WriteFakeVersionFile),
|
||||
@ -475,8 +475,8 @@ test_tag
|
||||
"\"Version 3.22.5\" origin/3.22.5", "hsh_to_tag"),
|
||||
Cmd("git tag 3.22.5 hsh_to_tag", ""),
|
||||
Cmd("git push origin refs/tags/3.22.5:refs/tags/3.22.5", ""),
|
||||
Cmd("git checkout -f origin/master", ""),
|
||||
Cmd("git branch", "* master\n work-branch\n"),
|
||||
Cmd("git checkout -f origin/main", ""),
|
||||
Cmd("git branch", "* main\n work-branch\n"),
|
||||
Cmd("git branch -D work-branch", ""),
|
||||
Cmd("git gc", ""),
|
||||
]
|
||||
@ -488,7 +488,7 @@ test_tag
|
||||
CreateRelease(TEST_CONFIG, self).Run(args)
|
||||
|
||||
# Note: The version file is on build number 5 again in the end of this test
|
||||
# since the git command that merges to master is mocked out.
|
||||
# since the git command that merges to main is mocked out.
|
||||
|
||||
# Check for correct content of the WATCHLISTS file
|
||||
|
||||
@ -718,21 +718,21 @@ BUG=123,234,345,456,567,v8:123
|
||||
|
||||
self.Expect([
|
||||
Cmd("git status -s -uno", ""),
|
||||
Cmd("git checkout -f origin/master", ""),
|
||||
Cmd("git checkout -f origin/main", ""),
|
||||
Cmd("git fetch", ""),
|
||||
Cmd("git branch", " branch1\n* branch2\n"),
|
||||
Cmd("git new-branch %s --upstream refs/remotes/origin/candidates" %
|
||||
TEST_CONFIG["BRANCHNAME"], ""),
|
||||
Cmd(("git log --format=%H --grep=\"Port ab12345\" "
|
||||
"--reverse origin/master"),
|
||||
"--reverse origin/main"),
|
||||
"ab45678\nab23456"),
|
||||
Cmd("git log -1 --format=%s ab45678", "Title1"),
|
||||
Cmd("git log -1 --format=%s ab23456", "Title2"),
|
||||
Cmd(("git log --format=%H --grep=\"Port ab23456\" "
|
||||
"--reverse origin/master"),
|
||||
"--reverse origin/main"),
|
||||
""),
|
||||
Cmd(("git log --format=%H --grep=\"Port ab34567\" "
|
||||
"--reverse origin/master"),
|
||||
"--reverse origin/main"),
|
||||
"ab56789"),
|
||||
Cmd("git log -1 --format=%s ab56789", "Title3"),
|
||||
RL("Y"), # Automatically add corresponding ports (ab34567, ab56789)?
|
||||
@ -792,7 +792,7 @@ BUG=123,234,345,456,567,v8:123
|
||||
"hsh_to_tag"),
|
||||
Cmd("git tag 3.22.5.1 hsh_to_tag", ""),
|
||||
Cmd("git push origin refs/tags/3.22.5.1:refs/tags/3.22.5.1", ""),
|
||||
Cmd("git checkout -f origin/master", ""),
|
||||
Cmd("git checkout -f origin/main", ""),
|
||||
Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
|
||||
])
|
||||
|
||||
@ -855,21 +855,21 @@ NOTREECHECKS=true
|
||||
|
||||
self.Expect([
|
||||
Cmd("git status -s -uno", ""),
|
||||
Cmd("git checkout -f origin/master", ""),
|
||||
Cmd("git checkout -f origin/main", ""),
|
||||
Cmd("git fetch", ""),
|
||||
Cmd("git branch", " branch1\n* branch2\n"),
|
||||
Cmd("git new-branch %s --upstream refs/remotes/origin/candidates" %
|
||||
TEST_CONFIG["BRANCHNAME"], ""),
|
||||
Cmd(("git log --format=%H --grep=\"^[Pp]ort ab12345\" "
|
||||
"--reverse origin/master"),
|
||||
"--reverse origin/main"),
|
||||
"ab45678\nab23456"),
|
||||
Cmd("git log -1 --format=%s ab45678", "Title1"),
|
||||
Cmd("git log -1 --format=%s ab23456", "Title2"),
|
||||
Cmd(("git log --format=%H --grep=\"^[Pp]ort ab23456\" "
|
||||
"--reverse origin/master"),
|
||||
"--reverse origin/main"),
|
||||
""),
|
||||
Cmd(("git log --format=%H --grep=\"^[Pp]ort ab34567\" "
|
||||
"--reverse origin/master"),
|
||||
"--reverse origin/main"),
|
||||
"ab56789"),
|
||||
Cmd("git log -1 --format=%s ab56789", "Title3"),
|
||||
RL("Y"), # Automatically add corresponding ports (ab34567, ab56789)?
|
||||
@ -916,7 +916,7 @@ NOTREECHECKS=true
|
||||
Cmd("git cl presubmit", "Presubmit successfull\n"),
|
||||
Cmd("git cl land -f --bypass-hooks", "Closing issue\n",
|
||||
cb=VerifyLand),
|
||||
Cmd("git checkout -f origin/master", ""),
|
||||
Cmd("git checkout -f origin/main", ""),
|
||||
Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
|
||||
])
|
||||
|
||||
|
@ -43,7 +43,7 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243005
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#28059}"""
|
||||
Cr-Commit-Position: refs/heads/main@{#28059}"""
|
||||
self._make_empty_commit(message)
|
||||
|
||||
message = """[crankshaft] Do some stuff
|
||||
@ -52,7 +52,7 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243007
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#28030}"""
|
||||
Cr-Commit-Position: refs/heads/main@{#28030}"""
|
||||
|
||||
self._make_empty_commit(message)
|
||||
|
||||
@ -62,10 +62,10 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
|
||||
def _assert_correct_standard_result(
|
||||
self, result, all_commits, hash_of_first_commit):
|
||||
self.assertEqual(len(result), 1, "Master commit not found")
|
||||
self.assertEqual(len(result), 1, "Main commit not found")
|
||||
self.assertTrue(
|
||||
result.get(hash_of_first_commit),
|
||||
"Master commit is wrong")
|
||||
"Main commit is wrong")
|
||||
|
||||
self.assertEqual(
|
||||
len(result[hash_of_first_commit]),
|
||||
@ -86,12 +86,12 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
|
||||
def testSearchByCommitPosition(self):
|
||||
message = """Revert of some stuff.
|
||||
> Cr-Commit-Position: refs/heads/master@{#28059}
|
||||
> Cr-Commit-Position: refs/heads/main@{#28059}
|
||||
R=mstarzinger@chromium.org
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243005
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#28088}"""
|
||||
Cr-Commit-Position: refs/heads/main@{#28088}"""
|
||||
|
||||
self._make_empty_commit(message)
|
||||
|
||||
@ -106,12 +106,12 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
def testSearchByTitle(self):
|
||||
message = """Revert of some stuff.
|
||||
> [turbofan] Sanitize language mode for javascript operators.
|
||||
> Cr-Commit-Position: refs/heads/master@{#289}
|
||||
> Cr-Commit-Position: refs/heads/main@{#289}
|
||||
R=mstarzinger@chromium.org
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243005
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#28088}"""
|
||||
Cr-Commit-Position: refs/heads/main@{#28088}"""
|
||||
|
||||
self._make_empty_commit(message)
|
||||
|
||||
@ -134,7 +134,7 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243005
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#28088}"""
|
||||
Cr-Commit-Position: refs/heads/main@{#28088}"""
|
||||
|
||||
self._make_empty_commit(message)
|
||||
|
||||
@ -162,16 +162,16 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243005
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#28088}"""
|
||||
Cr-Commit-Position: refs/heads/main@{#28088}"""
|
||||
self._make_empty_commit(message)
|
||||
|
||||
# Related commits happen before and after separator so it is a hit
|
||||
commit_pos_of_master = "27088"
|
||||
message = """Implement awesome feature: Master commit
|
||||
commit_pos_of_main = "27088"
|
||||
message = """Implement awesome feature: Main commit
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243235
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#""" + commit_pos_of_master + "}"
|
||||
Cr-Commit-Position: refs/heads/main@{#""" + commit_pos_of_main + "}"
|
||||
self._make_empty_commit(message)
|
||||
|
||||
# Separator commit
|
||||
@ -179,7 +179,7 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243456
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#28173}"""
|
||||
Cr-Commit-Position: refs/heads/main@{#28173}"""
|
||||
self._make_empty_commit(message)
|
||||
|
||||
# Filler commit
|
||||
@ -187,11 +187,11 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
self._make_empty_commit(message)
|
||||
|
||||
# Related commit after separator: a hit
|
||||
message = "Patch r" + commit_pos_of_master +""" done
|
||||
message = "Patch r" + commit_pos_of_main +""" done
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243235
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#29567}"""
|
||||
Cr-Commit-Position: refs/heads/main@{#29567}"""
|
||||
self._make_empty_commit(message)
|
||||
|
||||
#Fetch again for an update
|
||||
@ -221,12 +221,12 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
def testPrettyPrint(self):
|
||||
message = """Revert of some stuff.
|
||||
> [turbofan] Sanitize language mode for javascript operators.
|
||||
> Cr-Commit-Position: refs/heads/master@{#289}
|
||||
> Cr-Commit-Position: refs/heads/main@{#289}
|
||||
R=mstarzinger@chromium.org
|
||||
|
||||
Review URL: https://codereview.chromium.org/1084243005
|
||||
|
||||
Cr-Commit-Position: refs/heads/master@{#28088}"""
|
||||
Cr-Commit-Position: refs/heads/main@{#28088}"""
|
||||
|
||||
self._make_empty_commit(message)
|
||||
|
||||
@ -248,7 +248,7 @@ class TestSearchRelatedCommits(unittest.TestCase):
|
||||
output.append(current_line)
|
||||
|
||||
self.assertIs(len(output), 2, "Not exactly two entries written")
|
||||
self.assertTrue(output[0].startswith("+"), "Master entry not marked with +")
|
||||
self.assertTrue(output[0].startswith("+"), "Main entry not marked with +")
|
||||
self.assertTrue(output[1].startswith("| "), "Child entry not marked with |")
|
||||
|
||||
def testNothingFound(self):
|
||||
|
Loading…
Reference in New Issue
Block a user