| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,78 +31,6 @@ class GitDiffList : public ObjectWrap { | |||
| 31 | 31 | static Handle<Value> New(const Arguments& args); | |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | - static Handle<Value> TreeToTree(const Arguments& args); | ||
| 35 | - static void TreeToTreeWork(uv_work_t* req); | ||
| 36 | - static void TreeToTreeAfterWork(uv_work_t* req); | ||
| 37 | - | ||
| 38 | - struct TreeToTreeBaton { | ||
| 39 | - uv_work_t request; | ||
| 40 | - int error_code; | ||
| 41 | - const git_error* error; | ||
| 42 | - git_diff_list * diff; | ||
| 43 | - Persistent<Value> repoReference; | ||
| 44 | - git_repository * repo; | ||
| 45 | - Persistent<Value> old_treeReference; | ||
| 46 | - git_tree * old_tree; | ||
| 47 | - Persistent<Value> new_treeReference; | ||
| 48 | - git_tree * new_tree; | ||
| 49 | - Persistent<Value> optsReference; | ||
| 50 | - const git_diff_options * opts; | ||
| 51 | - Persistent<Function> callback; | ||
| 52 | - }; | ||
| 53 | - static Handle<Value> TreeToIndex(const Arguments& args); | ||
| 54 | - static void TreeToIndexWork(uv_work_t* req); | ||
| 55 | - static void TreeToIndexAfterWork(uv_work_t* req); | ||
| 56 | - | ||
| 57 | - struct TreeToIndexBaton { | ||
| 58 | - uv_work_t request; | ||
| 59 | - int error_code; | ||
| 60 | - const git_error* error; | ||
| 61 | - git_diff_list * diff; | ||
| 62 | - Persistent<Value> repoReference; | ||
| 63 | - git_repository * repo; | ||
| 64 | - Persistent<Value> old_treeReference; | ||
| 65 | - git_tree * old_tree; | ||
| 66 | - Persistent<Value> indexReference; | ||
| 67 | - git_index * index; | ||
| 68 | - Persistent<Value> optsReference; | ||
| 69 | - const git_diff_options * opts; | ||
| 70 | - Persistent<Function> callback; | ||
| 71 | - }; | ||
| 72 | - static Handle<Value> IndexToWorkdir(const Arguments& args); | ||
| 73 | - static void IndexToWorkdirWork(uv_work_t* req); | ||
| 74 | - static void IndexToWorkdirAfterWork(uv_work_t* req); | ||
| 75 | - | ||
| 76 | - struct IndexToWorkdirBaton { | ||
| 77 | - uv_work_t request; | ||
| 78 | - int error_code; | ||
| 79 | - const git_error* error; | ||
| 80 | - git_diff_list * diff; | ||
| 81 | - Persistent<Value> repoReference; | ||
| 82 | - git_repository * repo; | ||
| 83 | - Persistent<Value> indexReference; | ||
| 84 | - git_index * index; | ||
| 85 | - Persistent<Value> optsReference; | ||
| 86 | - const git_diff_options * opts; | ||
| 87 | - Persistent<Function> callback; | ||
| 88 | - }; | ||
| 89 | - static Handle<Value> TreeToWorkdir(const Arguments& args); | ||
| 90 | - static void TreeToWorkdirWork(uv_work_t* req); | ||
| 91 | - static void TreeToWorkdirAfterWork(uv_work_t* req); | ||
| 92 | - | ||
| 93 | - struct TreeToWorkdirBaton { | ||
| 94 | - uv_work_t request; | ||
| 95 | - int error_code; | ||
| 96 | - const git_error* error; | ||
| 97 | - git_diff_list * diff; | ||
| 98 | - Persistent<Value> repoReference; | ||
| 99 | - git_repository * repo; | ||
| 100 | - Persistent<Value> old_treeReference; | ||
| 101 | - git_tree * old_tree; | ||
| 102 | - Persistent<Value> optsReference; | ||
| 103 | - const git_diff_options * opts; | ||
| 104 | - Persistent<Function> callback; | ||
| 105 | - }; | ||
| 106 | 34 | static Handle<Value> Merge(const Arguments& args); | |
| 107 | 35 | static Handle<Value> FindSimilar(const Arguments& args); | |
| 108 | 36 | static Handle<Value> Size(const Arguments& args); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -119,6 +119,23 @@ class GitIndex : public ObjectWrap { | |||
| 119 | 119 | static Handle<Value> ConflictRemove(const Arguments& args); | |
| 120 | 120 | static Handle<Value> ConflictCleanup(const Arguments& args); | |
| 121 | 121 | static Handle<Value> HasConflicts(const Arguments& args); | |
| 122 | + static Handle<Value> IndexToWorkdir(const Arguments& args); | ||
| 123 | + static void IndexToWorkdirWork(uv_work_t* req); | ||
| 124 | + static void IndexToWorkdirAfterWork(uv_work_t* req); | ||
| 125 | + | ||
| 126 | + struct IndexToWorkdirBaton { | ||
| 127 | + uv_work_t request; | ||
| 128 | + int error_code; | ||
| 129 | + const git_error* error; | ||
| 130 | + git_diff_list * diff; | ||
| 131 | + Persistent<Value> repoReference; | ||
| 132 | + git_repository * repo; | ||
| 133 | + Persistent<Value> indexReference; | ||
| 134 | + git_index * index; | ||
| 135 | + Persistent<Value> optsReference; | ||
| 136 | + const git_diff_options * opts; | ||
| 137 | + Persistent<Function> callback; | ||
| 138 | + }; | ||
| 122 | 139 | git_index *raw; | |
| 123 | 140 | }; | |
| 124 | 141 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,6 +51,61 @@ class GitTree : public ObjectWrap { | |||
| 51 | 51 | const char * path; | |
| 52 | 52 | Persistent<Function> callback; | |
| 53 | 53 | }; | |
| 54 | + static Handle<Value> DiffTree(const Arguments& args); | ||
| 55 | + static void DiffTreeWork(uv_work_t* req); | ||
| 56 | + static void DiffTreeAfterWork(uv_work_t* req); | ||
| 57 | + | ||
| 58 | + struct DiffTreeBaton { | ||
| 59 | + uv_work_t request; | ||
| 60 | + int error_code; | ||
| 61 | + const git_error* error; | ||
| 62 | + git_diff_list * diff; | ||
| 63 | + Persistent<Value> repoReference; | ||
| 64 | + git_repository * repo; | ||
| 65 | + Persistent<Value> old_treeReference; | ||
| 66 | + git_tree * old_tree; | ||
| 67 | + Persistent<Value> new_treeReference; | ||
| 68 | + git_tree * new_tree; | ||
| 69 | + Persistent<Value> optsReference; | ||
| 70 | + const git_diff_options * opts; | ||
| 71 | + Persistent<Function> callback; | ||
| 72 | + }; | ||
| 73 | + static Handle<Value> DiffIndex(const Arguments& args); | ||
| 74 | + static void DiffIndexWork(uv_work_t* req); | ||
| 75 | + static void DiffIndexAfterWork(uv_work_t* req); | ||
| 76 | + | ||
| 77 | + struct DiffIndexBaton { | ||
| 78 | + uv_work_t request; | ||
| 79 | + int error_code; | ||
| 80 | + const git_error* error; | ||
| 81 | + git_diff_list * diff; | ||
| 82 | + Persistent<Value> repoReference; | ||
| 83 | + git_repository * repo; | ||
| 84 | + Persistent<Value> old_treeReference; | ||
| 85 | + git_tree * old_tree; | ||
| 86 | + Persistent<Value> indexReference; | ||
| 87 | + git_index * index; | ||
| 88 | + Persistent<Value> optsReference; | ||
| 89 | + const git_diff_options * opts; | ||
| 90 | + Persistent<Function> callback; | ||
| 91 | + }; | ||
| 92 | + static Handle<Value> DiffWorkDir(const Arguments& args); | ||
| 93 | + static void DiffWorkDirWork(uv_work_t* req); | ||
| 94 | + static void DiffWorkDirAfterWork(uv_work_t* req); | ||
| 95 | + | ||
| 96 | + struct DiffWorkDirBaton { | ||
| 97 | + uv_work_t request; | ||
| 98 | + int error_code; | ||
| 99 | + const git_error* error; | ||
| 100 | + git_diff_list * diff; | ||
| 101 | + Persistent<Value> repoReference; | ||
| 102 | + git_repository * repo; | ||
| 103 | + Persistent<Value> old_treeReference; | ||
| 104 | + git_tree * old_tree; | ||
| 105 | + Persistent<Value> optsReference; | ||
| 106 | + const git_diff_options * opts; | ||
| 107 | + Persistent<Function> callback; | ||
| 108 | + }; | ||
| 54 | 109 | git_tree *raw; | |
| 55 | 110 | }; | |
| 56 | 111 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -161,7 +161,7 @@ Commit.prototype.history = function() { | |||
| 161 | 161 | event.emit('commit', null, commit); | |
| 162 | 162 | commits.push(commit); | |
| 163 | 163 | }); | |
| 164 | - } | ||
| 164 | + }; | ||
| 165 | 165 | return event; | |
| 166 | 166 | }; | |
| 167 | 167 | ||
@@ -183,7 +183,7 @@ Commit.prototype.parents = function(callback) { | |||
| 183 | 183 | ||
| 184 | 184 | rawCommit.parent(n, function nextParent(error, rawParentCommit) { | |
| 185 | 185 | if (error) return callback(error); | |
| 186 | - processParents(rawParentCommit, n-1, acc.concat([new Commit(self.repo, rawParentCommit)]), callback) | ||
| 186 | + processParents(rawParentCommit, n-1, acc.concat([new Commit(self.repo, rawParentCommit)]), callback); | ||
| 187 | 187 | }); | |
| 188 | 188 | } | |
| 189 | 189 | ||
@@ -214,7 +214,7 @@ Commit.prototype.parentsDiffTrees = function(callback) { | |||
| 214 | 214 | self.getTree(function(error, thisTree) { | |
| 215 | 215 | if (error) return callback(error); | |
| 216 | 216 | ||
| 217 | - git.diffList.treeToTree(self.repo, parentTree, thisTree, function walkDiffList(error, diffList) { | ||
| 217 | + parentTree.diff(thisTree, function walkDiffList(error, diffList) { | ||
| 218 | 218 | if (error) return callback(error); | |
| 219 | 219 | ||
| 220 | 220 | parentDiffLists.push(diffList); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,14 +49,6 @@ DiffList.LineOrigin = { | |||
| 49 | 49 | /** 'B' */ Binary: 102 | |
| 50 | 50 | }; | |
| 51 | 51 | ||
| 52 | - DiffList.treeToTree = function(repo, oldTree, newTree, callback) { | ||
| 53 | - git.raw.DiffList.treeToTree(repo.rawRepo, oldTree.rawTree, newTree.rawTree, null, function(error, rawDiffList) { | ||
| 54 | - if (error) return callback(new git.error(error.message, error.code), null); | ||
| 55 | - | ||
| 56 | - callback(null, new DiffList(rawDiffList)); | ||
| 57 | - }); | ||
| 58 | - }; | ||
| 59 | - | ||
| 60 | 52 | ||
| 61 | 53 | /** | |
| 62 | 54 | * Retrieve patches | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,7 +44,18 @@ Tree.prototype.entry = function(path, callback) { | |||
| 44 | 44 | * Retrieve the number of entries in this tree. | |
| 45 | 45 | */ | |
| 46 | 46 | Tree.prototype.size = function() { | |
| 47 | - return self.rawTree.size(); | ||
| 47 | + return this.rawTree.size(); | ||
| 48 | + }; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * Diff two trees | ||
| 52 | + */ | ||
| 53 | + Tree.prototype.diff = function(that, callback) { | ||
| 54 | + this.rawTree.diffTree(this.repo.rawRepo, that.rawTree, null, function(error, rawDiffList) { | ||
| 55 | + if (error) return callback(error); | ||
| 56 | + | ||
| 57 | + callback(null, new git.diffList(rawDiffList)); | ||
| 58 | + }); | ||
| 48 | 59 | }; | |
| 49 | 60 | ||
| 50 | 61 | /** | |
| Back | FazBrowse Home | New Git URL |
0 commit comments