-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path__main__.py
32 lines (25 loc) · 1.04 KB
/
__main__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from bitbucket import Bitbucket
from local import Local
from github import Github
from cli_args import get_cli_args
from git import Git
if __name__ == '__main__':
args = get_cli_args()
git = Git(args.storage_path)
inputs = outputs = {
'bitbucket': Bitbucket(args.bitbucket_login, args.bitbucket_password),
'github': Github(args.github_login, args.github_password),
'local': Local(args.storage_path)
}
vcs_input = inputs[args.input]
vcs_output = outputs[args.output]
migrated_repositories = vcs_input.get_repositories()
for source_repository in migrated_repositories:
print(source_repository)
if vcs_output.repository_exists(source_repository):
continue
destination_repository = vcs_output.create_repository(source_repository)
cloned_source_repository = git.download(source_repository)
if destination_repository.supports_transfer:
git.upload(cloned_source_repository, destination_repository)
git.cleanup(cloned_source_repository)