Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mrhlpr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
postmarketOS
mrhlpr
Commits
b5cc8829
Commit
b5cc8829
authored
6 months ago
by
Pablo Correa Gomez
Committed by
Robert Eckelmann
6 months ago
Browse files
Options
Downloads
Patches
Plain Diff
mrhlpr: add push command (MR 48)
Fixes #21
parent
3b23338f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!48
mrhlpr: add push command
Pipeline
#185194
passed
6 months ago
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mrhlpr/frontend.py
+6
-0
6 additions, 0 deletions
mrhlpr/frontend.py
mrhlpr/mr.py
+12
-8
12 additions, 8 deletions
mrhlpr/mr.py
with
18 additions
and
8 deletions
mrhlpr/frontend.py
+
6
−
0
View file @
b5cc8829
...
...
@@ -230,6 +230,9 @@ def parse_args() -> argparse.Namespace:
help
=
f
"
add message to last commit:
{
ci_labels
[
'
skip_vercheck
'
]
}
"
,
)
# push
sub
.
add_parser
(
"
push
"
,
help
=
"
Push the MR to gitlab
"
)
# finish
finish
=
sub
.
add_parser
(
"
finish
"
,
help
=
"
help finishing the MR (push, approve, merge...)
"
)
finish
.
add_argument
(
...
...
@@ -265,6 +268,9 @@ def main():
mr_id
=
mr
.
checked_out
()
mr
.
fixmsg
(
mr_id
,
args
.
skip_build
,
args
.
ignore_count
,
args
.
skip_vercheck
)
print_status
(
mr_id
)
elif
args
.
action
==
"
push
"
:
mr_id
=
mr
.
checked_out
()
mr
.
push
(
mr_id
,
args
.
no_cache
)
elif
args
.
action
==
"
finish
"
:
mr_id
=
mr
.
checked_out
()
# TODO: Check that everything passed
...
...
This diff is collapsed.
Click to expand it.
mrhlpr/mr.py
+
12
−
8
View file @
b5cc8829
...
...
@@ -445,6 +445,16 @@ def fixmsg(
run_git_filter_branch
(
"
msg_filter_add_label.py
"
,
"
HEAD~1
"
,
label
=
"
skip_vercheck
"
)
def
push
(
mr_id
:
int
,
no_cache
:
bool
=
False
)
->
None
:
print
(
"
Pushing changes...
"
)
status
=
get_status
(
mr_id
,
no_cache
)
origin
=
gitlab
.
parse_git_origin
()
remote_local
=
status
.
source
.
split
(
"
/
"
,
1
)[
0
]
if
remote_local
==
origin
.
project
:
remote_local
=
"
origin
"
git
.
push_head
(
remote_local
,
status
.
source_branch
)
def
finish
(
mr_id
:
int
,
comment
:
Optional
[
str
],
no_cache
:
bool
=
False
,
skip_approve
:
bool
=
False
)
->
None
:
...
...
@@ -460,14 +470,7 @@ def finish(
)
exit
(
1
)
print
(
"
Pushing changes...
"
)
status
=
get_status
(
mr_id
,
no_cache
)
origin
=
gitlab
.
parse_git_origin
()
remote_local
=
status
.
source
.
split
(
"
/
"
,
1
)[
0
]
if
remote_local
==
origin
.
project
:
remote_local
=
"
origin
"
git
.
push_head
(
remote_local
,
status
.
source_branch
)
push
(
mr_id
,
no_cache
)
gl
=
gitlab_api
.
Gitlab
(
url
=
"
https://gitlab.com
"
,
private_token
=
gitlab_token
)
try
:
gl
.
auth
()
...
...
@@ -478,6 +481,7 @@ def finish(
)
exit
(
1
)
origin
=
gitlab
.
parse_git_origin
()
project
=
gl
.
projects
.
get
(
origin
.
project_id
)
mr
=
project
.
mergerequests
.
get
(
mr_id
)
if
skip_approve
or
(
gl
.
user
and
mr
.
author
and
gl
.
user
.
id
==
mr
.
author
.
get
(
"
id
"
)):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment