forked from ezyang/ghstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_repo_name_with_owner.py.test
More file actions
90 lines (87 loc) · 2.73 KB
/
Copy pathget_repo_name_with_owner.py.test
File metadata and controls
90 lines (87 loc) · 2.73 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from ghstack.test_prelude import *
await init_test()
sh = get_sh()
await git("remote", "add", "normal", "git@github.com:ezyang/ghstack.git")
assert_eq(
await ghstack.github_utils.get_github_repo_name_with_owner(
sh=sh, github_url="github.com", remote_name="normal"
),
{"owner": "ezyang", "name": "ghstack"},
)
await git("remote", "add", "with-dot", "git@github.com:ezyang/ghstack.dotted.git")
assert_eq(
await ghstack.github_utils.get_github_repo_name_with_owner(
sh=sh, github_url="github.com", remote_name="with-dot"
),
{"owner": "ezyang", "name": "ghstack.dotted"},
)
await git("remote", "add", "https", "https://github.com/ezyang/ghstack")
assert_eq(
await ghstack.github_utils.get_github_repo_name_with_owner(
sh=sh, github_url="github.com", remote_name="https"
),
{"owner": "ezyang", "name": "ghstack"},
)
await git(
"remote",
"add",
"https-with-dotgit",
"https://github.com/ezyang/ghstack.git",
)
assert_eq(
await ghstack.github_utils.get_github_repo_name_with_owner(
sh=sh, github_url="github.com", remote_name="https-with-dotgit"
),
{"owner": "ezyang", "name": "ghstack"},
)
await git(
"remote",
"add",
"https-with-dot",
"https://github.com/ezyang/ghstack.dotted",
)
assert_eq(
await ghstack.github_utils.get_github_repo_name_with_owner(
sh=sh, github_url="github.com", remote_name="https-with-dot"
),
{"owner": "ezyang", "name": "ghstack.dotted"},
)
await git(
"remote",
"add",
"https-with-dot-with-dotgit",
"https://github.com/ezyang/ghstack.dotted.git",
)
assert_eq(
await ghstack.github_utils.get_github_repo_name_with_owner(
sh=sh,
github_url="github.com",
remote_name="https-with-dot-with-dotgit",
),
{"owner": "ezyang", "name": "ghstack.dotted"},
)
await git("remote", "add", "with-leading-slash", "git@github.com:/ezyang/ghstack.git")
assert_eq(
await ghstack.github_utils.get_github_repo_name_with_owner(
sh=sh, github_url="github.com", remote_name="with-leading-slash"
),
{"owner": "ezyang", "name": "ghstack"},
)
# The classic "git" SSH user.
await git("remote", "add", "ssh-git-user", "git@github.com:pytorch/pytorch.git")
assert_eq(
await ghstack.github_utils.get_github_repo_name_with_owner(
sh=sh, github_url="github.com", remote_name="ssh-git-user"
),
{"owner": "pytorch", "name": "pytorch"},
)
# The newer org-scoped SSH user (see ezyang/ghstack#360).
await git(
"remote", "add", "ssh-org-user", "org-21003710@github.com:pytorch/pytorch.git"
)
assert_eq(
await ghstack.github_utils.get_github_repo_name_with_owner(
sh=sh, github_url="github.com", remote_name="ssh-org-user"
),
{"owner": "pytorch", "name": "pytorch"},
)