Skip to content

Commit a1dfd4a

Browse files
committed
convert from --all flag to all=True
1 parent e4bbc7a commit a1dfd4a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎test/test_quick_doc.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ def test_cloned_repo_object(self, local_dir):
5757

5858
# [5-test_cloned_repo_object]
5959
file = 'dir1/file2.txt' # relative path from git root
60-
repo.iter_commits('--all', max_count=100, paths=file)
60+
repo.iter_commits(all=True, max_count=10, paths=file) # gets the last 10 commits from all branches
6161

6262
# Outputs: <generator object Commit._iter_from_process_or_stream at 0x7fb66c186cf0>
6363

6464
# ![5-test_cloned_repo_object]
6565

6666
# [6-test_cloned_repo_object]
67-
commits_for_file_generator = repo.iter_commits('--all', max_count=100, paths=file)
67+
commits_for_file_generator = repo.iter_commits(all=True, max_count=10, paths=file)
6868
commits_for_file = [c for c in commits_for_file_generator]
6969
commits_for_file
7070

@@ -95,7 +95,8 @@ def test_cloned_repo_object(self, local_dir):
9595
# ![9-test_cloned_repo_object]
9696

9797
# [10-test_cloned_repo_object]
98-
repo.index.diff(None)
98+
repo.index.diff(None) # compares staging area to working directory
99+
repo.index.diff(repo.head.commit) # compares staging area to last commit
99100
# Output: [<git.diff.Diff object at 0x7fb66c076e50>,
100101
# <git.diff.Diff object at 0x7fb66c076ca0>]
101102
# ![10-test_cloned_repo_object]
@@ -118,7 +119,7 @@ def test_cloned_repo_object(self, local_dir):
118119

119120
# Previous commit tree
120121
# [13-test_cloned_repo_object]
121-
prev_commits = [c for c in repo.iter_commits('--all', max_count=10)]
122+
prev_commits = [c for c in repo.iter_commits(all=True, max_count=10)] # last 10 commits from all branches
122123
tree = prev_commits[0].tree
123124
# ![13-test_cloned_repo_object]
124125

0 commit comments

Comments
 (0)