diff options
-rwxr-xr-x | git-deps | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -202,6 +202,9 @@ class DependencyDetector(object): return self.commits[rev] def find_dependencies(self, dependent_rev, recurse=None): + """Find all dependencies of the given revision, recursively traversing + the dependency tree if requested. + """ if recurse is None: recurse = self.options.recurse @@ -226,6 +229,10 @@ class DependencyDetector(object): self.notify_listeners('dependent_done', dependent, dependencies) def find_dependencies_with_parent(self, dependent, parent): + """Find all dependencies of the given revision caused by the given + parent commit. This will be called multiple times for merge + commits which have multiple parents. + """ self.logger.debug(" Finding dependencies of %s via parent %s" % (dependent.hex[:8], parent.hex[:8])) diff = self.repo.diff(parent, dependent, context_lines=self.options.context_lines) @@ -236,6 +243,12 @@ class DependencyDetector(object): self.blame_hunk(dependent, parent, path, hunk) def blame_hunk(self, dependent, parent, path, hunk): + """Run git blame on the parts of the hunk which exist in the older + commit in the diff. The commits generated by git blame are + the commits which the newer commit in the diff depends on, + because without the lines from those commits, the hunk would + not apply correctly. + """ first_line_num = hunk.old_start line_range_before = "-%d,%d" % (hunk.old_start, hunk.old_lines) line_range_after = "+%d,%d" % (hunk.new_start, hunk.new_lines) |