Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7fa57e5

Browse files
committed
Added new section to print prev file
1 parent9ca25d7 commit7fa57e5

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

‎doc/source/quickstart.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ Lets print the latest version of `<local_dir> dir1/file2.txt`
168168

169169
Previous version of `<local_dir>/dir1/file2.txt`
170170

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+
171177
* $ git status
172178

173179
* Untracked files

‎test/test_quick_doc.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,24 @@ def print_files_from_git(root, level=0):
177177
# Output <git.Blob "SHA1-HEX-HASH-1">
178178
# ![17-test_cloned_repo_object]
179179

180-
# print pre
181-
# [17.1-test_cloned_repo_object]
182-
commits_for_file= [cforcinrepo.iter_commits(all=True,paths=print_file)]
183-
blob=tree[print_file]
184-
185-
# ![17.1-test_cloned_repo_object]
186-
180+
# print latest file
187181
# [18-test_cloned_repo_object]
188182
blob=tree[print_file]
189183
print(blob.data_stream.read().decode())
190184

191185
# Output
192186
# file 2 version 1
193187
# Update version 2
194-
195188
# ![18-test_cloned_repo_object]
196189

190+
# print previous tree
191+
# [18.1-test_cloned_repo_object]
192+
commits_for_file= [cforcinrepo.iter_commits(all=True,paths=print_file)]
193+
tree=commits_for_file[-1].tree# gets the first commit tree
194+
blob=tree[print_file]
195+
196+
print(blob.data_stream.read().decode())
197197

198+
# Output
199+
# file 2 version 1
200+
# ![18.1-test_cloned_repo_object]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp