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

Commit9d878af

Browse files
committed
change to formatting - removed = bash cmds
1 parent7fa57e5 commit9d878af

File tree

2 files changed

+91
-87
lines changed

2 files changed

+91
-87
lines changed

‎doc/source/quickstart.rst

Lines changed: 84 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -102,117 +102,119 @@ Recurse through the Tree
102102
Usage
103103
****************
104104

105-
* $ git add <filepath>
106-
107-
..literalinclude::../../test/test_quick_doc.py
108-
:language: python
109-
:dedent: 8
110-
:start-after: # [2-test_cloned_repo_object]
111-
:end-before: # ![2-test_cloned_repo_object]
112-
113-
Now lets add the updated file to git
114-
115-
..literalinclude::../../test/test_quick_doc.py
116-
:language: python
117-
:dedent: 8
118-
:start-after: # [3-test_cloned_repo_object]
119-
:end-before: # ![3-test_cloned_repo_object]
120-
121-
Notice the add method requires a list as a parameter
122-
123-
Warning: If you experience any trouble with this, try to invoke:class:`git <git.cmd.Git>` instead via repo.git.add(path)
124-
125-
* $ git commit -m message
126-
127-
..literalinclude::../../test/test_quick_doc.py
128-
:language: python
129-
:dedent: 8
130-
:start-after: # [4-test_cloned_repo_object]
131-
:end-before: # ![4-test_cloned_repo_object]
132-
133-
* $ git log <file>
134-
135-
A list of commits associated with a file
136-
137-
..literalinclude::../../test/test_quick_doc.py
138-
:language: python
139-
:dedent: 8
140-
:start-after: # [5-test_cloned_repo_object]
141-
:end-before: # ![5-test_cloned_repo_object]
142-
143-
Notice this returns a generator object
144-
145-
..literalinclude::../../test/test_quick_doc.py
146-
:language: python
147-
:dedent: 8
148-
:start-after: # [6-test_cloned_repo_object]
149-
:end-before: # ![6-test_cloned_repo_object]
150-
151-
returns list of:class:`Commit <git.objects.commit.Commit>` objects
152-
153-
Printing text files
154-
####################
155-
Lets print the latest version of `<local_dir> dir1/file2.txt`
105+
Add file to staging area
106+
########################
156107

157-
..literalinclude::../../test/test_quick_doc.py
158-
:language: python
159-
:dedent: 8
160-
:start-after: # [17-test_cloned_repo_object]
161-
:end-before: # ![17-test_cloned_repo_object]
162108

163-
..literalinclude::../../test/test_quick_doc.py
109+
..literalinclude::../../test/test_quick_doc.py
164110
:language: python
165111
:dedent: 8
166-
:start-after: # [18-test_cloned_repo_object]
167-
:end-before: # ![18-test_cloned_repo_object]
112+
:start-after: # [2-test_cloned_repo_object]
113+
:end-before: # ![2-test_cloned_repo_object]
168114

169-
Previous version of `<local_dir>/dir1/file2.txt`
115+
Now lets add the updated file to git
170116

171-
..literalinclude::../../test/test_quick_doc.py
117+
..literalinclude::../../test/test_quick_doc.py
172118
:language: python
173119
:dedent: 8
174-
:start-after: # [18.1-test_cloned_repo_object]
175-
:end-before: # ![18.1-test_cloned_repo_object]
120+
:start-after: # [3-test_cloned_repo_object]
121+
:end-before: # ![3-test_cloned_repo_object]
176122

177-
* $ git status
123+
Notice the add method requires a list as a parameter
178124

179-
* Untracked files
125+
Warning: If you experience any trouble with this, try to invoke:class:`git <git.cmd.Git>` instead via repo.git.add(path)
180126

181-
Lets create a new file
127+
Commit
128+
######
182129

183130
..literalinclude::../../test/test_quick_doc.py
184131
:language: python
185132
:dedent: 8
186-
:start-after: # [7-test_cloned_repo_object]
187-
:end-before: # ![7-test_cloned_repo_object]
133+
:start-after: # [4-test_cloned_repo_object]
134+
:end-before: # ![4-test_cloned_repo_object]
135+
136+
List of commits associated with a file
137+
#######################################
188138

189139
..literalinclude::../../test/test_quick_doc.py
190140
:language: python
191141
:dedent: 8
192-
:start-after: # [8-test_cloned_repo_object]
193-
:end-before: # ![8-test_cloned_repo_object]
142+
:start-after: # [5-test_cloned_repo_object]
143+
:end-before: # ![5-test_cloned_repo_object]
194144

195-
* Modified files
145+
Notice this returns a generator object
196146

197147
..literalinclude::../../test/test_quick_doc.py
198148
:language: python
199149
:dedent: 8
200-
:start-after: # [9-test_cloned_repo_object]
201-
:end-before: # ![9-test_cloned_repo_object]
150+
:start-after: # [6-test_cloned_repo_object]
151+
:end-before: # ![6-test_cloned_repo_object]
152+
153+
returns list of:class:`Commit <git.objects.commit.Commit>` objects
154+
155+
Printing text files
156+
####################
157+
Lets print the latest version of `<local_dir> dir1/file2.txt`
202158

203159
..literalinclude::../../test/test_quick_doc.py
204-
:language: python
205-
:dedent: 8
206-
:start-after: # [10-test_cloned_repo_object]
207-
:end-before: # ![10-test_cloned_repo_object]
160+
:language: python
161+
:dedent: 8
162+
:start-after: # [17-test_cloned_repo_object]
163+
:end-before: # ![17-test_cloned_repo_object]
164+
165+
..literalinclude::../../test/test_quick_doc.py
166+
:language: python
167+
:dedent: 8
168+
:start-after: # [18-test_cloned_repo_object]
169+
:end-before: # ![18-test_cloned_repo_object]
208170

209-
returns a listof:class:`Diff <git.diff.Diff>` objects
171+
Previous versionof`<local_dir>/dir1/file2.txt`
210172

211173
..literalinclude::../../test/test_quick_doc.py
212-
:language: python
213-
:dedent: 8
214-
:start-after: # [11-test_cloned_repo_object]
215-
:end-before: # ![11-test_cloned_repo_object]
174+
:language: python
175+
:dedent: 8
176+
:start-after: # [18.1-test_cloned_repo_object]
177+
:end-before: # ![18.1-test_cloned_repo_object]
178+
179+
Status
180+
######
181+
* Untracked files
182+
183+
Lets create a new file
184+
185+
..literalinclude::../../test/test_quick_doc.py
186+
:language: python
187+
:dedent: 8
188+
:start-after: # [7-test_cloned_repo_object]
189+
:end-before: # ![7-test_cloned_repo_object]
190+
191+
..literalinclude::../../test/test_quick_doc.py
192+
:language: python
193+
:dedent: 8
194+
:start-after: # [8-test_cloned_repo_object]
195+
:end-before: # ![8-test_cloned_repo_object]
196+
197+
* Modified files
198+
199+
..literalinclude::../../test/test_quick_doc.py
200+
:language: python
201+
:dedent: 8
202+
:start-after: # [9-test_cloned_repo_object]
203+
:end-before: # ![9-test_cloned_repo_object]
204+
205+
..literalinclude::../../test/test_quick_doc.py
206+
:language: python
207+
:dedent: 8
208+
:start-after: # [10-test_cloned_repo_object]
209+
:end-before: # ![10-test_cloned_repo_object]
210+
211+
returns a list of:class:`Diff <git.diff.Diff>` objects
212+
213+
..literalinclude::../../test/test_quick_doc.py
214+
:language: python
215+
:dedent: 8
216+
:start-after: # [11-test_cloned_repo_object]
217+
:end-before: # ![11-test_cloned_repo_object]
216218

217219

218220

‎test/test_quick_doc.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,20 @@ def test_cloned_repo_object(self, local_dir):
5050
# ![2-test_cloned_repo_object]
5151

5252
# [3-test_cloned_repo_object]
53+
# $ git add <file>
5354
add_file= [update_file]# relative path from git root
5455
repo.index.add(add_file)# notice the add function requires a list of paths
5556
# ![3-test_cloned_repo_object]
5657

5758
# code to commit - not sure how to test this
5859
# [4-test_cloned_repo_object]
60+
# $ git commit -m <message>
5961
repo.index.commit("Update to file2")
6062
# ![4-test_cloned_repo_object]
6163

6264
# [5-test_cloned_repo_object]
65+
# $ git log <file>
66+
6367
# relative path from git root
6468
repo.iter_commits(all=True,max_count=10,paths=update_file)# gets the last 10 commits from all branches
6569

@@ -78,15 +82,13 @@ def test_cloned_repo_object(self, local_dir):
7882

7983
# Untracked files - create new file
8084
# [7-test_cloned_repo_object]
81-
# We'll create a file5.txt
82-
83-
withopen(f'{local_dir}/file5.txt','w')asf:
84-
f.write('file5 version 1')
85+
f=open(f'{local_dir}/untracked.txt','w')# creates an empty file
86+
f.close()
8587
# ![7-test_cloned_repo_object]
8688

8789
# [8-test_cloned_repo_object]
8890
repo.untracked_files
89-
# Output: ['file5.txt']
91+
# Output: ['untracked.txt']
9092
# ![8-test_cloned_repo_object]
9193

9294
# Modified files

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp