Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » synchronizing a single repository with multiple projects
synchronizing a single repository with multiple projects [message #755132] Mon, 07 November 2011 13:36 Go to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
I have several Git repositories that include multiple Eclipse projects. It appears as if the synchronization operations are synchronizing the selected projects one at a time, rather than synchronizing the repository as a whole. Is that correct?

This doesn't seem like the right behavior. Other egit operation works on the repository, regardless of which projects are selected. For instance if I run "Team -> Commit" from the right-click menu with one project selected, the result is that all changes are committed, not just the changes in the selected project. Why shouldn't synchronize work the same way, at least by default? For sure it takes longer to walk through the projects one by one.

At minimum seems like we need the option to synchronize at the repository level, for instance with a right-click menu item on entries in the 'Git Repositories' view. Right now there doesn't seem to be any way to do this in a workspace with multiple projects from a single repository.

Re: synchronizing a single repository with multiple projects [message #755243 is a reply to message #755132] Mon, 07 November 2011 18:46 Go to previous messageGo to next message
Dariusz Luksza is currently offline Dariusz LukszaFriend
Messages: 40
Registered: July 2010
Member

All synchronize operations work on repository level, but not all presentation models will show all changed resources. The 'Workspace' presentation model (one that is selected by default) will not show non-workspace resources (eg. if one of projects is not imported into eclipse then it will not show in results), also changes in closed projects will not appear in results. In case of 'Git Commits' model all resources in git repository will be presented even if they are not imported in workspace or are in closed projects.
Re: synchronizing a single repository with multiple projects [message #755254 is a reply to message #755243] Mon, 07 November 2011 19:51 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
OK, that makes good sense. Thanks for the clarification. Now on to the next problem Smile

I do: "Team -> Advanced -> Synchronize -> Custom..." and for the destination I pick the reference of interest from the pull-down menu, which in this case is refs/remotes/trunk. Then I click "Finish" and nothing happens. No error, no sync. All I can do is cancel.

As you might guess, this reference was produced via SVN bridging. I understand that jgit doesn't support svn bridging, but once created the references are like any other: it's just a file whose contents is a SHA, exactly the same as any other Git reference, with nothing SVN'ish about it.

So why wouldn't synchronize work? Shouldn't I be able to synchronize against an arbitrary SHA?

If not, if there's some issue here, probably better not to list the unsupported destinations in the menu.
Re: synchronizing a single repository with multiple projects [message #755271 is a reply to message #755254] Mon, 07 November 2011 21:15 Go to previous messageGo to next message
Dariusz Luksza is currently offline Dariusz LukszaFriend
Messages: 40
Registered: July 2010
Member

That sounds very strange ... could you check that above command will return you any differences

git diff HEAD..refs/remotes/trunk

Additionally, I'm not sure does 'refs/remotes/trunk' is valid reference AFAIR this should look like refs/remotes/$remote_name/$branch_name

[Updated on: Mon, 07 November 2011 22:47]

Report message to a moderator

Re: synchronizing a single repository with multiple projects [message #755287 is a reply to message #755271] Mon, 07 November 2011 22:26 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
Yes, I can use remotes/trunk in command-line git, for instance:

git diff HEAD refs/remotes/trunk

or for that matter:

git diff HEAD trunk

Similarly git log etc

Re: synchronizing a single repository with multiple projects [message #755288 is a reply to message #755287] Mon, 07 November 2011 22:49 Go to previous messageGo to next message
Dariusz Luksza is currently offline Dariusz LukszaFriend
Messages: 40
Registered: July 2010
Member

OK, I'll try to reproduce this issue on git-svn repository in nearest feature. In the mean time you could create a bug report for it to track it also in bugzilla.
Re: synchronizing a single repository with multiple projects [message #755442 is a reply to message #755288] Tue, 08 November 2011 14:30 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
Bug submitted

https://bugs.eclipse.org/bugs/show_bug.cgi?id=363173


I should also mention that 'Compare With' has no problem with bridge references. For example if I right-click a file, select 'Compare With -> Branch, Tag or Reference...', the bridge references appear under 'Remote Tracking', as expected, and selecting any of these entries does the diff as expected. So in general egit/jigit seem fine with using SVN bridge references.


Thanks for looking into this, I'm probably not the only egit user who has to use a bridge repository due to "Fear Of Git" syndrome.

Re: synchronizing a single repository with multiple projects [message #755840 is a reply to message #755442] Wed, 09 November 2011 19:01 Go to previous messageGo to next message
Dariusz Luksza is currently offline Dariusz LukszaFriend
Messages: 40
Registered: July 2010
Member

Also fix is submitted to review

http://egit.eclipse.org/r/4582
Re: synchronizing a single repository with multiple projects [message #756212 is a reply to message #755840] Fri, 11 November 2011 14:03 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
Looks like this might been hung up for some reason in the review process. Can you post here if/when this becomes available in the nightly build? For the advanced version of Synchronize to be useful it really has to support any valid Git reference as the destination.

Even better would be if the source could also be any reference, rather than being restricted to the active branch. Ideally that's where advanced synchronization should be headed: given a pair of references, display the commits in one but not the other. Double-clicking any commit in this list would of course open it in a Commit view. This would be a huge win and the existing codebase is probably close to being able to support this already.

Re: synchronizing a single repository with multiple projects [message #756349 is a reply to message #756212] Sat, 12 November 2011 10:33 Go to previous messageGo to next message
Dariusz Luksza is currently offline Dariusz LukszaFriend
Messages: 40
Registered: July 2010
Member

That's true this change can hang for some time ... to reduce it you can also participate in review process and verify if this fix really solves this issue. You can vote +1 and -1 for any change in gerrit.

Regardless source reference, the first versions of synchronize impl allows to specify both source and destination refs, but we find such approach was hard to understood for new users and makes it really hard to properly show results and handle actions in context menu, also checking out any reference in really fast in git. Because of that we decided to always use current HEAD as source ... we still have code that allow to specify source ref in our code base but I cannot guarantee that it fill produce proper results

I would say that showing commits that are in one ref and not in another should not be handled by synchronize view but rather by something else ... maybe "history diff" would be a proper name for this new feature. As far as I see the synchronize view was designed to show differences in files, yes I've done some hacking to implement 'git commits' model but it also show differences in files at the end. Maybe adding "Open in commit viewer" option to context menu for commit elements in git commits model will somehow solves yours problem. You can fill an enhancement bug for "history diff" or "Open in commit viewer" and maybe some one will pick it up Wink
Re: synchronizing a single repository with multiple projects [message #756378 is a reply to message #756349] Sat, 12 November 2011 13:59 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
I am neither using svn nor the svn-git bridge hence it's hard to find the time to review and test this, I guess it's similar for most of the other committers. So if you really want this you may have a look at the EGit contributor guide [1] download the fix from Gerrit and test it, review Dariusz' change and comment and vote on the change in Gerrit. If your tests are ok and you vote accordingly on this change we are closer to accepting this change.
Re: synchronizing a single repository with multiple projects [message #756379 is a reply to message #756378] Sat, 12 November 2011 14:00 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
The contributor guide is here http://wiki.eclipse.org/EGit/Contributor_Guide
Re: synchronizing a single repository with multiple projects [message #756386 is a reply to message #756349] Sat, 12 November 2011 14:49 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
Re: extending Advanced Synchronization vs a new command, sure, either way, whatever is easier for the developers. We just need some way in egit to compare two arbitrary references. The closest thing in command-line git is probably 'git log source-ref ^dest-ref'. To me it feels close to what Advanced Synchronization is already doing but a new Log or Diff command would be just as good.

Re: an arbitrary reference as the destination in Advanced Synchronization (or some new Diff command) don't get hung up on the fact that the example happened to come from an svn bridge. That's not really relevant. Any file in the .git/refs tree should be considered a legitimate reference, regardless of where it came from. They're all the same, and they're all being listed in the destination pull-down menu anyway. We just can't use some of them.

In that sense the existing command is broken as it stands -- it lists destinations that can't actually be used. Surely it's simpler to allow any reference to be used as a the destination than it is to filter out certain entries for no particular reason? From what I saw of the checkin by Dariusz, this is just what he did: removed an unnecessary check of the path structure.

You're of course right that more of us should be contributing: we're all developers here after all. I do feel a bit guilty, and I'm curious about Gerrit, which I haven't used before. I just need to find the time...

[Updated on: Sat, 12 November 2011 14:51]

Report message to a moderator

Re: synchronizing a single repository with multiple projects [message #756451 is a reply to message #756386] Sun, 13 November 2011 13:59 Go to previous message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
More info on this bug so we don't get hung up on irrelevancies. I also added the crux of this to the bug report.

First, a baseline case:

1. Create a reference manually by adding a file in .git/refs whose content is any valid SHA. Call it "xxx".
2. Run 'Compare With -> Branch Tag or Reference...'. Select this reference and observe that the operation behaves correctly.
3. Run 'Replace With -> Branch Tag or Reference...'.. Select this reference and observe that the operation behaves correctly.
4. Run 'Team -> Advanced -> Synchronize'. Select the reference and observe that this operation behaves correctly.

So far so good. Now a more interesting case (but no bridging involved):

5. Create another reference manually by adding a file in .git/refs/remotes whose content is any valid SHA. Call it "yyy".
6. Run 'Compare With -> Branch Tag or Reference...'. Select this reference and observe that the operation behaves correctly.
7. Run 'Replace With -> Branch Tag or Reference...'. Select this reference and observe that the operation behaves correctly.
8. Run 'Team -> Advanced -> Synchronize'. Select the reference and observe that this operation fails!

So what's going on?

Advanced Synchronize has to do some extra work if the "Always launch fetch before synchronization" option is enabled: if the destination reference is a remote-reference, it needs to know which remote to fetch from. One reasonable way to do this is to assume that any references under .git/refs/remotes will always have the form

.git/refs/remotes/<remote-name>/<reference-in-remote-repo>


The bug is in that assumption: Git does not require references under .git/refs/remotes to have this form.

The fix would then seem to be straightforward: verify that the reference really is a remote-reference before treating it as one. I believe this is exactly the change that was made but hasn't yet been accepted.

As can be seen, testing is very simple, just add a reference to refs/remotes that isn't in the remote-reference form.

[Updated on: Sun, 13 November 2011 14:06]

Report message to a moderator

Previous Topic:Problems pushing a repo
Next Topic:egit freezes and times out (ReadTimeout) when pushing after upgrade to 1.1.0
Goto Forum:
  


Current Time: Tue Mar 19 04:26:03 GMT 2024

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

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

Back to the top