Skip to content

Commit

Permalink
Merge pull request #191 from k----n/patch-1
Browse files Browse the repository at this point in the history
Changed documentation for commit and modifiedfile object
  • Loading branch information
ishepard authored Sep 29, 2021
2 parents 3a04965 + 3a35605 commit 037eff6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/commit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ A Commit object has all the information of a Git commit, and much more. More spe
* **branches** *(List[str])*: List of branches that contain this commit
* **in_main_branch** *(Bool)*: True if the commit is in the main branch
* **merge** *(Bool)*: True if the commit is a merge commit
* **modifications** *(List[Modifications])*: list of modified files in the commit (see :ref:`modifications_toplevel`)
* **modified_files** *(List[ModifiedFile])*: list of modified files in the commit (see :ref:`modifications_toplevel`)
* **parents** *(List[str])*: list of the commit parents
* **project_name** *(str)*: project name
* **project_path** *(str)*: project path
Expand Down
6 changes: 3 additions & 3 deletions docs/modifiedfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ You can get the list of modified files, as well as their diffs and current sourc
* **change_type**: type of the change: can be Added, Deleted, Modified, or Renamed.
* **diff**: diff of the file as Git presents it (e.g., starting with @@ xx,xx @@).
* **diff_parsed**: diff parsed in a dictionary containing the added and deleted lines. The dictionary has 2 keys: “added” and “deleted”, each containing a list of Tuple (int, str) corresponding to (number of line in the file, actual line).
* **added**: number of lines added
* **removed**: number of lines removed
* **added_lines**: number of lines added
* **deleted_lines**: number of lines removed
* **source_code**: source code of the file (can be _None_ if the file is deleted or only renamed)
* **source_code_before**: source code of the file before the change (can be _None_ if the file is added or only renamed)
* **methods**: list of methods of the file. The list might be empty if the programming language is not supported or if the file is not a source code file. These are the methods **after** the change.
Expand All @@ -29,7 +29,7 @@ You can get the list of modified files, as well as their diffs and current sourc
For example::

for commit in Repository('path/to/the/repo').traverse_commits():
for m in commit.modifications:
for m in commit.modified_files:
print(
"Author {}".format(commit.author.name),
" modified {}".format(m.filename),
Expand Down

0 comments on commit 037eff6

Please sign in to comment.