Commit fc7a7c2c authored by James C Bowden's avatar James C Bowden
Browse files

debugging

parent 1c1d80b7
No related merge requests found
Showing with 40 additions and 1 deletion
+40 -1
......@@ -20,8 +20,8 @@ http.createServer((req, res) => {
}
// handle cases
if(req_obj.url == '/new_repository'){
// make empty repo if dne
// check if name already exists
// if(repo_names.includes(req_obj.name)){
if(repos.has(req_obj.name)){
throw 'Repository already exists!'
}
......@@ -35,6 +35,7 @@ http.createServer((req, res) => {
}
}
else if(req_obj.url == '/fetch'){
// don't need to alter anything, just get newest commits.
let obj
// check if name is actual repo
if(!repos.has(req_obj.name)){
......@@ -70,9 +71,47 @@ http.createServer((req, res) => {
}
}
else if(req_obj.url == '/commit'){
//
let obj
// check if name is actual repo
if(!repos.has(req_obj.name)){
throw 'Repository does not exist.'
}
else{
// get json object
obj = async () => {
obj = await JSON.parse(repos[req_obj.name])
}
}
// check if head == pID
let present = false
let no_coms = true
if(req_obj.parentID != null){
no_coms = false
}
for(com of obj.commits){
if(req_obj.parentID == com.id){
present = true
break
}
}
if(!present && !no_coms){
throw 'Most recent commit does not exist in repository.'
}
else{
let head = obj_commits[obj_commits.length - 1]
if(head == req_obj.parentID){
// do normally--add this to the commit list, change files by diff.
}
else{
// merge
// try(mergefilediffs)
// catch(error)
// write errror
}
}
let id = require('crypto').randomBytes(16).toString('hex')
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment