@@ -22,7 +22,7 @@ public function branches($project_id, array $parameters = [])
2222 */
2323 public function branch ($ project_id , $ branch_id )
2424 {
25- return $ this ->get ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .$ this ->encodeBranch ($ branch_id )));
25+ return $ this ->get ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .$ this ->encodePath ($ branch_id )));
2626 }
2727
2828 /**
@@ -46,7 +46,7 @@ public function createBranch($project_id, $branch, $ref)
4646 */
4747 public function deleteBranch ($ project_id , $ branch )
4848 {
49- return $ this ->delete ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .$ this ->encodeBranch ($ branch )));
49+ return $ this ->delete ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .$ this ->encodePath ($ branch )));
5050 }
5151
5252 /**
@@ -58,7 +58,7 @@ public function deleteBranch($project_id, $branch)
5858 */
5959 public function protectBranch ($ project_id , $ branch_name , $ devPush = false , $ devMerge = false )
6060 {
61- return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .$ this ->encodeBranch ($ branch_name ).'/protect ' ), array (
61+ return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .$ this ->encodePath ($ branch_name ).'/protect ' ), array (
6262 'developers_can_push ' => $ devPush ,
6363 'developers_can_merge ' => $ devMerge
6464 ));
@@ -71,7 +71,7 @@ public function protectBranch($project_id, $branch_name, $devPush = false, $devM
7171 */
7272 public function unprotectBranch ($ project_id , $ branch_name )
7373 {
74- return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .$ this ->encodeBranch ($ branch_name ).'/unprotect ' ));
74+ return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .$ this ->encodePath ($ branch_name ).'/unprotect ' ));
7575 }
7676
7777 /**
@@ -111,7 +111,7 @@ public function createTag($project_id, $name, $ref, $message = null)
111111 */
112112 public function createRelease ($ project_id , $ tag_name , $ description )
113113 {
114- return $ this ->post ($ this ->getProjectPath ($ project_id , 'repository/tags/ ' . $ this ->encodeBranch ($ tag_name ) . '/release ' ), array (
114+ return $ this ->post ($ this ->getProjectPath ($ project_id , 'repository/tags/ ' . $ this ->encodePath ($ tag_name ) . '/release ' ), array (
115115 'id ' => $ project_id ,
116116 'tag_name ' => $ tag_name ,
117117 'description ' => $ description
@@ -127,7 +127,7 @@ public function createRelease($project_id, $tag_name, $description)
127127 */
128128 public function updateRelease ($ project_id , $ tag_name , $ description )
129129 {
130- return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/tags/ ' . $ this ->encodeBranch ($ tag_name ) . '/release ' ), array (
130+ return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/tags/ ' . $ this ->encodePath ($ tag_name ) . '/release ' ), array (
131131 'id ' => $ project_id ,
132132 'tag_name ' => $ tag_name ,
133133 'description ' => $ description
@@ -279,7 +279,7 @@ public function compare($project_id, $fromShaOrMaster, $toShaOrMaster)
279279 {
280280 return $ this ->get ($ this ->getProjectPath (
281281 $ project_id ,
282- 'repository/compare?from= ' .$ this ->encodeBranch ($ fromShaOrMaster ).'&to= ' .$ this ->encodeBranch ($ toShaOrMaster )
282+ 'repository/compare?from= ' .$ this ->encodePath ($ fromShaOrMaster ).'&to= ' .$ this ->encodePath ($ toShaOrMaster )
283283 ));
284284 }
285285
@@ -422,15 +422,4 @@ public function archive($project_id, $params = array(), $format = 'tar.gz')
422422 {
423423 return $ this ->get ($ this ->getProjectPath ($ project_id , 'repository/archive. ' .$ format ), $ params );
424424 }
425-
426- /**
427- * @param string $path
428- * @return string
429- */
430- protected function encodeBranch ($ path )
431- {
432- $ path = $ this ->encodePath ($ path );
433-
434- return str_replace ('%2F ' , '/ ' , $ path );
435- }
436425}
0 commit comments