@@ -91,12 +91,15 @@ def enable_pull_request(self, project):
9191 options = {"pull_requests" : True }
9292 self .post ("%s/options/update" % project , options )
9393
94- def create_fork (self , _ ):
95- class ForkedRepo :
96- clone_url = "ssh://git@%s/forks/%s/%s.git" % (
97- self .host , self .user , self .reponame_to_fork )
98- html_url = "https://%s/%s" % (self .host , self .fork_path )
94+ def get_repo_urls (self , reponame ):
95+ urls = self .get ("{}/git/urls" .format (reponame ))["urls" ]
96+ if "ssh" not in urls :
97+ raise RuntimeError ("%s: no ssh urls to push" % self .reponame )
98+ return type ('ForkedRepo' , (object ,), dict (
99+ clone_url = urls ["ssh" ].format (username = self .user ),
100+ html_url = urls ["git" ]))
99101
102+ def create_fork (self , _ ):
100103 LOG .debug ("check if the fork already exists" )
101104 if not self .get (self .fork_path , error_ok = True ):
102105 LOG .info ("requesting a fork creation" )
@@ -109,7 +112,7 @@ class ForkedRepo:
109112 self .post ("fork" ,
110113 {"repo" : repo , "namespace" : namespace , "wait" : True })
111114 self .enable_pull_request (self .fork_path )
112- return ForkedRepo
115+ return self . get_repo_urls ( self . fork_path )
113116
114117 def get_pulls (self , base , head ):
115118 class Pull :
0 commit comments