There was an error while loading. Please reload this page.
1 parent 9ca25d7 commit 7fa57e5Copy full SHA for 7fa57e5
2 files changed
doc/source/quickstart.rst
@@ -168,6 +168,12 @@ Lets print the latest version of `<local_dir> dir1/file2.txt`
168
169
Previous version of `<local_dir>/dir1/file2.txt`
170
171
+.. literalinclude:: ../../test/test_quick_doc.py
172
+ :language: python
173
+ :dedent: 8
174
+ :start-after: # [18.1-test_cloned_repo_object]
175
+ :end-before: # ![18.1-test_cloned_repo_object]
176
+
177
* $ git status
178
179
* Untracked files
test/test_quick_doc.py
@@ -177,21 +177,24 @@ def print_files_from_git(root, level=0):
# Output <git.Blob "SHA1-HEX-HASH-1">
# ![17-test_cloned_repo_object]
180
- # print pre
181
- # [17.1-test_cloned_repo_object]
182
- commits_for_file = [c for c in repo.iter_commits(all=True, paths=print_file)]
183
- blob = tree[print_file]
184
-
185
- # ![17.1-test_cloned_repo_object]
186
+ # print latest file
187
# [18-test_cloned_repo_object]
188
blob = tree[print_file]
189
print(blob.data_stream.read().decode())
190
191
# Output
192
# file 2 version 1
193
# Update version 2
194
195
# ![18-test_cloned_repo_object]
196
+ # print previous tree
+ # [18.1-test_cloned_repo_object]
+ commits_for_file = [c for c in repo.iter_commits(all=True, paths=print_file)]
+ tree = commits_for_file[-1].tree # gets the first commit tree
+ blob = tree[print_file]
+ print(blob.data_stream.read().decode())
197
198
+ # Output
199
+ # file 2 version 1
200
+ # ![18.1-test_cloned_repo_object]
0 commit comments