Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » [SOLVED][JGit] issue use "pull"(Sorry for my english, I'm french)
icon5.gif  [SOLVED][JGit] issue use "pull" [message #1064607] Thu, 20 June 2013 08:26 Go to next message
Michaël Adjedj is currently offline Michaël AdjedjFriend
Messages: 8
Registered: June 2013
Location: France, Montpellier
Junior Member
Hello everyone,
I am looking to do methods that use APIs and libs JGit (org.eclipse.jgit).
I want to do a "pull" in my first method, but it does not see the new revisions on the bare.


Here's the code:
public class GitService {
 
    public static void gitsynchro() throws IOException, GitAPIException {
        
        Repository depotLocal;
        Repository depotDistant;
        depotLocal = new FileRepository("/home/***/***/***/projet/.git");
        depotDistant = new FileRepository("/home/***/***/gitserver");
        
        Git git = new Git(depotLocal);
        Git git2 = new Git(depotDistant);
 
        System.out.println(depotDistant);
        System.out.println("===== distant =====");
        for (RevCommit log : git2.log().call()) {
            System.out.println(log.getFullMessage());
        }

        System.out.println("===== local =====");
        System.out.println(depotLocal);
        for (RevCommit r : git.log().call()) {
            System.out.println(r.getFullMessage());
        }

        String pull;
        pull = git.pull().call().toString();
        System.out.println("pull : {" + pull + "}");
 
        for (RevCommit r2 : git.log().call()) {
            System.out.println(r2.getFullMessage());
        }
    }
}


Sorry for my English I'm French.

[Updated on: Mon, 08 July 2013 08:32]

Report message to a moderator

Re: [JGit] issue use "pull" [message #1064657 is a reply to message #1064607] Thu, 20 June 2013 12:55 Go to previous messageGo to next message
Michaël Adjedj is currently offline Michaël AdjedjFriend
Messages: 8
Registered: June 2013
Location: France, Montpellier
Junior Member
And the result of the "pull" looks like this :

pull : {org.eclipse.jgit.transport.FetchResult@12413ffc
Merge of revisions fd0717e2e7a3f71774f789c8876da9c2e14a535e, fd0717e2e7a3f71774f789c8876da9c2e14a535e with base fd0717e2e7a3f71774f789c8876da9c2e14a535e using strategy resolve resulted in: Already-up-to-date. }


Sorry for my English I'm French.

[Updated on: Thu, 20 June 2013 13:00]

Report message to a moderator

Re: [JGit] issue use "pull" [message #1064683 is a reply to message #1064657] Thu, 20 June 2013 14:11 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 113
Registered: July 2009
Senior Member
Looks all ok. Your local repo's HEAD points to a commit fd0717e2e7a3f71774f789c8876da9c2e14a535e and what you are pulling from the remote repository also commit fd0717e2e7a3f71774f789c8876da9c2e14a535e. Nothing new on the server side. Maybe you have the wrong fetchspec in your local repository. Could you attach the output of following commands in both your repos:

git config -l --local
git show-ref



Ciao
Chris
Re: [JGit] issue use "pull" [message #1064694 is a reply to message #1064683] Thu, 20 June 2013 14:57 Go to previous messageGo to next message
Michaël Adjedj is currently offline Michaël AdjedjFriend
Messages: 8
Registered: June 2013
Location: France, Montpellier
Junior Member
result of "git config -l --local" on local repository :
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=/home/itldev/cochise/gitcochiseclient/../gitserver/
branch.master.remote=origin
branch.master.merge=refs/heads/master


result of " git show-ref" on local repository :
9ec1d595f7b3d3559cafabe59bad2bb3b89247ee refs/heads/master
fd0717e2e7a3f71774f789c8876da9c2e14a535e refs/remotes/origin/HEAD
fd0717e2e7a3f71774f789c8876da9c2e14a535e refs/remotes/origin/master
900a7ba7a233765eb6d571e9adf895760eb1462a refs/tags/v1.0


NB : I did a "git pull" manually before your message

And now from the bare (if you need it).

git config -l --local
core.repositoryformatversion=0
core.filemode=true
core.logallrefupdates=true


git show-ref

62ba46cc14be4d7afcf08ffbac96b681a5dd27b3 refs/heads/master


Sorry for my English I'm French.
Re: [JGit] issue use "pull" [message #1064696 is a reply to message #1064694] Thu, 20 June 2013 15:00 Go to previous messageGo to next message
Michaël Adjedj is currently offline Michaël AdjedjFriend
Messages: 8
Registered: June 2013
Location: France, Montpellier
Junior Member
now the pull message looks like this :

pull : {org.eclipse.jgit.transport.FetchResult@2870068a
Merge of revisions 9ec1d595f7b3d3559cafabe59bad2bb3b89247ee, fd0717e2e7a3f71774f789c8876da9c2e14a535e with base fd0717e2e7a3f71774f789c8876da9c2e14a535e using strategy resolve resulted in: Already-up-to-date. }


Sorry for my English I'm French.
Re: [JGit] issue use "pull" [message #1064701 is a reply to message #1064694] Thu, 20 June 2013 15:07 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 113
Registered: July 2009
Senior Member
I think your manual "git pull" has changed the situation. Could you again run your code and sent the output of your program.

Ciao
Chris
Re: [JGit] issue use "pull" [message #1064705 is a reply to message #1064701] Thu, 20 June 2013 15:15 Go to previous messageGo to next message
Michaël Adjedj is currently offline Michaël AdjedjFriend
Messages: 8
Registered: June 2013
Location: France, Montpellier
Junior Member
this is in my last reply, but I do it again and no change.

pull : {org.eclipse.jgit.transport.FetchResult@704666b6
Merge of revisions 9ec1d595f7b3d3559cafabe59bad2bb3b89247ee, fd0717e2e7a3f71774f789c8876da9c2e14a535e with base fd0717e2e7a3f71774f789c8876da9c2e14a535e using strategy resolve resulted in: Already-up-to-date. }


Sorry for my English I'm French.
Re: [JGit] issue use "pull" [message #1064718 is a reply to message #1064705] Thu, 20 June 2013 16:18 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 113
Registered: July 2009
Senior Member
My guess is that you have maybe reset your remote repo. It once pointed to fd07... (I can see that from refs/remotes/origin/master pointing to that). Now it points to 62ba.... But if 62ba... is a predecessor of fd07... then your problem would be explainable. What does

git merge-base 62ba46cc14be4d7afcf08ffbac96b681a5dd27b3 9ec1d595f7b3d3559cafabe59bad2bb3b89247ee

tell you?


Ciao
Chris
Re: [JGit] issue use "pull" [message #1064812 is a reply to message #1064718] Fri, 21 June 2013 08:23 Go to previous message
Michaël Adjedj is currently offline Michaël AdjedjFriend
Messages: 8
Registered: June 2013
Location: France, Montpellier
Junior Member
Hello Christian and thank you for your help, I found a solution with another engineer on my team.
The problem was this line of code:
depotDistant = new FileRepository("/home/itldev/cochise/gitserver/[u].git[/u]");

That changed the bare in another repository.
I clean it, reset it and now it's ok.

Thank you and goodbye


Sorry for my English I'm French.
Previous Topic:Error installing EGit Mylyn GitHub
Next Topic:Can EGit remember SSH passphrase?
Goto Forum:
  


Current Time: Mon Dec 22 20:52:16 GMT 2014

Powered by FUDForum. Page generated in 0.01936 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software