Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [egit-dev] Query on getting information of the list of files commited

 
 
Hi Markus,
I had a look at your post
http://dev.eclipse.org/mhonarc/lists/egit-dev/msg02839.html
regarding eGit notification.
I have a query……How do I get the information of the following:
 
     /**
      * Retrieve a list of all changed files in a commit (based on a event).
      */
     public Map<String, FileMode getChangedFiles(String commit) {
         Map<String, FileMode result = new TreeMap<String, FileMode();
         try {
             TreeWalk walk = createTreeWalk(getCommit(commit));
 
             while (walk.next()) {
                 result.put(walk.getPathString(), walk.getFileMode(1));
             }
         } catch (Exception ex) {
             log.error("failed to get files for " + e, ex);
         }
         return result;
     }
 
     /**
      * Create a new TreeWalk which can be used to find file-related info for a given commit
      */
     public TreeWalk createTreeWalk(RevCommit commit) throws Exception {
         if (commit.getParentCount() != 1) {
             throw new IllegalStateException("commit " + commit + " has not exactly one parent!");
         }
 
         // since the actual commit is added as second tree, from now on, index '1' refers to the
         // actual commit.
         TreeWalk walk = new TreeWalk(repo);
         walk.setFilter(TreeFilter.ANY_DIFF);
         walk.reset(commit.getParent(0).getTree(), commit.getTree());
         walk.setRecursive(true);
         return walk;
     }
 
     /**
      * Retrieves the commit object for the given rev string.
      */
     public RevCommit getCommit(String rev) {
         try {
             RevCommit ours = walk.parseCommit(getOidForRev(rev));
 
             // and as an extension, parse direct parents too. this is so the message is accessible later.
             for (RevCommit c : ours.getParents()) {
                 walk.parseCommit(c);
             }
 
             return ours;
         } catch (Exception ex) {
             log.error("cannot find commit with id " + rev, ex);
             return null;
         }
     }
 
  1. String Commit
  2. RevCommit
Are there any means to get the same.
Mit freundlichen Grüßen / Best Regards,
Rahul Chandrashekar
 
Robert Bosch Engineering and Business Solutions Limited
Engineering Methods and Tools (RBEI\EMT2)
123, Industrial Layout, Hosur Road, Koramangala,
Bangalore 560 095
INDIA
www.bosch.com
 
Tel. +91 80 6657 1661
VoIp. +49(711)811-3615170
Mobile +91 9886944213
rahul.chandrashekar@xxxxxxxxxxxx
 
 
 
Mit freundlichen Grüßen / Best Regards,
Rahul Chandrashekar
 
Robert Bosch Engineering and Business Solutions Limited
Engineering Methods and Tools (RBEI\EMT2)
123, Industrial Layout, Hosur Road, Koramangala,
Bangalore 560 095
INDIA
www.bosch.com
 
Tel. +91 80 6657 1661
VoIp. +49(711)811-3615170
Mobile +91 9886944213
rahul.chandrashekar@xxxxxxxxxxxx
 
 
_____________________________________________
From: Rahul Chandrashekar (RBEI/EMT2)
Sent: Monday, 9. July 2012 6:18 PM
To: 'egit-dev@xxxxxxxxxxx'
Subject: Query on getting information of the list of files commited
 
 
Dear All,
 
I have a query, how do i get the list of files from eGit which are commited into the GIT repository.
 
Please let know your feedback for the same.
 
Mit freundlichen Grüßen / Best Regards,
Rahul Chandrashekar
 
Robert Bosch Engineering and Business Solutions Limited
Engineering Methods and Tools (RBEI\EMT2)
123, Industrial Layout, Hosur Road, Koramangala,
Bangalore 560 095
INDIA
www.bosch.com
 
Tel. +91 80 6657 1661
VoIp. +49(711)811-3615170
Mobile +91 9886944213
rahul.chandrashekar@xxxxxxxxxxxx
 
 
 

Back to the top