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

Commit97cdb40

Browse files
committed
Made the init repo section of quickdoc
1 parentc09a71e commit97cdb40

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

‎doc/source/quickstart.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. _quickdoc_toplevel:
2+
3+
..highlight::python
4+
5+
.. _quickdoc-label:
6+
7+
==============================
8+
GitPython Quick Start Tutorial
9+
==============================
10+
11+
git.Repo
12+
********
13+
14+
There are a few ways to create a:class:`git.Repo <git.repo.base.Repo>` object
15+
16+
An existing local path
17+
######################
18+
19+
..literalinclude::../../test/test_quick_doc.py
20+
:language: python
21+
:dedent: 8
22+
:start-after: # [1-test_init_repo_object]
23+
:end-before: # ![1-test_init_repo_object]
24+
25+
Existing local git Repo
26+
#######################
27+
28+
..literalinclude::../../test/test_quick_doc.py
29+
:language: python
30+
:dedent: 8
31+
:start-after: # [2-test_init_repo_object]
32+
:end-before: # ![2-test_init_repo_object]
33+
34+
Clone from URL
35+
##############
36+
37+
For the rest of this tutorial we will use a clone from https://github.com

‎test/test_quick_doc.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
importpytest
2+
3+
importgit
4+
fromtest.libimportTestBase
5+
fromtest.lib.helperimportwith_rw_directory
6+
7+
8+
classQuickDoc(TestBase):
9+
deftearDown(self):
10+
importgc
11+
12+
gc.collect()
13+
14+
@with_rw_directory
15+
deftest_init_repo_object(self,rw_dir):
16+
path_to_dir=rw_dir
17+
18+
# [1-test_init_repo_object]
19+
fromgitimportRepo
20+
21+
repo=Repo.init(path_to_dir)
22+
assertrepo.__class__isRepo# Test to confirm repo was initialized
23+
# ![1-test_init_repo_object]
24+
25+
# [2-test_init_repo_object]
26+
try:
27+
repo=Repo(path_to_dir)
28+
exceptgit.NoSuchPathError:
29+
assertFalse,f"No such path{path_to_dir}"
30+
# ! [2-test_init_repo_object]
31+
32+
# [3 - test_init_repo_object]
33+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp