| JGit [message #1105915] |
Tue, 10 September 2013 08:37  |
Ajay Gour Messages: 4 Registered: September 2013 |
Junior Member |
|
|
Using JGit library, is there a way to figure out from which commit a branch is created?
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?
|
|
|
| Re: JGit [message #1109438 is a reply to message #1105915] |
Sun, 15 September 2013 07:49   |
Robin Rosenberg Messages: 277 Registered: July 2009 |
Senior Member |
|
|
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.
-- robin
|
|
|
| Re: JGit [message #1110993 is a reply to message #1109438] |
Tue, 17 September 2013 12:07  |
Ajay Gour Messages: 4 Registered: September 2013 |
Junior Member |
|
|
Thanks for the response Robin.
Yeah, i am aware of these methods but they dont provide commit from which branch was forked.
Anyways, we realized that GIT cannot provide the information we are looking for as it doesn't store any branch related information branch is just a label. So we are now changing our approach.
-Ajay
|
|
|
Powered by
FUDForum. Page generated in 0.01733 seconds