Lines Matching +full:ls +full:- +full:files
3 # Use of this source code is governed by a BSD-style license that can be
18 "--branch", "-b", default="origin/master", type=str,
19 help="Git tree-ish where to start searching for commits, "
22 "--limit", "-l", default=500, type=int,
25 "--verbose", "-v", default=False, action="store_true",
31 files = {}
35 if line.startswith("diff --git "):
36 # diff --git a/src/objects.cc b/src/objects.cc
44 if old_hash.startswith("0000000"): continue # Ignore new files.
45 files[next_file] = old_hash
46 return files
50 cmd = ["git", "log", "-1", "--format=%H", treeish]
54 def CountMatchingFiles(commit, files): argument
56 # Calling out to git once and parsing the result Python-side is faster
57 # than calling 'git ls-tree' for every file.
58 cmd = ["git", "ls-tree", "-r", commit] + [f for f in files]
63 expected_hash = files[filename]
68 def FindFirstMatchingCommit(start, files, limit, verbose): argument
70 num_files = len(files)
71 if verbose: print(">>> Found %d files modified by patch." % num_files)
73 matched_files = CountMatchingFiles(commit, files)
74 if verbose: print("Commit %s matched %d files" % (commit, matched_files))
79 "Try running 'git fetch', specifying the correct --branch, "
80 "and/or setting a higher --limit.")
86 files = FindFilesInPatch(args.patch_file) variable
87 commit = FindFirstMatchingCommit(args.branch, files, args.limit, args.verbose)
90 print(subprocess.check_output(["git", "log", "-1", commit]))