|
252 | 252 | _request("DELETE", repoPath + "/git/refs/"+ref, options, cb); |
253 | 253 | }; |
254 | 254 |
|
255 | | - // Create a repo |
| 255 | + // Create a repo |
256 | 256 | // ------- |
257 | 257 |
|
258 | 258 | this.createRepo = function(options, cb) { |
259 | 259 | _request("POST", "/user/repos", options, cb); |
260 | 260 | }; |
261 | 261 |
|
262 | | - // Delete a repo |
263 | | - // -------- |
| 262 | + // Delete a repo |
| 263 | + // -------- |
264 | 264 |
|
265 | | - this.deleteRepo = function(cb) { |
266 | | - _request("DELETE", repoPath, options, cb); |
| 265 | + this.deleteRepo = function(cb) { |
| 266 | + _request("DELETE", repoPath, options, cb); |
267 | 267 | }; |
268 | 268 |
|
269 | 269 | // List all tags of a repository |
|
455 | 455 | _request("POST", repoPath + "/forks", null, cb); |
456 | 456 | }; |
457 | 457 |
|
458 | | - // Branch repository |
459 | | - // -------- |
460 | | - |
| 458 | + // Branch repository |
| 459 | + // -------- |
| 460 | + |
461 | 461 | this.branch = function(oldBranch,newBranch,cb) { |
462 | 462 | if(arguments.length === 2 && typeof arguments[1] === "function") { |
463 | 463 | cb = newBranch; |
|
549 | 549 | }); |
550 | 550 | }); |
551 | 551 | }; |
552 | | - |
| 552 | + |
553 | 553 | // Delete a file from the tree |
554 | 554 | // ------- |
555 | | - |
| 555 | + |
556 | 556 | this.delete = function(branch, path, cb) { |
557 | 557 | that.getSha(branch, path, function(err, sha) { |
558 | 558 | if (!sha) return cb("not found", null); |
559 | 559 | var delPath = repoPath + "/contents/" + path; |
560 | 560 | var params = { |
561 | 561 | "message": "Deleted " + path, |
562 | | - "sha": sha |
| 562 | + "sha": sha |
563 | 563 | }; |
564 | 564 | delPath += "?message=" + encodeURIComponent(params.message); |
565 | 565 | delPath += "&sha=" + encodeURIComponent(params.sha); |
566 | 566 | _request("DELETE", delPath, null, cb); |
567 | 567 | }) |
568 | 568 | } |
569 | | - |
| 569 | + |
570 | 570 | // Move a file to a new location |
571 | 571 | // ------- |
572 | 572 |
|
|
0 commit comments