|
From: SourceForge.net <no...@so...> - 2008-08-09 20:21:12
|
Feature Requests item #2031734, was opened at 2008-07-29 14:31 Message generated for change (Comment added) made by ma1683 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1089902&aid=2031734&group_id=233450 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 7 Private: No Submitted By: Paul M Bethe (pbethe) Assigned to: Nobody/Anonymous (nobody) Summary: GitStatusResponse API Initial Comment: None of the methods in the GitStatus Response really do what I want: I have a list/array of files. I want to call GitStatus once, then iterate over my list and get the status of each file. eg. GitStatusResponse gsr = new GitStatus().status(myroot); for (File f : myfileList) { stat.add(gsr.getStatus(f)); } or something like that. Currently that does not seem to be possible in the existing api. ---------------------------------------------------------------------- >Comment By: Maxim A. (ma1683) Date: 2008-08-09 16:21 Message: Logged In: YES user_id=2155661 Originator: NO I have added a new method to GitStatusResponse class: getFileStatus(), which takes java.io.File object as a parameter and return GitFileSystemObject.Status value. For the simplest example, check out getFileStatus() in GitStatus.java (/javagit/trunk/javagit/src/main/java/edu/nyu/cs/javagit/api/commands). That should allow you to query the status of any file the way you wanted. ---------------------------------------------------------------------- Comment By: Maxim A. (ma1683) Date: 2008-08-02 14:06 Message: Logged In: YES user_id=2155661 Originator: NO Paul, I apologize, I actually misunderstood your original question. However, if you use API, you can still get list of GitFileSystemObjects from WorkingTree (getTree()) and then iterate through the list and call getStatus() on each object. There is one complication: you have to check if GitFileSystemObject object is a GitFile object, and then convert it to one, before you call getStatus(). ---------------------------------------------------------------------- Comment By: Maxim A. (ma1683) Date: 2008-08-02 13:52 Message: Logged In: YES user_id=2155661 Originator: NO There is a different way to get the status of the of a file. You can use higher level API. WorkingTree class has a method GitFile getFile(File file), which returns you an instance of GitFile. You can then simply call GitFile's getStatus() method. If you really do not want to use that API, I've also recently added a new method to GitStatus: getFileStatus(). Then you can simply do the following: File repositoryDirectory; /* init repository directory... */ File myFile("foo"); GitFileSystemObject.Status status = new GitStatus().getSingleFileStatus(repositoryDirectory, myFile); GitFileSystemObject.Status is an enumeration. See GitFileSystemObject.java for details. ---------------------------------------------------------------------- Comment By: Paul M Bethe (pbethe) Date: 2008-07-29 19:00 Message: Logged In: YES user_id=308431 Originator: YES ALSO, in this new getStatus method, please consider returning untracked for files which are in an untracked folder. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1089902&aid=2031734&group_id=233450 |