gpt-pr 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/PKG-INFO +1 -1
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gpt_pr.egg-info/PKG-INFO +1 -1
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gptpr/gh.py +1 -1
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gptpr/gitutil.py +10 -8
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gptpr/prdata.py +1 -1
- gpt-pr-0.2.1/gptpr/version.py +1 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/requirements.txt +1 -1
- gpt-pr-0.2.0/gptpr/version.py +0 -1
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/MANIFEST.in +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/README.md +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gpt_pr.egg-info/SOURCES.txt +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gpt_pr.egg-info/dependency_links.txt +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gpt_pr.egg-info/entry_points.txt +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gpt_pr.egg-info/not-zip-safe +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gpt_pr.egg-info/requires.txt +1 -1
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gpt_pr.egg-info/top_level.txt +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gptpr/__init__.py +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gptpr/consolecolor.py +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gptpr/main.py +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/gptpr/test_prdata.py +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/setup.cfg +0 -0
- {gpt-pr-0.2.0 → gpt-pr-0.2.1}/setup.py +0 -0
|
@@ -21,7 +21,7 @@ def create_pr(pr_data, yield_confirmation):
|
|
|
21
21
|
|
|
22
22
|
if pr_confirmation:
|
|
23
23
|
pr = repo.create_pull(title=pr_data.title, body=pr_data.body,
|
|
24
|
-
head=pr_data.branch_info.branch, base=
|
|
24
|
+
head=pr_data.branch_info.branch, base=pr_data.branch_info.base_branch)
|
|
25
25
|
print("Pull request created successfully: ", pr.html_url)
|
|
26
26
|
else:
|
|
27
27
|
print('cancelling...')
|
|
@@ -10,6 +10,7 @@ from InquirerPy.base.control import Choice
|
|
|
10
10
|
class BranchInfo:
|
|
11
11
|
owner: str
|
|
12
12
|
repo: str
|
|
13
|
+
base_branch: str
|
|
13
14
|
branch: str
|
|
14
15
|
commits: list
|
|
15
16
|
highlight_commits: list
|
|
@@ -70,10 +71,11 @@ def get_branch_info(base_branch, yield_confirmation):
|
|
|
70
71
|
return BranchInfo(
|
|
71
72
|
owner=owner,
|
|
72
73
|
repo=repo_name,
|
|
74
|
+
base_branch=base_branch,
|
|
73
75
|
branch=current_branch.name,
|
|
74
76
|
commits=commits,
|
|
75
77
|
highlight_commits=highlight_commits,
|
|
76
|
-
diff=_get_diff_changes(repo, current_branch.name, yield_confirmation)
|
|
78
|
+
diff=_get_diff_changes(repo, base_branch, current_branch.name, yield_confirmation)
|
|
77
79
|
)
|
|
78
80
|
|
|
79
81
|
|
|
@@ -85,7 +87,7 @@ def _branch_exists(repo, branch_name):
|
|
|
85
87
|
|
|
86
88
|
|
|
87
89
|
def _get_diff_messages_against_base_branch(repo, branch, base_branch):
|
|
88
|
-
# Get commit messages that are in the current branch but not in the
|
|
90
|
+
# Get commit messages that are in the current branch but not in the base branch
|
|
89
91
|
commits_diff = list(repo.iter_commits(f'{base_branch}..{branch}'))
|
|
90
92
|
|
|
91
93
|
return [commit.message.strip('\n') for commit in commits_diff]
|
|
@@ -147,33 +149,33 @@ def _extract_owner_and_repo(repo_url):
|
|
|
147
149
|
return owner, '.'.join(repo_info.split('.')[:-1])
|
|
148
150
|
|
|
149
151
|
|
|
150
|
-
def _get_diff_changes(repo, branch, yield_confirmation):
|
|
152
|
+
def _get_diff_changes(repo, base_branch, branch, yield_confirmation):
|
|
151
153
|
diff_changes = []
|
|
152
154
|
|
|
153
|
-
stats = _get_stats(repo, branch)
|
|
155
|
+
stats = _get_stats(repo, base_branch, branch)
|
|
154
156
|
files_to_ignore = _get_files_to_ignore(stats, yield_confirmation)
|
|
155
157
|
|
|
156
158
|
for file_change in stats:
|
|
157
159
|
if file_change.file_path in files_to_ignore:
|
|
158
160
|
continue
|
|
159
161
|
|
|
160
|
-
file_diff = repo.git.diff(
|
|
162
|
+
file_diff = repo.git.diff(base_branch, branch, '--', file_change.file_path)
|
|
161
163
|
|
|
162
164
|
diff_changes.append(file_diff)
|
|
163
165
|
|
|
164
166
|
return '\n'.join(diff_changes)
|
|
165
167
|
|
|
166
168
|
|
|
167
|
-
def _get_stats(repo, branch):
|
|
169
|
+
def _get_stats(repo, base_branch, branch):
|
|
168
170
|
'''
|
|
169
|
-
Get the stats of the difference between the current branch and the
|
|
171
|
+
Get the stats of the difference between the current branch and the base branch
|
|
170
172
|
'''
|
|
171
173
|
|
|
172
174
|
# returns:
|
|
173
175
|
# 4 0 README.md
|
|
174
176
|
# 2 0 application/aggregator/aggregator.go
|
|
175
177
|
# 0 257 go.sum
|
|
176
|
-
diff_index = repo.git.diff(
|
|
178
|
+
diff_index = repo.git.diff(base_branch, branch, '--numstat')
|
|
177
179
|
|
|
178
180
|
files_changed = []
|
|
179
181
|
for line in diff_index.split('\n'):
|
|
@@ -48,7 +48,7 @@ class PrData():
|
|
|
48
48
|
f'{cc.bold("Repository")}: {cc.yellow(self.branch_info.owner)}/{cc.yellow(self.branch_info.repo)}',
|
|
49
49
|
f'{cc.bold("Title")}: {cc.yellow(self.title)}',
|
|
50
50
|
f'{cc.bold("Branch name")}: {cc.yellow(self.branch_info.branch)}',
|
|
51
|
-
f'{cc.bold("Base branch")}: {cc.yellow(
|
|
51
|
+
f'{cc.bold("Base branch")}: {cc.yellow(self.branch_info.base_branch)}',
|
|
52
52
|
f'{cc.bold("PR Description")}:\n{self.body}',
|
|
53
53
|
])
|
|
54
54
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.1"
|
|
@@ -33,7 +33,7 @@ smmap==5.0.1; python_version >= '3.7'
|
|
|
33
33
|
sniffio==1.3.1; python_version >= '3.7'
|
|
34
34
|
termcolor==2.3.0; python_version >= '3.7'
|
|
35
35
|
tqdm==4.66.2; python_version >= '3.7'
|
|
36
|
-
typing-extensions==4.7.1; python_version
|
|
36
|
+
typing-extensions==4.7.1; python_version < '3.8'
|
|
37
37
|
urllib3==2.0.7; python_version >= '3.7'
|
|
38
38
|
wcwidth==0.2.13
|
|
39
39
|
wrapt==1.16.0; python_version >= '3.6'
|
gpt-pr-0.2.0/gptpr/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -16,6 +16,7 @@ exceptiongroup==1.2.0
|
|
|
16
16
|
|
|
17
17
|
[:python_version < "3.8"]
|
|
18
18
|
cached-property==1.5.2
|
|
19
|
+
typing-extensions==4.7.1
|
|
19
20
|
|
|
20
21
|
[:python_version == "3.7"]
|
|
21
22
|
importlib-metadata==6.7.0
|
|
@@ -52,7 +53,6 @@ smmap==5.0.1
|
|
|
52
53
|
sniffio==1.3.1
|
|
53
54
|
termcolor==2.3.0
|
|
54
55
|
tqdm==4.66.2
|
|
55
|
-
typing-extensions==4.7.1
|
|
56
56
|
urllib3==2.0.7
|
|
57
57
|
zipp==3.15.0
|
|
58
58
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|