MCPcopy Index your code
hub / github.com/python/cpython / get_base_branch

Function get_base_branch

Tools/patchcheck/patchcheck.py:120–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118@status("Getting base branch for PR",
119 info=lambda x: x if x is not None else "not a PR branch")
120def get_base_branch():
121 if not os.path.exists(os.path.join(SRCDIR, '.git')):
122 # Not a git checkout, so there's no base branch
123 return None
124 upstream_remote = get_git_upstream_remote()
125 version = sys.version_info
126 if version.releaselevel == 'alpha':
127 base_branch = get_git_remote_default_branch(upstream_remote)
128 else:
129 base_branch = "{0.major}.{0.minor}".format(version)
130 this_branch = get_git_branch()
131 if this_branch is None or this_branch == base_branch:
132 # Not on a git PR branch, so there's no base branch
133 return None
134 return upstream_remote + "/" + base_branch
135
136
137@status("Getting the list of files that have been added/changed",

Callers 1

mainFunction · 0.85

Calls 6

get_git_upstream_remoteFunction · 0.85
get_git_branchFunction · 0.85
existsMethod · 0.45
joinMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…