Is it possible to share a project without commiting? - eclipse

I'd like to use "Share Project..." in Eclipse without actually commiting to SVN. Unfortunately, I am not able to find an option for doing this.
Instead, I want the relevant files only be added to SVN.
My goal is, that SVN should track all the files I move into the project using the package explorer.

Share Project needs to accomplish two things:
It sets up some internal linkage in Eclipse that connects your project with the SVN Team Provider so that SVN menu actions are exposed and so that activities you perform are routed to the SVN provider to "handle".
It has to establish your project as SVN "working copy" so that the SVN API that needs to be called on behalf of your actions can do what it needs to do.
So the key here is that if you already have a SVN working copy then Share Project will recognize this and be able to do option 1 without needing to do anything else. But otherwise, it has to establish a working copy which requires it to do svn checkout from your repository. If it has to create the working copy then it makes the assumption it needs to create the project in the repos and then check that out on top of your local project. So the one commit it will do is a svn mkdir for a folder in the repos.
If you do not want to do that, then do something to establish a working copy locally before you get started, such as checking out some existing location in your repository. As others have noted, you may want to be using branches and switch if you are refactoring something that already exists.

When you commit data to the SVN repository, you publish this new data or make changes to existing data (i.e. you make your changes available to others). Therefore, you need to commit your changes if you want others to see it in your SVN repository and collaborate.
As far as I recall, "Share Project" command in Eclipse is designed to import your non-versioned project to the SVN repository (i.e. make a first-time import) -- it converts your local data into a working copy and commits it.
I do not understand what exactly you mean by "share but not commit" (you may want to elaborate). However, you can always select which files to add and commit or import into the repository, but I guess that you will need to use standalone SVN client outside of Eclipse.

Related

What Egit actions do I take to get copy of src file TESTGIT1 from MainServerRepository into LocalServerRepo to work on?

As a new Egit user, aiming to set up version control to update the way a team manages source code without changing locations of our build and dev servers and to identify correct Egit commands to use for check in and check out code from both servers.
In a single Eclipse workspace, initially had one project without use of Egit just a basic automatic and adhoc file copy back up of changed development directory into folders with dates of backup. Promotion to the build server was done by manually copying source files and binaries, doing a diff between source on the MainServer and local server to manage any merges. Now need to implement a proper version control system, using Egit, so as a first time Egit user. I have set up two test Eclipse projects in my workspace: project A shared with MainServerRepository and project B shared with LocalServerRepo. The two git repositories will be in different directories: MainServerRepository on the network and LocalServerRepo on my area on the network where I backup my PC.
What Egit actions do I take to promote latest TESTGIT1.src from MainServerRepository into LocalServerRepo to work on in my local server? (Team > Fetch from upstream is grayed out). Then, once tested, how do I check in src for TESTGIT1 into the main build server project, source and objects are in MainServerRepository?
I've used Team > Commit successfully to check in, but am using cut and paste to move code between two projects (prior to commit) and feel there must be a better way to do this or to set up the projects differently within Eclipse.
Or should I be using Team > push or Team > merge?
Do I need local repository or should I just check out into workspace?
Any comments/ question/assistance would be welcome as haven't figured it out from reading the EGit/User_Guide.
Edit TESTGIT1.src in Eclipse project shared with LocalServerRepo(testGitRepo) until work on it is complete on local server. Then, apply same changes to TESTGIT1 in the main build server project, using right click copy +paste from right click, team > check in. Then in Git Staging view, click plus sign to add to index (staging area), then click commit button, merging in with any other changes made to TESTGIT1.src by other developers. Don't use push command to push entire contents of LocalServerRepo. Or is there a better answer?

Eclipse - sharing project directory with multiple users

We are trying to set up Eclipse so that two users can share the same project directory on our server. Is this possible? Every time we try, it creates a new folder and project.
Thanks!
Chris
No, this isn't possible. Eclipse only supports a single user accessing a workspace (not just a project) at a time.
Use a source control system such as Git or SVN to share code. Eclipse supports many such systems and has extensive sharing support in the 'Team' menus.
The best way to do this would be to use source control.
Sharing the actual workspace or the files with different eclipse instance is a recipe for trouble.
An easy way to do this would be to install git on your machine and also on his machine. Eclipse actually already has git in it ready to go so you probably dont need to install anything.
The one with the files locally will create a repo locally on his computer and commit the files to it.
Next you want to init a new empty repository on a shared folder and push your local chances to this as you would to github for example.
Your partner can then git clone from this repository to his machine and work locally.
Each of you will develop on your own copy and commit your changes locally. You will share your changes by pushing your commits in that central repo and pulling from it to get changes from your partner.
You could also just open an account on GitHub, GitLab or BitBucket (there are many others too) and use that instead of a shared folder. big advantage with these services is that they will be available from anywhere.

Converting CVS multi-project tree hierarchy to Git?

I am using CVS and I have this hierarchy:
/ROOT
/JAVA
/JavaProject1
/JavaProject2
.project
/PHP
/PHPProject1
/PHPProject2
.project
In Eclipse > CVS Repository Exploring, I can see this hierarchy and I can Check Out only the project that I want.
Also I can check out (import) JAVA and PHP folders (I created them as Eclipse General project for import) to Eclipse Package Explorer and can synchronize and commit all together.
When I want to use Git, it only supports one project.
I don't want a flat hierarchy (near all JAVA and PHP project together), I want to use tree hierarchy and I want to check out only the project that I want as with CVS.
Is my CVS hierarchy possible in Git or what technique should I use?
I think you're mixing what you want to do locally with how you want
to arrange things remotely. All git commands access only the local
repository. The 'push' and 'fetch' commands appear to access a remote
repository, but in fact they effectively start each other on the remote
machine running against the local repository on that machine. So the
tasks you can do remotely are very limited. Specifically, copying "branch"
and "tag" references and the commit histories those references point at.
This means for the simple case there is ONLY the local repository,
it exists in the .git directory in the working directory.
You can arrange working directories, with their .git directories however
you wish on your local machine. Likewise, you can arrange the the remote
repositories in any way allowed by the remote hosting service. The
layouts do not have to match. If the remote is your own Linux server you
can make the layout just like your local. If the remote is (for example)
Github you're more limited.
You'll need to backup the .git directory to backup
the repository; the rest of the working directory is probably not significant. You can use git push to do this backup, as long as you never use '--force'.
Git isn't really very keen on you having multiple working directories
for one repository. It is possible, however, in the simple case they
will each have their own copy of the repository and you will need to
push/pull the updates individually either to a "central" repository
or more "randomly". None of these repositories have to be physically
"remote".
Git much prefers you to switch between branches in one working directory
and use make install style processes to send builds out.
It is also possible to have unrelated branches in one repository, but most people find this too confusing as you still only have one working directory.

Subclipse SVN first commit ignore certain directories

Decided to take the jump from CVS to SVN.
I setup a new repository in subclipse for my project. When I go to 'Finish' the setup it wants to do an initial commit and presents me with a flat list of files to select the files for version controlling.
The problem is I have thousands of generated binary files I dont want to commit.
So I click on cancel because it would take me all day to go through and unselect all the unwanted files. Annoyingly when I click on a parent category for the files I want to ignore it is not recursive!
So I click cancel then go to the eclipse directory structure for the project and manually set svn:ignore on all directories I want to ignore. Then I try and do a commit again and all the files are once again presented - ignore seems to have done nothing.
Can anybody point out what I might be doing wrong?
For the first commit, I recommend writing a small script to delete (of course you'll have a backup) all the files that are not meant to be committed.
Afterwards, if you find you accidentally committed a file, you can
svn delete file
Upon the first checkout, copy back (or better yet, regenerate) all the binary files. This will trigger svn to notice that your local repository is out-of-sync with the remote repository.
cd <Root of local repository>
svn status
You will see lots of "to be added" items. Go to the parent directory and add in svn:ignore properties for each of the generated items.
cd build
svn propedit svn:ignore .
which will open an editor (if it doesn't, you need to set the environmental variable SVN_EDITOR to a suitable editor). Then you can add in entries that svn will know are not tracked.
(in the ignore property editor)
target
build
image*
*.o
(and so on)
Save the file, and it will be staged for the next commit. Subsequent runs of svn status will no longer show these files as "needing to be added", but they will show the directory as "needing to be committed (it's a revision on the directory)"
Quick Aside
So I'm not entirely certain exactly which functionality of Subclipse you were using in order to create a repo and share a project to it, I'm assuming you created like a file based repo through the eclipse SVN repo view and tried to share and then commit to it. It looks like your problem got solved but I did want to add an answer on here because I ran across this post looking for the answer to this same problem of handling initial commits even just in general with SVN and wanted to offer help to anyone else looking for the help.
Intro
To start off I would recommend not working through an IDE extension like this just for the initial commit as they can miss a lot of the options for handling opening a repo in SVN. I personally really like the command line form of SVN to work with but TortoiseSVN is a good option for a GUI.
Whether you create a local file-based repo or are connecting to an SVN server and you want better control over your first commit in an previously unversioned project here is what I've found as the best general workflow for doing so.
Create the remote folder to save to.
On command line this will be:
$> svn mkdir your-url-scheme://your-site-address.domain/path/to/repo/example-directory
Or on TortoiseSVN open your repo for browsing, right click, and select "create new folder"
This will give you a location in the SVN repo to checkout from for our next step.
Checkout in to the already started project
Make sure to use the empty, newly created folder in your repo to checkout with. SVN does not actually require a folder being checked out to to be empty, which is an important part of what makes it actually very flexible and able to subsume parts of your directory into it fairly easily if used correctly.
Now you will checkout this empty folder into the root folder of your already started project. This will add your project to the working copy of this folder without any commit being made yet. The command is:
$> svn co your-url-scheme://your-site-address.domain/path/to/repo/example-directory /your/projects/root/
"co" standing for checkout. In Tortoise svn you can right click on or in the empty repo folder and select "checkout..." and then select the project root.
Set ignores and commit
Finally, you can easily set your ignores on certain files before adding any other files to the tree using the command:
$> svn propset svn:ignore file-or-directory-to-ignore
And to add all non-ignored directories and files:
$> svn add * --force
The force is technically unnecessary in this case but ensures full recursion. You can also now do all of this in your file explorer if using TortoiseSVN or you can even use your IDE extensions to do this at this point(make sure to ignore all files you need to before mass-adding files for commit), all that's left is to make sure to commit the newly added files to the repo and you're up and running with source control :)
Added this method here simply because this method allows you to avoid any unnecessary copying of those stinky binaries that no one wants to lug around with them.

Git, SVN and Eclipse workflow

I am trying to adopt the following workflow:
git svn clone a svn repository through command line (egit doesn't support git-svn)
Open the project in eclipse with egit since I rather use egit to branch, merge, commit etc...
When i'm ready commit the changes back, I use use git svn dcommit to commit back to svn
I am having trouble with step number 2, don't understand how to import a git project, eclipse tells me i can't import it to use the same directory it's currently in because another project with the same name is already there. this is confusing.
Anyone knows how to do this ?
Also would like to hear other workflow examples that uses egit and git svn. I am aware that it is better to do it all through command line, however, I am trying to ease the move to git for fellow developers in my team, who are not used to command line interface etc...
I've worked briefly with the egit plugin (I actually recently stopped using it and just use msysgit as my Git guiclient and run it separately from Eclipse). I find Eclipse very busy as is and adding this plugin slows it down (for me at least).
What I did when setting up an already cloned project in Eclipse:
In Eclipse. File -> Import -> Existing Project into Workspace
Select root directory of project. Do NOT check copy projects into workspace. Click finish.
After project has been imported. Right click on project, go to Team -> Share Project
Select Git as a repo type, click next
Check use or create repo in parent folder of project. Since you already cloned the project it will be tracked with git. When you check this option it will show the project, the path, and the repo (.git).
Click finish and you will be all set.
I think you'd better use SubGit instead of git-svn.
SubGit works on a server side. It synchronizes all the modification between Subversion and Git repositories automatically on every incoming modification from either side.
From the client perspective SubGit enabled repository is a usual Git repository, so you may pull from and push to it. Please refer to SubGit documentation or SubGit vs. git-svn comparison for more details.