move-mrs-script: add a list only options
[platform/upstream/gstreamer.git] / scripts / move_mrs_to_monorepo.py
1 #!/usr/bin/env python3
2
3 from urllib.parse import urlparse
4 from contextlib import contextmanager
5 import os
6 import re
7 import sys
8 try:
9     import gitlab
10 except ModuleNotFoundError:
11     print("========================================================================", file=sys.stderr)
12     print("ERROR: Install python-gitlab with `python3 -m pip install python-gitlab dateutil`", file=sys.stderr)
13     print("========================================================================", file=sys.stderr)
14     sys.exit(1)
15
16 try:
17     from dateutil import parser as dateparse
18 except ModuleNotFoundError:
19     print("========================================================================", file=sys.stderr)
20     print("ERROR: Install dateutil with `python3 -m pip install dateutil`", file=sys.stderr)
21     print("========================================================================", file=sys.stderr)
22     sys.exit(1)
23 import argparse
24 import requests
25
26 import subprocess
27
28 ROOT_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
29
30 URL = "https://gitlab.freedesktop.org/"
31 SIGN_IN_URL = URL + 'sign_in'
32 LOGIN_URL = URL + 'users/sign_in'
33 LOGIN_URL_LDAP = URL + '/users/auth/ldapmain/callback'
34
35 MONOREPO_REMOTE_NAME = 'origin'
36 NAMESPACE = "gstreamer"
37 MONOREPO_NAME = 'gstreamer'
38 MONOREPO_REMOTE = URL + f'{NAMESPACE}/{MONOREPO_NAME}'
39 MONOREPO_BRANCH = 'main'
40 PING_SIGN = '@'
41 MOVING_NAMESPACE = NAMESPACE
42
43 PARSER = argparse.ArgumentParser(
44     description="Move merge request from old GStreamer module to the new"
45                 "GStreamer 'monorepo'.\n"
46                 " All your pending merge requests from all GStreamer modules will"
47                 " be moved the the mono repository."
48 )
49 PARSER.add_argument("--skip-branch", action="store", nargs="*",
50                     help="Ignore MRs for branches which match those names.", dest="skipped_branches")
51 PARSER.add_argument("--skip-on-failure", action="store_true", default=False)
52 PARSER.add_argument("--dry-run", "-n", action="store_true", default=False)
53 PARSER.add_argument("--use-branch-if-exists",
54                     action="store_true", default=False)
55 PARSER.add_argument("--list-mrs-only", action="store_true", default=False)
56 PARSER.add_argument(
57     "-c",
58     "--config-file",
59     action="append",
60     dest='config_files',
61     help="Configuration file to use. Can be used multiple times.",
62     required=False,
63 )
64 PARSER.add_argument(
65     "-g",
66     "--gitlab",
67     help=(
68         "Which configuration section should "
69         "be used. If not defined, the default selection "
70         "will be used."
71     ),
72     required=False,
73 )
74 PARSER.add_argument(
75     "-m",
76     "--module",
77     help="GStreamer module to move MRs for. All if none specified. Can be used multiple times.",
78     dest='modules',
79     action="append",
80     required=False,
81 )
82 PARSER.add_argument(
83     "--mr",
84     default=None,
85     type=int,
86     help=(
87         "Id of the MR to work on."
88         " One (and only one) module must be specified with `--module`."
89     ),
90     required=False,
91 )
92
93 GST_PROJECTS = [
94     'gstreamer',
95     'gst-plugins-base',
96     'gst-plugins-good',
97     'gst-plugins-bad',
98     'gst-plugins-ugly',
99     'gst-libav',
100     'gst-rtsp-server',
101     'gstreamer-vaapi',
102     'gstreamer-sharp',
103     'gst-python',
104     'gst-omx',
105     'gst-editing-services',
106     'gst-devtools',
107     'gst-docs',
108     'gst-examples',
109     'gst-build',
110     'gst-ci',
111 ]
112
113 GST_PROJECTS_ID = {
114     'gstreamer': 1357,
115     'gst-rtsp-server': 1362,
116     'gstreamer-vaapi': 1359,
117     'gstreamer-sharp': 1358,
118     'gst-python': 1355,
119     'gst-plugins-ugly': 1354,
120     'gst-plugins-good': 1353,
121     'gst-plugins-base': 1352,
122     'gst-plugins-bad': 1351,
123     'gst-omx': 1350,
124     'gst-libav': 1349,
125     'gst-integration-testsuites': 1348,
126     'gst-examples': 1347,
127     'gst-editing-services': 1346,
128     'gst-docs': 1345,
129     'gst-devtools': 1344,
130     'gst-ci': 1343,
131     'gst-build': 1342,
132 }
133
134 # We do not want to deal with LFS
135 os.environ["GIT_LFS_SKIP_SMUDGE"] = "1"
136
137
138 log_depth = []               # type: T.List[str]
139
140
141 @contextmanager
142 def nested(name=''):
143     global log_depth
144     log_depth.append(name)
145     try:
146         yield
147     finally:
148         log_depth.pop()
149
150
151 def bold(text: str):
152     return f"\033[1m{text}\033[0m"
153
154
155 def green(text: str):
156     return f"\033[1;32m{text}\033[0m"
157
158
159 def red(text: str):
160     return f"\033[1;31m{text}\033[0m"
161
162
163 def yellow(text: str):
164     return f"\033[1;33m{text}\033[0m"
165
166
167 def fprint(msg, nested=True):
168     if log_depth:
169         prepend = log_depth[-1] + ' | ' if nested else ''
170     else:
171         prepend = ''
172
173     print(prepend + msg, end="")
174     sys.stdout.flush()
175
176
177 class GstMRMover:
178     def __init__(self):
179
180         self.modules = []
181         self.gitlab = None
182         self.config_files = []
183         self.gl = None
184         self.mr = None
185         self.all_projects = []
186         self.skipped_branches = []
187         self.git_rename_limit = None
188         self.skip_on_failure = None
189         self.dry_run = False
190
191     def connect(self):
192         fprint("Logging into gitlab...")
193
194         if self.gitlab:
195             gl = gitlab.Gitlab.from_config(self.gitlab, self.config_files)
196             fprint(f"{green(' OK')}\n", nested=False)
197             return gl
198
199         gitlab_api_token = os.environ.get('GITLAB_API_TOKEN')
200         if gitlab_api_token:
201             gl = gitlab.Gitlab(URL, private_token=gitlab_api_token)
202             fprint(f"{green(' OK')}\n", nested=False)
203             return gl
204
205         session = requests.Session()
206         sign_in_page = session.get(SIGN_IN_URL).content.decode()
207         for line in sign_in_page.split('\n'):
208             m = re.search('name="authenticity_token" value="([^"]+)"', line)
209             if m:
210                 break
211
212         token = None
213         if m:
214             token = m.group(1)
215
216         if not token:
217             fprint(f"{red('Unable to find the authenticity token')}\n")
218             sys.exit(1)
219
220         for data, url in [
221             ({'user[login]': 'login_or_email',
222               'user[password]': 'SECRET',
223               'authenticity_token': token}, LOGIN_URL),
224             ({'username': 'login_or_email',
225               'password': 'SECRET',
226               'authenticity_token': token}, LOGIN_URL_LDAP)]:
227
228             r = session.post(url, data=data)
229             if r.status_code != 200:
230                 continue
231
232             try:
233                 gl = gitlab.Gitlab(URL, api_version=4, session=session)
234                 gl.auth()
235             except gitlab.exceptions.GitlabAuthenticationError as e:
236                 continue
237             return gl
238
239         sys.exit(bold(f"{red('FAILED')}.\n\nPlease go to:\n\n"
240                       '   https://gitlab.freedesktop.org/-/profile/personal_access_tokens\n\n'
241                       f'and generate a token {bold("with read/write access to all but the registry")},'
242                       ' then set it in the "GITLAB_API_TOKEN" environment variable:"'
243                       f'\n\n  $ GITLAB_API_TOKEN=<your token> {" ".join(sys.argv)}\n'))
244
245     def git(self, *args, can_fail=False, interaction_message=None, call=False, revert_operation=None):
246         cwd = ROOT_DIR
247         retry = True
248         while retry:
249             retry = False
250             try:
251                 if not call:
252                     try:
253                         return subprocess.check_output(["git"] + list(args), cwd=cwd,
254                                                        stdin=subprocess.DEVNULL,
255                                                        stderr=subprocess.STDOUT).decode()
256                     except subprocess.CalledProcessError:
257                         if not can_fail:
258                             fprint(
259                                 f"\n\n{bold(red('ERROR'))}: `git {' '.join(args)}` failed" + "\n", nested=False)
260                         raise
261                 else:
262                     subprocess.call(["git"] + list(args), cwd=cwd)
263                     return "All good"
264             except Exception as e:
265                 if interaction_message:
266                     if self.skip_on_failure:
267                         return "SKIP"
268                     output = getattr(e, "output", b"")
269                     if output is not None:
270                         out = output.decode()
271                     else:
272                         out = "????"
273                     fprint(f"\n```"
274                            f"\n{out}\n"
275                            f"Entering a shell in {cwd} to fix:\n\n"
276                            f" {bold(interaction_message)}\n\n"
277                            f"You should then exit with the following codes:\n\n"
278                            f"  - {bold('`exit 0`')}: once you have fixed the problem and we can keep moving the merge request\n"
279                            f"  - {bold('`exit 1`')}: {bold('retry')}: once you have let the repo in a state where the operation should be to retried\n"
280                            f"  - {bold('`exit 2`')}: to skip that merge request\n"
281                            f"  - {bold('`exit 3`')}: stop the script and abandon moving your MRs\n"
282                            "\n```\n", nested=False)
283                     try:
284                         if os.name == 'nt':
285                             shell = os.environ.get(
286                                 "COMSPEC", r"C:\WINDOWS\system32\cmd.exe")
287                         else:
288                             shell = os.environ.get(
289                                 "SHELL", os.path.realpath("/bin/sh"))
290                         subprocess.check_call(shell, cwd=cwd)
291                     except subprocess.CalledProcessError as e:
292                         if e.returncode == 1:
293                             retry = True
294                             continue
295                         elif e.returncode == 2:
296                             if revert_operation:
297                                 self.git(*revert_operation, can_fail=True)
298                             return "SKIP"
299                         elif e.returncode == 3:
300                             if revert_operation:
301                                 self.git(*revert_operation, can_fail=True)
302                             sys.exit(3)
303                     except Exception:
304                         # Result of subshell does not really matter
305                         pass
306
307                     return "User fixed it"
308
309                 if can_fail:
310                     return "Failed but we do not care"
311
312                 raise e
313
314     def cleanup_args(self):
315         if not self.modules:
316             if self.mr:
317                 sys.exit(f"{red(f'Merge request #{self.mr} specified without module')}\n\n"
318                          f"{bold(' -> Use `--module` to specify which module the MR is from.')}")
319
320             self.modules = GST_PROJECTS
321         else:
322             VALID_PROJECTS = GST_PROJECTS[1:]
323             for m in self.modules:
324                 if m not in VALID_PROJECTS:
325                     projects = '\n- '.join(VALID_PROJECTS)
326                     sys.exit(
327                         f"{red(f'Unknown module {m}')}\nModules are:\n- {projects}")
328             if self.mr and len(self.modules) > 1:
329                 sys.exit(f"{red(f'Merge request #{self.mr} specified but several modules where specified')}\n\n"
330                          f"{bold(' -> Use `--module` only once to specify an merge request.')}")
331             self.modules.append(GST_PROJECTS[0])
332
333     def run(self):
334         self.cleanup_args()
335         self.gl = self.connect()
336         self.gl.auth()
337
338         # Skip pre-commit hooks when migrating. Some users may have a
339         # different version of gnu indent and that can lead to cherry-pick
340         # failing.
341         os.environ["GST_DISABLE_PRE_COMMIT_HOOKS"] = "1"
342
343         try:
344             prevbranch = self.git(
345                 "rev-parse", "--abbrev-ref", "HEAD", can_fail=True).strip()
346         except Exception:
347             fprint(bold(yellow("Not on a branch?\n")), indent=False)
348             prevbranch = None
349
350         try:
351             self.setup_repo()
352
353             from_projects, to_project = self.fetch_projects()
354
355             with nested('  '):
356                 self.move_mrs(from_projects, to_project)
357         finally:
358             if self.git_rename_limit is not None:
359                 self.git("config", "merge.renameLimit",
360                          str(self.git_rename_limit))
361             if prevbranch:
362                 fprint(f'Back to {prevbranch}\n')
363                 self.git("checkout", prevbranch)
364
365     def fetch_projects(self):
366         fprint("Fetching projects... ")
367         self.all_projects = [proj for proj in self.gl.projects.list(
368             membership=1, all=True) if proj.name in self.modules]
369
370         try:
371             self.user_project, = [p for p in self.all_projects
372                                   if p.namespace['path'] == self.gl.user.username
373                                   and p.name == MONOREPO_NAME]
374         except ValueError:
375             fprint(
376                 f"{red(f'ERROR')}\n\nCould not find repository {self.gl.user.name}/{MONOREPO_NAME}")
377             fprint(f"{red(f'Got to https://gitlab.freedesktop.org/gstreamer/gstreamer/ and create a fork so we can move your Merge requests.')}")
378             sys.exit(1)
379         fprint(f"{green(' OK')}\n", nested=False)
380
381         from_projects = []
382         user_projects_name = [proj.name for proj in self.all_projects if proj.namespace['path']
383                               == self.gl.user.username and proj.name in GST_PROJECTS]
384         for project, id in GST_PROJECTS_ID.items():
385             if project not in user_projects_name or project == 'gstreamer':
386                 continue
387
388             projects = [p for p in self.all_projects if p.id == id]
389             if not projects:
390                 upstream_project = self.gl.projects.get(id)
391             else:
392                 upstream_project, = projects
393             assert project
394
395             from_projects.append(upstream_project)
396
397         fprint(f"\nMoving MRs from:\n")
398         fprint(f"----------------\n")
399         for p in from_projects:
400             fprint(f"  - {bold(p.path_with_namespace)}\n")
401
402         to_project = self.gl.projects.get(GST_PROJECTS_ID['gstreamer'])
403         fprint(f"To: {bold(to_project.path_with_namespace)}\n\n")
404
405         return from_projects, to_project
406
407     def recreate_mr(self, project, to_project, mr):
408         branch = f"{project.name}-{mr.source_branch}"
409         if not self.create_branch_for_mr(branch, project, mr):
410             return None
411
412         description = f"**Copied from {URL}/{project.path_with_namespace}/-/merge_requests/{mr.iid}**\n\n{mr.description}"
413
414         title = mr.title
415         if ':' not in mr.title:
416             title = f"{project.name}: {mr.title}"
417
418         new_mr_dict = {
419             'source_branch': branch,
420             'allow_collaboration': True,
421             'remove_source_branch': True,
422             'target_project_id': to_project.id,
423             'target_branch': MONOREPO_BRANCH,
424             'title': title,
425             'labels': mr.labels,
426             'description': description,
427         }
428
429         try:
430             fprint(f"-> Recreating MR '{bold(mr.title)}'...")
431             if self.dry_run:
432                 fprint(f"\nDry info:\n{new_mr_dict}\n")
433             else:
434                 new_mr = self.user_project.mergerequests.create(new_mr_dict)
435                 fprint(f"{green(' OK')}\n", nested=False)
436         except gitlab.exceptions.GitlabCreateError as e:
437             fprint(f"{yellow('SKIPPED')} (An MR already exists)\n", nested=False)
438             return None
439
440         fprint(f"-> Adding discussings from MR '{mr.title}'...")
441         if self.dry_run:
442             fprint(f"{green(' OK')}\n", nested=False)
443             return None
444
445         new_mr_url = f"{URL}/{to_project.path_with_namespace}/-/merge_requests/{new_mr.iid}"
446         for issue in mr.closes_issues():
447             obj = {'body': f'Fixing MR moved to: {new_mr_url}'}
448             issue.discussions.create(obj)
449
450         mr_url = f"{URL}/{project.path_with_namespace}/-/merge_requests/{mr.iid}"
451         for discussion in mr.discussions.list():
452             # FIXME notes = [n for n in discussion.attributes['notes'] if n['type'] is not None]
453             notes = [n for n in discussion.attributes['notes']]
454             if not notes:
455                 continue
456
457             new_discussion = None
458             for note in notes:
459                 note = discussion.notes.get(note['id'])
460
461                 note_url = f"{mr_url}#note_{note.id}"
462                 when = dateparse.parse(
463                     note.created_at).strftime('on %d, %b %Y')
464                 body = f"**{note.author['name']} - {PING_SIGN}{note.author['username']} wrote [here]({note_url})** {when}:\n\n"
465                 body += '\n'.join([line for line in note.body.split('\n')])
466
467                 obj = {
468                     'body': body,
469                     'type': note.type,
470                     'resolvable': note.resolvable,
471                 }
472
473                 if new_discussion:
474                     new_discussion.notes.create(obj)
475                 else:
476                     new_discussion = new_mr.discussions.create(obj)
477
478                 if not note.resolvable or note.resolved:
479                     new_discussion.resolved = True
480                     new_discussion.save()
481
482         fprint(f"{green(' OK')}\n", nested=False)
483
484         print(f"New MR available at: {bold(new_mr_url)}\n")
485
486         return new_mr
487
488     def push_branch(self, branch):
489         fprint(
490             f"-> Pushing branch {branch} to remote {self.gl.user.username}...")
491         if self.git("push", "--no-verify", self.gl.user.username, branch,
492                     interaction_message=f"pushing {branch} to {self.gl.user.username} with:\n  "
493                     f" `$git push {self.gl.user.username} {branch}`") == "SKIP":
494             fprint(yellow("'SKIPPED' (couldn't push)"), nested=False)
495
496             return False
497
498         fprint(f"{green(' OK')}\n", nested=False)
499
500         return True
501
502     def create_branch_for_mr(self, branch, project, mr):
503         remote_name = project.name + '-' + self.gl.user.username
504         remote_branch = f"{MONOREPO_REMOTE_NAME}/{MONOREPO_BRANCH}"
505         if self.use_branch_if_exists:
506             try:
507                 self.git("checkout", branch)
508                 self.git("show", remote_branch + "..", call=True)
509                 if self.dry_run:
510                     fprint("Dry run... not creating MR")
511                     return True
512                 cont = input('\n     Create MR [y/n]? ')
513                 if cont.strip().lower() != 'y':
514                     fprint("Cancelled")
515                     return False
516                 return self.push_branch(branch)
517             except subprocess.CalledProcessError as e:
518                 pass
519
520         self.git("remote", "add", remote_name,
521                  f"{URL}{self.gl.user.username}/{project.name}.git", can_fail=True)
522         self.git("fetch", remote_name)
523
524         if self.git("checkout", remote_branch, "-b", branch,
525                     interaction_message=f"checking out branch with `git checkout {remote_branch} -b {branch}`") == "SKIP":
526             fprint(
527                 bold(f"{red('SKIPPED')} (couldn't checkout)\n"), nested=False)
528             return False
529
530         for commit in reversed([c for c in mr.commits()]):
531             if self.git("cherry-pick", commit.id,
532                         interaction_message=f"cherry-picking {commit.id} onto {branch} with:\n  "
533                         f" `$ git cherry-pick {commit.id}`",
534                         revert_operation=["cherry-pick", "--abort"]) == "SKIP":
535                 fprint(
536                     f"{yellow('SKIPPED')} (couldn't cherry-pick).", nested=False)
537                 return False
538
539         self.git("show", remote_branch + "..", call=True)
540         if self.dry_run:
541             fprint("Dry run... not creating MR\n")
542             return True
543         cont = input('\n     Create MR [y/n]? ')
544         if cont.strip().lower() != 'y':
545             fprint(f"{red('Cancelled')}\n", nested=False)
546             return False
547
548         return self.push_branch(branch)
549
550     def move_mrs(self, from_projects, to_project):
551         failed_mrs = []
552         found_mr = None
553         for from_project in from_projects:
554             with nested(f'{bold(from_project.path_with_namespace)}'):
555                 fprint(f'Fetching mrs')
556                 mrs = [mr for mr in from_project.mergerequests.list(
557                     all=True, author_id=self.gl.user.id) if mr.author['username'] == self.gl.user.username and mr.state == "opened"]
558                 if not mrs:
559                     fprint(f"{yellow(' None')}\n", nested=False)
560                     continue
561
562                 fprint(f"{green(' DONE')}\n", nested=False)
563
564                 for mr in mrs:
565                     if self.mr:
566                         if self.mr != mr.iid:
567                             continue
568                         found_mr = True
569                     fprint(
570                         f'Moving {mr.source_branch} "{mr.title}": {URL}{from_project.path_with_namespace}/merge_requests/{mr.iid}... ')
571                     if mr.source_branch in self.skipped_branches:
572                         print(f"{yellow('SKIPPED')} (blacklisted branch)")
573                         failed_mrs.append(
574                             f"{URL}{from_project.path_with_namespace}/merge_requests/{mr.iid}")
575                         continue
576                     if self.list_mrs_only:
577                         fprint("\n"f"List only: {yellow('SKIPPED')}\n")
578                         continue
579
580                     with nested(f'{bold(from_project.path_with_namespace)}: {mr.iid}'):
581                         new_mr = self.recreate_mr(from_project, to_project, mr)
582                         if not new_mr:
583                             if not self.dry_run:
584                                 failed_mrs.append(
585                                     f"{URL}{from_project.path_with_namespace}/merge_requests/{mr.iid}")
586                         else:
587                             fprint(f"{green(' OK')}\n", nested=False)
588
589                         self.close_mr(from_project, to_project, mr, new_mr)
590
591             fprint(
592                 f"\n{yellow('DONE')} with {from_project.path_with_namespace}\n\n", nested=False)
593
594         if self.mr and not found_mr:
595             sys.exit(
596                 bold(red(f"\n==> Couldn't find MR {self.mr} in {self.modules[0]}\n")))
597
598         for mr in failed_mrs:
599             fprint(f"Didn't move MR: {mr}\n")
600
601     def close_mr(self, project, to_project, mr, new_mr):
602         if new_mr:
603             new_mr_url = f"{URL}/{to_project.path_with_namespace}/-/merge_requests/{new_mr.iid}"
604         else:
605             new_mr_url = None
606         mr_url = f"{URL}/{project.path_with_namespace}/-/merge_requests/{mr.iid}"
607         cont = input(f'\n  Close old MR {mr_url} "{bold(mr.title)}" ? [y/n]')
608         if cont.strip().lower() != 'y':
609             fprint(f"{yellow('Not closing old MR')}\n")
610         else:
611             obj = None
612             if new_mr_url:
613                 obj = {'body': f"Moved to: {new_mr_url}"}
614             else:
615                 ret = input(
616                     f"Write a comment to add while closing MR {mr.iid} '{bold(mr.title)}':\n\n").strip()
617                 if ret:
618                     obj = {'body': ret}
619
620             if self.dry_run:
621                 fprint(f"{bold('Dry run, not closing')}\n", nested=False)
622             else:
623                 if obj:
624                     mr.discussions.create(obj)
625                 mr.state_event = 'close'
626                 mr.save()
627                 fprint(
628                     f'Old MR {mr_url} "{bold(mr.title)}" {yellow("CLOSED")}\n')
629
630     def setup_repo(self):
631         fprint(f"Setting up '{bold(ROOT_DIR)}'...")
632
633         try:
634             out = self.git("status", "--porcelain")
635             if out:
636                 fprint("\n" + red('Git repository is not clean:')
637                        + "\n```\n" + out + "\n```\n")
638                 sys.exit(1)
639
640         except Exception as e:
641             exit(
642                 f"Git repository{ROOT_DIR} is not clean. Clean it up before running {sys.argv[0]}\n ({e})")
643
644         self.git('remote', 'add', MONOREPO_REMOTE_NAME,
645                  MONOREPO_REMOTE, can_fail=True)
646         self.git('fetch', MONOREPO_REMOTE_NAME)
647
648         self.git('remote', 'add', self.gl.user.username,
649                  f"git@gitlab.freedesktop.org:{self.gl.user.username}/gstreamer.git", can_fail=True)
650         self.git('fetch', self.gl.user.username,
651                  interaction_message=f"Setup your fork of {URL}gstreamer/gstreamer as remote called {self.gl.user.username}")
652         fprint(f"{green(' OK')}\n", nested=False)
653
654         try:
655             git_rename_limit = int(self.git("config", "merge.renameLimit"))
656         except subprocess.CalledProcessError:
657             git_rename_limit = 0
658         if int(git_rename_limit) < 999999:
659             self.git_rename_limit = git_rename_limit
660             fprint(
661                 "-> Setting git rename limit to 999999 so we can properly cherry-pick between repos\n")
662             self.git("config", "merge.renameLimit", "999999")
663
664
665 def main():
666     mover = GstMRMover()
667     PARSER.parse_args(namespace=mover)
668     mover.run()
669
670
671 if __name__ == '__main__':
672     main()