Allow unstaged files to be reverted

This commit is contained in:
Nick O'Leary
2017-12-11 17:05:12 +00:00
parent 604e3068b2
commit bb59cd5742
8 changed files with 180 additions and 81 deletions

View File

@@ -170,6 +170,22 @@ module.exports = {
})
});
// Revert a file
app.delete("/:id/files/_/*", needsPermission("projects.write"), function(req,res) {
var projectId = req.params.id;
var filePath = req.params[0];
runtime.storage.projects.revertFile(req.user, projectId,filePath).then(function() {
res.status(204).end();
})
.catch(function(err) {
console.log(err.stack);
res.status(400).json({error:"unexpected_error", message:err.toString()});
})
});
// Stage a file
app.post("/:id/stage/*", needsPermission("projects.write"), function(req,res) {
var projectName = req.params.id;