Merge "Implement inline edit REST API in PolyGerrit"
This commit is contained in:
@@ -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});
|
||||
|
@@ -595,5 +595,25 @@ limitations under the License.
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('saveChangeEdit', function(done) {
|
||||
var change_num = '1';
|
||||
var file_name = 'index.php';
|
||||
var file_contents = '<?php';
|
||||
sandbox.stub(element, 'send').returns(
|
||||
Promise.resolve([change_num, file_name, file_contents])
|
||||
);
|
||||
sandbox.stub(element, 'getResponseObject')
|
||||
.returns(Promise.resolve([change_num, file_name, file_contents]));
|
||||
element._cache['/changes/' + change_num + '/edit/' + file_name] = {};
|
||||
element.saveChangeEdit(change_num, file_name, file_contents).then(
|
||||
function() {
|
||||
assert.isTrue(element.send.calledWith('PUT',
|
||||
'/changes/' + change_num + '/edit/' + file_name,
|
||||
file_contents));
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user