2017-08-17 56 views

回答

0

我想通了。 Commit模型可以檢索一個Diffs數組,然後可以檢索一個Patches數組。補片模型有一個稱爲lineStats()函數將返回包含下列鍵和值的對象:

{ total_context: 8, total_additions: 11, total_deletions: 12 } 

這裏的一個示例:

return commit.getDiff().then(function (diffList: any) { 
    return Promise.all(diffList.map(function (diff: any) { 
     return diff.patches().then(function (patches: any) { 
      return Promise.all(patches.map(function (patch: any) { 
       console.log('Line Stats: ', patch.lineStats()) 
      }) 
     }) 
    }) 
}) 
相關問題