mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 01:31:03 +00:00
move-mrs-script: add url option
You can give as option: --url https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/960>
This commit is contained in:
parent
442672cfdd
commit
01fa95d34a
2 changed files with 16 additions and 6 deletions
|
@ -80,12 +80,12 @@ PARSER.add_argument(
|
||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
PARSER.add_argument(
|
PARSER.add_argument(
|
||||||
"--mr",
|
"-mr",
|
||||||
|
"--mr-url",
|
||||||
default=None,
|
default=None,
|
||||||
type=int,
|
type=str,
|
||||||
help=(
|
help=(
|
||||||
"Id of the MR to work on."
|
"URL of the MR to work on."
|
||||||
" One (and only one) module must be specified with `--module`."
|
|
||||||
),
|
),
|
||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
|
@ -182,6 +182,7 @@ class GstMRMover:
|
||||||
self.config_files = []
|
self.config_files = []
|
||||||
self.gl = None
|
self.gl = None
|
||||||
self.mr = None
|
self.mr = None
|
||||||
|
self.mr_url = None
|
||||||
self.all_projects = []
|
self.all_projects = []
|
||||||
self.skipped_branches = []
|
self.skipped_branches = []
|
||||||
self.git_rename_limit = None
|
self.git_rename_limit = None
|
||||||
|
@ -312,7 +313,12 @@ class GstMRMover:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
def cleanup_args(self):
|
def cleanup_args(self):
|
||||||
if not self.modules:
|
if self.mr_url:
|
||||||
|
self.modules.append(GST_PROJECTS[0])
|
||||||
|
(namespace, module, _, _, mr) = os.path.normpath(urlparse(self.mr_url).path).split('/')[1:]
|
||||||
|
self.modules.append(module)
|
||||||
|
self.mr = int(mr)
|
||||||
|
elif not self.modules:
|
||||||
if self.mr:
|
if self.mr:
|
||||||
sys.exit(f"{red(f'Merge request #{self.mr} specified without module')}\n\n"
|
sys.exit(f"{red(f'Merge request #{self.mr} specified without module')}\n\n"
|
||||||
f"{bold(' -> Use `--module` to specify which module the MR is from.')}")
|
f"{bold(' -> Use `--module` to specify which module the MR is from.')}")
|
||||||
|
@ -527,6 +533,9 @@ class GstMRMover:
|
||||||
bold(f"{red('SKIPPED')} (couldn't checkout)\n"), nested=False)
|
bold(f"{red('SKIPPED')} (couldn't checkout)\n"), nested=False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# unset upstream to avoid to push to main (ie push.default = tracking)
|
||||||
|
self.git("branch", branch, "--unset-upstream")
|
||||||
|
|
||||||
for commit in reversed([c for c in mr.commits()]):
|
for commit in reversed([c for c in mr.commits()]):
|
||||||
if self.git("cherry-pick", commit.id,
|
if self.git("cherry-pick", commit.id,
|
||||||
interaction_message=f"cherry-picking {commit.id} onto {branch} with:\n "
|
interaction_message=f"cherry-picking {commit.id} onto {branch} with:\n "
|
||||||
|
|
|
@ -54,7 +54,8 @@ https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1277
|
||||||
you can run:
|
you can run:
|
||||||
|
|
||||||
```
|
```
|
||||||
GITLAB_API_TOKEN=zytXYboB5yi3uggRpBM6 ./scripts/move_mrs_to_monorepo.py -m gst-plugins-base --mr 1277
|
GITLAB_API_TOKEN=zytXYboB5yi3uggRpBM6 ./scripts/move_mrs_to_monorepo.py -mr https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1277
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
When you are ready, you can also run the same script without any parameters to browse and move all your Merge Requests:
|
When you are ready, you can also run the same script without any parameters to browse and move all your Merge Requests:
|
||||||
|
|
Loading…
Reference in a new issue