diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js index e2f63c654c..95fa2a7a47 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js @@ -666,6 +666,58 @@ return this.send('POST', url, review, opt_errFn, opt_ctx); }, + getFileInChangeEdit: function(changeNum, path) { + return this.send('GET', + this.getChangeActionURL(changeNum, null, + '/edit/' + encodeURIComponent(path) + )); + }, + + rebaseChangeEdit: function(changeNum) { + return this.send('POST', + this.getChangeActionURL(changeNum, null, + '/edit:rebase' + )); + }, + + deleteChangeEdit: function(changeNum) { + return this.send('DELETE', + this.getChangeActionURL(changeNum, null, + '/edit' + )); + }, + + restoreFileInChangeEdit: function(changeNum, restore_path) { + return this.send('POST', + this.getChangeActionURL(changeNum, null, '/edit'), + {restore_path: restore_path} + ); + }, + + renameFileInChangeEdit: function(changeNum, old_path, new_path) { + return this.send('POST', + this.getChangeActionURL(changeNum, null, '/edit'), + {old_path: old_path}, + {new_path: new_path} + ); + }, + + deleteFileInChangeEdit: function(changeNum, path) { + return this.send('DELETE', + this.getChangeActionURL(changeNum, null, + '/edit/' + encodeURIComponent(path) + )); + }, + + saveChangeEdit: function(changeNum, path, contents) { + return this.send('PUT', + this.getChangeActionURL(changeNum, null, + '/edit/' + encodeURIComponent(path) + ), + contents + ); + }, + saveChangeCommitMessageEdit: function(changeNum, message) { var url = this.getChangeActionURL(changeNum, null, '/edit:message'); return this.send('PUT', url, {message: message}); diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.html b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.html index 31a98d9e1f..0ff162d137 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.html +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.html @@ -595,5 +595,25 @@ limitations under the License. }); }); }); + + test('saveChangeEdit', function(done) { + var change_num = '1'; + var file_name = 'index.php'; + var file_contents = '