@@ -46,7 +46,7 @@ def test_cloned_repo_object(self, local_dir):
46
46
# ![2-test_cloned_repo_object]
47
47
48
48
# [3-test_cloned_repo_object]
49
- add_file = [f" { update_file } " ] # relative path from git root
49
+ add_file = [update_file ] # relative path from git root
50
50
repo .index .add (add_file ) # notice the add function requires a list of paths
51
51
# ![3-test_cloned_repo_object]
52
52
@@ -56,15 +56,15 @@ def test_cloned_repo_object(self, local_dir):
56
56
# ![4-test_cloned_repo_object]
57
57
58
58
# [5-test_cloned_repo_object]
59
- file = 'dir1/file2.txt' # relative path from git root
60
- repo .iter_commits (all = True , max_count = 10 , paths = file ) # gets the last 10 commits from all branches
59
+ # relative path from git root
60
+ repo .iter_commits (all = True , max_count = 10 , paths = update_file ) # gets the last 10 commits from all branches
61
61
62
62
# Outputs: <generator object Commit._iter_from_process_or_stream at 0x7fb66c186cf0>
63
63
64
64
# ![5-test_cloned_repo_object]
65
65
66
66
# [6-test_cloned_repo_object]
67
- commits_for_file_generator = repo .iter_commits (all = True , max_count = 10 , paths = file )
67
+ commits_for_file_generator = repo .iter_commits (all = True , max_count = 10 , paths = update_file )
68
68
commits_for_file = [c for c in commits_for_file_generator ]
69
69
commits_for_file
70
70
@@ -76,8 +76,7 @@ def test_cloned_repo_object(self, local_dir):
76
76
# [7-test_cloned_repo_object]
77
77
# We'll create a file5.txt
78
78
79
- file5 = f'{ local_dir } /file5.txt'
80
- with open (file5 , 'w' ) as f :
79
+ with open (f'{ local_dir } /file5.txt' , 'w' ) as f :
81
80
f .write ('file5 version 1' )
82
81
# ![7-test_cloned_repo_object]
83
82
@@ -89,8 +88,8 @@ def test_cloned_repo_object(self, local_dir):
89
88
# Modified files
90
89
# [9-test_cloned_repo_object]
91
90
# Lets modify one of our tracked files
92
- file3 = f' { local_dir } /Downloads/file3.txt'
93
- with open (file3 , 'w' ) as f :
91
+
92
+ with open (f' { local_dir } /Downloads/ file3.txt' , 'w' ) as f :
94
93
f .write ('file3 version 2' ) # overwrite file 3
95
94
# ![9-test_cloned_repo_object]
96
95
0 commit comments