Hi All,
I am facing...Can you please suggest me something to acheiving this,
Problem : Suppose one branch in GIT saying that DEV1 and administrator committed some files and pushed the same to server.
I have also checkout the same branch and worked something on it and committed the message locally but I am not able to push my work directly on server because I dont have permission for that. So I have created local branch on DEV1 and pushed the same.
I wrote HOOK which take care of commit message which is in pre-defined format in regular expression. If committed message match then user can push there code otherwise hook will reject the push.
My problem is, when we create the local branch i want to read only those commit message which I added after administrator change but it is returning all the commit messages which is already committed by administator in DEV1.
We are using below code snippets in pre-HOOK,
----------------------------------------------------------------------------------------------------
public boolean onReceive(RepositoryHookContext context, Collection<RefChange> refChanges, HookResponse hookResponse)
{
for (RefChange refChange : refChanges)
{
ChangesetsBetweenRequest request = new ChangesetsBetweenRequest.Builder( context.getRepository()).exclude(refChange.getFromHash()) .include(refChange.getToHash()).build();
final Page<Changeset> cs = commitService.getChangesetsBetween( request, PAGE_REQUEST);
for (Changeset changeset : cs.getValues()) {
commit_msg = changeset.getMessage();
}
}
}
Please suggest me how can we read the latest commit messages.
I want to read the localcommits , I dont want to read the pushed commits. How can I achieve it.
Regards,
Anil