|Re: JGit [message #1109438 is a reply to message #1105915]
||Sun, 15 September 2013 11:49
| Robin Rosenberg
Registered: July 2009
Ajay Gour skrev 2013-09-10 16.39:|
> Using JGit library, is there a way to figure out from which commit a branch is created?
As the question is formulated: No. You can not see on which branch a commit is made, but (below)
> Lets say, i have below mentioned structure - A, B, C, D commits are made in master branch. From B, another branch called branch-A is created and E & F commits are made in
> this branch.
> A -> B -> C -> D (master)
> ......|--> E -> F (branch-A)
> Given the example above, if i am seeing the history of branch-A, i would like it to include only E and F commits (and nothing else before first revision in branch).
> Is it possible using JGit?
RewWalk can do this for you. See LogCommand and the Log program in JGit.
RevWalk.isMergedInto can be used to see if a commit is reachable from a certain
branch. There is an heuristically optimized invocation of this method in
RevWalkUtils.findBranchesReachableFrom that you can use when you want to find all branches.
Powered by FUDForum
. Page generated in 0.01781 seconds