Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
bd583981
Commit
bd583981
authored
May 05, 2022
by
Arun Babu Neelicattu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix dataclass InitVar usage for git backend
parent
edabfce1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
src/poetry/vcs/git/backend.py
+6
-4
tests/integration/test_utils_vcs_git.py
+9
-0
No files found.
src/poetry/vcs/git/backend.py
View file @
bd583981
...
...
@@ -22,8 +22,6 @@ from poetry.utils.helpers import remove_directory
if
TYPE_CHECKING
:
from
dataclasses
import
InitVar
from
dulwich.client
import
FetchPackResult
from
dulwich.client
import
GitClient
...
...
@@ -137,7 +135,7 @@ class GitRefSpec:
@dataclasses.dataclass
class
GitRepoLocalInfo
:
repo
:
InitVar
[
Repo
|
Path
|
str
]
repo
:
dataclasses
.
InitVar
[
Repo
|
Path
|
str
]
origin
:
str
=
dataclasses
.
field
(
init
=
False
)
revision
:
str
=
dataclasses
.
field
(
init
=
False
)
...
...
@@ -157,7 +155,11 @@ class Git:
with
repo
:
config
=
repo
.
get_config
()
section
=
(
b
"remote"
,
remote
.
encode
(
"utf-8"
))
return
config
.
get
(
section
,
b
"url"
)
if
config
.
has_section
(
section
)
else
""
return
(
config
.
get
(
section
,
b
"url"
)
.
decode
(
"utf-8"
)
if
config
.
has_section
(
section
)
else
""
)
@staticmethod
def
get_revision
(
repo
:
Repo
)
->
str
:
...
...
tests/integration/test_utils_vcs_git.py
View file @
bd583981
...
...
@@ -108,6 +108,15 @@ def remote_default_branch(remote_default_ref: bytes) -> str:
return
remote_default_ref
.
decode
(
"utf-8"
)
.
replace
(
"refs/heads/"
,
""
)
def
test_git_local_info
(
source_url
:
str
,
remote_refs
:
FetchPackResult
,
remote_default_ref
:
bytes
)
->
None
:
with
Git
.
clone
(
url
=
source_url
)
as
repo
:
info
=
Git
.
info
(
repo
=
repo
)
assert
info
.
origin
==
source_url
assert
info
.
revision
==
remote_refs
.
refs
[
remote_default_ref
]
.
decode
(
"utf-8"
)
def
test_git_clone_default_branch_head
(
source_url
:
str
,
remote_refs
:
FetchPackResult
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment