diff options
author | Adam Spiers <git@adamspiers.org> | 2013-11-16 21:58:30 -0500 |
---|---|---|
committer | Adam Spiers <git@adamspiers.org> | 2015-01-05 16:57:08 +0000 |
commit | 7835c7b3aff6c9662e39e1c4b0854725c59e8fef (patch) | |
tree | b63ee0d69dc1fb025299fb2813c446449d3a510f | |
parent | 824f84cd594254d0c87f330b855153fc5ffe5ad3 (diff) | |
download | git-deps-7835c7b3aff6c9662e39e1c4b0854725c59e8fef.tar.gz |
add some docstrings
-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) |