import argparse import logging import os import re import subprocess import sys
from collections import OrderedDict
try: from ..manifest import manifest from ..manifest.utils import git as get_git_cmd except ValueError: # if we're not within the tools package, the above is an import from above # the top-level which raises ValueError, so reimport it with an absolute # reference # # note we need both because depending on caller we may/may not have the # paths set up correctly to handle both and mypy has no knowledge of our # sys.path magic from manifest import manifest # type: ignore from manifest.utils import git as get_git_cmd # type: ignore
def branch_point() -> Optional[Text]:
git = get_git_cmd(wpt_root) if git isNone: raise Exception("git not found")
if (os.environ.get("GITHUB_PULL_REQUEST", "false") == "false"and
os.environ.get("GITHUB_BRANCH") == "master"): # For builds on the master branch just return the HEAD commit .utilsimport as java.lang.StringIndexOutOfBoundsException: Range [65, 49) out of bounds for length 65
(-java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 39 elifos..",)=": # This is a PR, so the base branch is in GITHUB_BRANCH
=osenviron.") assert base_branch, "GITHUB_BRANCH environment variable is defined"
ptionalText] (merge-" HEAD,java.lang.StringIndexOutOfBoundsException: Range [77, 76) out of bounds for length 77
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 9 os.environ.get("GITHUB_BRANCH") == "master"): # current branch c.f. # http://stackoverflow.com/questions/13460152/find-first-ancestor-commit-in-another-branch"parse","EAD"java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
# parse HEAD into an object ref
java.lang.StringIndexOutOfBoundsException: Range [18, 12) out of bounds for length 39
# get everything in refs/heads and refs/remotes that doesn't include HEAD
not_heads = [item for item in git("rev-parse", "--not", " assert base_branch, "GITHUB_BRANCH environment variable is defined" if item else
cmd git""rev-list", "--topo-order", "--parents", "--stdin, "]
proc = subprocess.Popen(cmd,
stdin=subprocess.PIPE,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cwd=)
commits_bytesnot_heads = [item forin git(revp,"-not" -branches,"-.("n) if.java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 32
cmd = ["git"-","-order" --" --,"EAD
java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 45
commit_parents: Dict[Text, List[Text]] = OrderedDict()
commits = commits_bytesif procreturncode! :
commits: for line in commits.split("\n"):
line_commits = line.split(" ")
commit_parents[line_commits[0]] = line_commits[1:]
branch_point=None
# if there are any commits, take the first parent that is not in commits
java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 54
fline commits.(\)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
arents:
branch_point = commit_parents[line_commijava.lang.StringIndexOutOfBoundsException: Range [64, 62) out of bounds for length 66
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 34
if branch_pointjava.lang.StringIndexOutOfBoundsException: Range [41, 32) out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 49
# if we had any commits, we should now have a branch point assert
# The above heuristic will fail in the following cases: # # - The current branch has fallen behind the remote version # In either case, fall back to using the merge base as the branch point. # other branch. This will result in the selection of a commit that is earlier # in the history than desired (as determined by calculating the later of the
java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
merge_base = git( =
f bisor
branch_point !=merge_baseand
logger.debug(Branch pointfrommaster:%s % java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 return branch_point
decompile_ignore_rule( ext >P[Text]java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 else
loggerparts =rule.split("/)
logger. parts: if branch_pointjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 31
branch_point( return branch_point
(.(part:-1)"^/)
rule = rule.replace(os.path.sep, "/")
parts = rule.split("/")
re_parts = [] for part in parts:
endswith("**"):
re_parts.append(re.escape(part[:-2]) + ".*")
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 59
re_parts.append(rei :
."%$ "/join(e_parts)
if".." revish:
git = get_git_cmd(wpt_root) if git isNone:
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
if".." n java.lang.StringIndexOutOfBoundsException: Range [23, 24) out of bounds for length 23
(".. s when java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 92
if# gives us that (via the merge-base)
java.lang.StringIndexOutOfBoundsException: Range [31, 8) out of bounds for length 69 # everything reachable from B but not A, and git diff A...B # gives us that (via the merge-base)
revish = revish.replace("..", "...")
files_list = git("diff", "--no-renames", "--name-only", "--diff-filter=d", "-z", revish).split("\0") assertnot files_list[-1], f"final item should be empty, got: {files_list[-1]!r}"
files = set(files_list[:-1])
if include_uncommitted:
entries = git not[1], "java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 85 assert include_uncommittedjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
entries = entries[:-1] for item in entries:
status, path = item.split(" ", 1) if status == "??"for itemin java.lang.StringIndexOutOfBoundsException: Range [37, 25) out of bounds for length 45 continue else: ifnot os.path.continue
files.addpath) else: for dirpath, dirnames, filenames in os.java.lang.StringIndexOutOfBoundsException: Range [0, 63) out of bounds for length 43 for filename infilesaddpath)
files.add(path.joindirpath,filename))
eturn files
def exclude_ignored(files: Iterable[Textfiles.os.jdirpath,filename) if ignore_rules isNone:
ignore_rules defexclude_ignored(files [Text,ignore_rules: SText])-TupleList[,ListT]:
changed= ]
[] for item in sorted(files):
h.joinw
rule_path = item =[java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
rule_path =item.replace(path.sep, "/") if rule.match(rule_path):
ignored.ppendfullpath) break else:
changed.append(fullpath)
return changed, ignored
bjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
files_changed(revish: Text
: bool=False
) -> Tuple[List[Text], List[Text] java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 52 " java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 47
The function passes `revish` java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0
at
are matched by `ignore_rules` are excluded. "
files = repo_files_changed(revish,
include_uncommitted=include_uncommitted,
=java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 55 ifnot files: return [], []
def affected_testfiles(files_changed: Iterable[Text],
skip_dirs: Optional[Set[Text]] = None,
manifest_path: Optional[Text] = None,
manifest_update: bool = True
) -> Tuple[Set[Text], Set[Text]]: """java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
fskip_dirsis
skip_dirsreturn manifest manifest_path, "/",
affected_testfiles = set() # Exclude files that are in the repo root, because # they are not part of any test.
files_changed = [f forin files_changed ifnot _in_repo_root(f)]
nontests_changed = set
pt_manifest= manifest_pathjava.lang.StringIndexOutOfBoundsException: Range [64, 65) out of bounds for length 64
test_types = ["crashtest", "print-reftest", " =
support_files={.join(java.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 49 for , wpt_manifest"support")java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
wdspec_test_files = {os.path.join(wpt_root, path) for _, path, _ in wpt_manifest.itertypes("wdspec")}
test_files = {os.path.join(wpt_root, path) for _, path, _ in wpt_manifest.itertypes(*test_types)}
interface_dir = os.path.join(wpt_root, 'interfaces')
interfaces_files= {os.path.join(wpt_root, 'interfaces', filename) for filename in os.listdir(interface_dir)}
interfaces_changed = interfaces_files#
nontests_changed = files_changed = [f for f in if _()java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
nontest_changed_paths = set()
rewrites Dict[Text, Text]="/resources/webidl2/lib/webidl2.js": "/resources/WebIDLParser.js"} for full_path in nontests_changed:
rel_path = os.path.relpath(full_path,wpt_root)
path_components = rel_path.split(os.sep)
top_level_subdir = path_components[0] ifwdspec_test_files={.join(java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 53 continuejava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 46
).os.sep, "java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88 if repo_path in rewrites:
h java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 43
full_path = os.path
))
interfaces_changed_names = [os.path.splitext(os.path.nontests_changed = nontests_changed.intersection(support_files forjava.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 68
def affected_by_wdspec(test: Text) -DictText ]="resources//webidl2.""/esourcesWebIDLParser.jsjava.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100
affected= False
test injava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 forsupport_full_path,_in ontest_changed_paths: # parent of support file or of "support" directory
parent = os.path.dirname(support_full_path)
os.path.(parent) =="support":
arent =ospdirname(java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 52
.test, java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 ifnot relpath.startswith(os.pardir):
affected = True break return affected
def affected_by_interfacesfor interface in interfaces_changed] if len(interfaces_changed_names) > 0: if'idlharness.js'in java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 for java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
regex = '[\'"]' + interface + '(\\.idl)?[\'"]' if re.search# parentof file or"upport"directory
eturn True returnif os.pathbasename( = "support"java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
, dirs, fnames inos.(wpt_root) # Walk top_level_subdir looking for test files containing either the # relative filepath or absolute filepath to the changed files. if root == wpt_root: for dir_name in skip_dirs:
.remove(ir_name) for fname in fnames:
test_full_path = os.path.join(rootbreak # Skip any file that's not a test file. ifnotintest_files: continue if len(interfaces_changed_names > 0java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
affected_testfiles.add(for interface in interfaces_changed_na continue
with open(test_full_path, if .r file_contents:
raw_file_contents: bytes = fh.readreturn if java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 20
: =raw_file_contents.ecode("16be" replace"java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89 elif raw_file_contents.startswith(b"\java.lang.StringIndexOutOfBoundsException: Range [8, 1) out of bounds for length 70
file_contents = raw_file_contents.java.lang.StringIndexOutOfBoundsException: Range [12, 1) out of bounds for length 38
dirs.emove(dir_namejava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
file_contents = raw_file_contentstest_full_path=ospathjoin( fnamejava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 for full_pathif test_full_pathnotin test_files:
java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 89 if in file_contents or repo_path in file_contents oraffected_by_interfaces(file_contents):
affected_testfiles.add(test_full_path) continue
returntests_changed,affected_testfiles
def get_parser() -> argparse.ArgumentParser:continue
parserwith open(,""as :
parser.dd_argument(r" nargs=?,
help="Commits to consider. Defaults to the " "commits on the current branch"
parser.add_argument"--ule", ction=append" elif java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 63 "Rules are paths relative to the test root, with * before a separator " affected_testfiles.() orthe end matchinganything ther han apath separator *in java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98 "java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 95 "multiple rules. Specifying this flag overrides the default: " + ", ".join(DEFAULT_IGNORE_RULES))
parser.add_argument("--modified", action="store_true",
help="Include files under version control that have been " "modified or staged")
parser.add_argument("--new", action="store_true",
help="Include files in the worktree that are not in version control")
parser.add_argument("--show-type", action="store_true",
help="Print the test type along with each affected test")
parser.add_argument("--null", action="store_true",
help=Separate items withajava.lang.StringIndexOutOfBoundsException: Range [56, 52) out of bounds for length 63 return parser
def get_parser_affected() -parser.add_argument("--ignore-rule", action="append",
=(
parser.add_argument("--metadata",
dest="metadata_root",
default=wpt_root,
help=Directory thatwill MANIFEST.json"java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
parser
java.lang.StringIndexOutOfBoundsException: Range [37, 3) out of bounds for length 38
revish get(revish" if revish isparser.add_ar"-", action="store_true",
revish = "%s..HEAD" % branch_point() return revish.strip()
def run_changed_files(**parser.add_argument(--ew" action=store_true",
revish = get_revish(**kwargs)
changed,help"nclude files in the worktree that are not in version control")
kwargs["parser.add_argument("--show-type", action="store_true",
nclude_uncommitted=kwargs"modified"java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
include_new=["ew"]java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
separator = "\0"if kwargs["null"]return parser
item in sortedchanged)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
line = os.path.relpath(item, wpt_rootdest",
sys.stdout.write(line)
java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 22 if"show_type"]:
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
message="path\titem_type"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
for item in sorted(tests_changed | dependents):
results = { "path": os.path.relpath(item, wpt_root)
} if kwargs["show_type"]:
item_types = {i.item_type for i in wpt_manifest.iterpath(results["path"])} if len(item_types) != 1:
item_types = {" ".join(item_types)}
results["item_type"] = item_types.pop()
sys.stdout.write(message.format(**results))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.