Closed ZAM- closed 10 years ago
@jkwendt needs to sign off on this.
Looking good.
Hey would it be possible to get the
function git(array $arglist);
part of the git commands done before the other ones, because that is the one I think I will need the most testing, etc for integrating with.
If this is actually the function you will need to do your testing, then yes I will move it up the priority list. I say "if" here because you said you 'think' that you will need this for the testing.
Can you give me an example of what you're expecting to pass to the function? In other words, give me a few examples of what the contents of arglist is going to be. I want to make sure we are on the same page here.
Thank you, ZAM
On Fri, Feb 14, 2014 at 4:46 PM, Samuel French notifications@github.comwrote:
Hey would it be possible to get the 'function git(array $arglist);' part of the git commands done before the other ones, because that is the one I think I will need the most testing, etc for integrating with.
Reply to this email directly or view it on GitHubhttps://github.com/CSC495-2014/TeamworkEnglewoodGit/pull/57#issuecomment-35132692 .
I will review and merge this as soon as I can this weekend, but I am going to be quite busy from now until tomorrow night. On Feb 14, 2014 4:59 PM, "Zachary Mance" notifications@github.com wrote:
If this is actually the function you will need to do your testing, then yes I will move it up the priority list. I say "if" here because you said you 'think' that you will need this for the testing.
Can you give me an example of what you're expecting to pass to the function? In other words, give me a few examples of what the contents of arglist is going to be. I want to make sure we are on the same page here.
Thank you, ZAM
On Fri, Feb 14, 2014 at 4:46 PM, Samuel French <notifications@github.com
wrote:
Hey would it be possible to get the 'function git(array $arglist);' part of the git commands done before the other ones, because that is the one I think I will need the most testing, etc for integrating with.
Reply to this email directly or view it on GitHub< https://github.com/CSC495-2014/TeamworkEnglewoodGit/pull/57#issuecomment-35132692
.
Reply to this email directly or view it on GitHubhttps://github.com/CSC495-2014/TeamworkEnglewoodGit/pull/57#issuecomment-35133531 .
I say think because there is always the possibility I am going about this the complete wrong way
here is my controller so far, obviously not finished
<?php
/*
By Sam French
*/
/*
NOTE: Check for "TODO" notes in file to find unfinished sections
gitref.org - reference for git commands
*/
/*
TODO:
1. Do I need to check that my input parameters exist?
2. Make sure I am grabbing user and project correctly
3. Add JSON responses once the format is finalized
4. Probably will need to do something with the return values of the file system commands
5. Verify the git commands don't need "git" as the first arg
*/
class GitController extends BaseController {
/*
Parameters from Routes URL Path
*/
/*
Stage file(s) for commit
*/
public function stageFiles(){
//TODO:
var $path = Input.get("item"); //returns the path to the item being staged
//TODO:
//$user - make sure we can use $user automatically because it is a route parameter
//^ same with $project
gitAdd($user, $project, $path); //figure out if there is return type/value - update: i think it's a string of the output on the command line
//Build new JSON object to return to the route caller
//var JSONObj = { "name" : "valuepairs", "val2"};
//items to send: username, project, success code, files added (guess)
//probably need to store into a php map and then use json encode functionality
$array = array
(
"user" => $user,
"project" => $project,
"path" => $path,
"success" => true,
"filesAdded" => //insert list of files here
);
//return JSON object
}
/*
Commit staged files.
*/
public function commit(){
//get the users commit message
var $msg = Input.get("message");
//commit on the file system
gitCommit($user,$project,$msg);
//JSON Response
}
/*
Push branch to server
*/
public function push(){
/* Syntax:
git push [alias] [branch]
will attempt to make your [branch] the new [branch] on the [alias] remote.
*/
//get remote alias
var $ra = Input.get("remote"); //returns origin
//get remote branch
var $rb = Input.get("branch"); //returns master
//push on the file system
gitPush($user,$project,$ra,$rb);
//JSON response
}
/*
Merge current branch with other branch
*/
public function merge(){
/* Syntax:
git merge [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
[-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
-m <msg> - Set the commit message to be used for the merge commit (in case one is created).
*/
//get feature message
//TODO: make sure this is what the parameter is giving me
var $feature = Input.get("branch");
//call merge on file system
//returns: the output from the command line as a string of text
git(['merge',$feature]); //note: the git command takes an array of shell escaped args
//JSON Response
}
/*
Pull changes from remote repository into current branch
*/
public function pull(){
//get remote alias
var $ra = Input.get("remote"); //returns origin
//get remote branch
var $rb = Input.get("branch"); //returns master
//pull from the file system
gitPull($user,$project,$ra,$rb);
//todo: probably need to grab data from file system to put into JSON response
//JSON Response
}
/*
Get list of branches and current branch
*/
public function getBranch(){
//TODO: Make sure we want to display all local and remote branches, not just local
//Maybe not because we have the list remote repos command
//call branch command with the "all local and remote" flag
//returns a string (TODO: maybe array, double check) containing all remote and local branches
var $branchListing = git(['branch','-a']);
//JSON Response
}
/*
Create a new branch
*/
public function createBranch(){
/* Syntax:
git branch (branchname)
function: Creates a new branch with the specified name (and switches to it? TODO)
*/
//get the name to use when creating the new branch
var $nBranch = Input.get("branch");
//create the new branch with the specified name on the file system
git(['branch',"'"$nbranch"'"]); //TODO: Make sure I shell escaped the variable param correctly
//JSON Response
}
/*
Delete a branch
*/
public function deleteBranch(){
/* Syntax:
git branch -d the_local_branch
*/
//get the name of the branch to delete
var $dBranch = Input.get("branch");
//delete the branch (uses custom git command)
git(['branch','-d',"'"$dBranch"'"]);
//JSON response
}
/*
Checkout a branch
*/
public function checkoutBranch(){
/*
IGNORE THIS, WE SHOULD USE THE CHECKOUT COMMAND
1. Fetch the branch - (ex. git fetch origin)
2. Check out the branch from the remote branches - (ex. git checkout -b test origin/test)
*/
/* Syntax:
git checkout -b (branchname)
*/
//get name of branch to checkout
var $bName = Input.get("branch");
git(['checkout','-b',"'"$bName"'"]); //TODO: find out if I need to check for success or failure
//JSON Response
}
/*
List past commits from current branch
*/
public function listBranchCommits(){
/* Syntax:
git branch -v
*/
//get past commits
var $pastCommits = git(['git','branch','-v']);
//JSON Response
}
/*
Download changes from a remote repository
*/
public function downloadChanges(){
//JSON Response
}
/*
List remote repositories
*/
public function listRemoteRepos(){
/*
git remote - shows the stored remote repository aliases
TODO: add -v switch if we want to get the urls too
*/
var $remoteList = git(['remote']);
//JSON Response
}
/*
Create a new remote repository
*/
public function createNewRemoteRepo(){
/* Syntax:
git remote add [alias] [url]
That adds [url] under a local remote named [alias]
*/
//get alias from request
var $alias = Input.get("remote");
//get url from request - returns url for remote repository
var $url = Input.get("url");
//create the remote repository (using our custom git command)
git(['remote','add',"'"$alias"'","'"$url"'"]);
//JSON Response
}
/*
Delete a specified remote repository
*/
public function deleteRemoteRepo(){
/* Syntax:
git remote rm [alias]
Where [alias] is the remote repository name to be deleted
*/
//get alias of remote repo to delete
var $alias = Input.get("remote");
//delete the remote repository
git(['remote','rm'"'"$alias"'"]);
//JSON Response
}
/*
Run a custom git command
*/
public function customCmd(){
/* Notes:
["list","of","args"]
Probably need to build an array of the args from the request parameters and then
build a string from them where we have each arg shell escaped with quotation marks
TODO
*/
//JSON Response
}
}
and I want to write the part for parsing the response asap so I can then write the JSON responses as soon as Mike tells me what he wants in them
argslist is an array of strings with quotes around them.
i've had this done on tuesday and all week been trying to figure out what I can do next considering I want to have at least a week to do final testing at the end.
I was going to try to test the http request/responses but i'm not sure what I'm looking for because I'm not sure if my parameters being passed is done, any of the FS functionality is done, or the code I'm passing the JSON responses too are done.
oh, and I realize I didn't do adding the quotes correctly, just took another look
but it's going to be
["list","of","args"]
@samuelfrench your controller does not belong in this pull request, especially since you are not asking specific questions about how to integrate it with what Zach wrote. Pull requests are for critiquing the code attached. If you feel you need to ask about it still, please open another issue for it.
Excellent pull request! I've left a couple of comments in line, but most of them are minor. In addition to those comments, I ask that you git rm
the testing project and files. Those should not be tracked in git. I'll look at this again tonight if you have the changes in by then.
Any news on the ETA for this @ZAM- and @jkwendt?
@samuelfrench your controller does not belong in this pull request, especially since you are not asking specific questions about how to integrate it with what Zach wrote. Pull requests are for critiquing the code attached. If you feel you need to ask about it still, please open another issue for it.
Ok, still learning all of this.
I'll be working on the code today. @jkwednt is working on the copy() and save() methods. I expect him to have a merge request by today.
ZAM
On Sun, Feb 16, 2014 at 9:30 AM, Michael Holler notifications@github.comwrote:
Any news on the ETA for this @ZAM- https://github.com/ZAM- and @jkwendthttps://github.com/jkwendt ?
Reply to this email directly or view it on GitHubhttps://github.com/CSC495-2014/TeamworkEnglewoodGit/pull/57#issuecomment-35199427 .
Should be ready to merge. Does @jkwendt still need to sign off?
If so, I checked all the changes that @apotheos mentioned, seems to me that they were made and looks good.
The inclusion of the new library means you need to git add your composer.lock file, then commit and push it. Otherwise we will have a hard time using what you wrote. Do that, and I will accept. Sorry about these extra things, just making upstream/master stays clean :)
I've added the composer.lock file, but Travis says it's broken. After looking over the details, I don't know what it's complaining about.
Yeah, sorry about not making that clear. We only had a little bit of time to discuss it in class so I couldn't go over everything.
Regarding the Travis failure, I don't know what's going on either. Tomorrow's a work day, so let's try and figure it out together.
Sounds good to me Mike.
ZAM
On Mon, Feb 17, 2014 at 11:28 AM, Michael Holler notifications@github.comwrote:
Regarding the Travis failure, I don't know what's going on either. Tomorrow's a work day, so let's try and figure it out together.
Reply to this email directly or view it on GitHubhttps://github.com/CSC495-2014/TeamworkEnglewoodGit/pull/57#issuecomment-35305166 .
Travis is happy, and we're good to go now.
Awesome, thanks Zach! On Feb 18, 2014 11:14 AM, "Zachary Mance" notifications@github.com wrote:
Travis is happy, and we're good to go now.
Reply to this email directly or view it on GitHubhttps://github.com/CSC495-2014/TeamworkEnglewoodGit/pull/57#issuecomment-35408081 .
Made some syntax fixes along with some minor tests. I've also created a mock up user ("ZAM-") and a mock project for the user. In order to do some testing, in the project dir I created some example files that a user may have.