Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » [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 04:26 Go to next message
Eclipse UserFriend
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());
        }
    }
}

[Updated on: Mon, 08 July 2013 04:32] by Moderator

Re: [JGit] issue use "pull" [message #1064657 is a reply to message #1064607] Thu, 20 June 2013 08:55 Go to previous messageGo to next message
Eclipse UserFriend
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. }

[Updated on: Thu, 20 June 2013 09:00] by Moderator

Re: [JGit] issue use "pull" [message #1064683 is a reply to message #1064657] Thu, 20 June 2013 10:11 Go to previous messageGo to next message
Eclipse UserFriend
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

Re: [JGit] issue use "pull" [message #1064694 is a reply to message #1064683] Thu, 20 June 2013 10:57 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: [JGit] issue use "pull" [message #1064696 is a reply to message #1064694] Thu, 20 June 2013 11:00 Go to previous messageGo to next message
Eclipse UserFriend
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. }
Re: [JGit] issue use "pull" [message #1064701 is a reply to message #1064694] Thu, 20 June 2013 11:07 Go to previous messageGo to next message
Eclipse UserFriend
I think your manual "git pull" has changed the situation. Could you again run your code and sent the output of your program.
Re: [JGit] issue use "pull" [message #1064705 is a reply to message #1064701] Thu, 20 June 2013 11:15 Go to previous messageGo to next message
Eclipse UserFriend
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. }
Re: [JGit] issue use "pull" [message #1064718 is a reply to message #1064705] Thu, 20 June 2013 12:18 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: [JGit] issue use "pull" [message #1064812 is a reply to message #1064718] Fri, 21 June 2013 04:23 Go to previous message
Eclipse UserFriend
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
Previous Topic:Error installing EGit Mylyn GitHub
Next Topic:Can EGit remember SSH passphrase?
Goto Forum:
  


Current Time: Fri Jul 04 18:01:40 EDT 2025

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

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

Back to the top