branching svn remote folders - java

I have a Java project managed in SVN. This project has a remote folder - say - bin. When I create a branch from trunk, svn cp command is not copying this remote folder, but instead, it maintains the link back to the trunk. So, if somebody makes a breaking change on this file in trunk, then it is automatically reflects in feature or release branches and causes problems.
Is there a way to force SVN to copy this remote folder and all the contents under it? Or is there any other feature in SVN that lets me do this?

Related

subversion with turtoisesvn, visualsvn manager, eclipse and maven

I'm trying to setup Apache Subversion on my PC, but I'm not sure about the workflow.
I've created a repository in the VisualSVN Server Manager console. I've created a project structure within that repository, where a folder called MyProject has three folders called /trunk, /tags and /branches.
Then I created a folder on my disk called MyRepos. Within that folder I created another folder called Java_Projects. Into that folder I checked out MyProject folder. This is my working copy, right?
Now I created a maven project inside the trunk (in the working copy folder where I checked out to) and the trunk and converted it into an Eclipse project, so the trunk now contains the src and target folder, the pom as well as the .project and .classpath files.
Then I imported this project as "existing project" into the Eclipse workspace.
I then wanted to delete the two java-files automatically created my maven. It wouldnt let me do that in eclipse. So I deleted them directly from my disk, from the trunk folder.
Then I created two new classes in eclipse and commited the whole project from within eclipse. But the two files I created in Eclipse are neither visible in the VisualSVN Server Manager console nor in my local copy. I've tried commiting in Eclipse and updating in the trunk folder several times, but the files dont show up.
What am I doing wrong? How do I, after having created a project-structure in the repository (which in my case is controlled by the VisualSVN Server), create a new maven project and work with that?
If you used svn checkout to get MyProject from the repository, then 'Yes' you have a working copy of this directory,
Use svn st -v to analyze status if items your working copy. I guess that you've performed some file operations without using svn client thus you will see missing and unversioned items there. You have to perform copy / move / delete / rename operations using svn client only. Otherwise you can get missing / unversioned items in your working copy.
Read SVNBook.

Project migration to new directory - keeping Git history

I have recent migrated a Java EE project from 5 to 6, as this required quite a big overhaul I created a new EE6 skeleton project and copied most of the code across manually. I now have my working EE6 project (and an obsolete EE 5 project).
I would like to keep my Git history, is there are recommended way to move the .git directory into the new project so that all the updates are picked up as a new commit? Or can I just copy the .git folder over? Or do I have to start from scratch and lose the history?
Thanks, I am sure this must have been asked before but I have been unable to find any questions that relate
You can copy the .git folder in the new project, and check that a git status does pick up all your changes (git add -A . after that, in order to add any new, modified or deleted files).
A more clean solution would be to :
initialize an empty git repo in your project (git init .)
add as a remote a path to your previous project (git remote add origin /path/to/previous/project, where a .git/ folder reside.
Then, using git branch and git reset:
git fetch
git branch master origin/master
git reset --soft master

Git Eclipse import source folder into project

I have a bit of an issue that I can't seem to find a solution to.
I had a project in eclipse that I was working in. I have a remote git repo in which all the source files are backed up to (but it doesn't seem to be the entire project). My project got deleted in eclipse but I had previously had a backup of the entire directory that I had zipped up and emailed to myself a while back which contains the entire project including external libraries etc that I need for the project.
I can import the zipped project into eclipse but obviously the source directory is out of date. I need to be able to pull from my existing repo all the changes I made to my source files. I was able to use the Restore From Local History from the context menu in eclipse which brought in all my changes up until my last push.
Is there a way to re-link this newly create project with my existing repo so all my original commits are available to the new project? Or is there a way to get my source files from my repo into the newly created project. I'm not sure how to proceed and I don't want to make any further changes until I get this resolved.
Any help would be greatly appreciated.
Depending on how you restored the other files, you might run into merge conflicts once you pull from your remote repository. Make sure to make a backup first.
Eclipse:
In the context menu of your Eclipse project, you should see the entries
Team -> Remote -> Configure Fetch from Upstream / Configure Push to Upstream
There you can configure where to fetch from, and where to push to, respectively.
Once you have configured the URI to your remote repo, you might want to use the Dry-Run button to check that it is linked correctly.
Command line:
You can also use the command line to organize your remote repositories.
Navigate to your project and run
git remote
to get a list of your remote repositories.
If that list is empty, you can use
git remote add <remote-name> <your-remote-repo-url>
to add a remote repository. So, e.g.
git remote add origin https://github.com/yourUsername/yourRepo
Then you should be able to pull from your remote as usual.
Alternatively, you could follow this guide to import the remote repository as a new project. This will bring back the source code in its current state in the remote repository.
But you mentioned that the remote repo does not contain the whole project. So you would probably have to add all files manually from your restored project that were not tracked by the git repository.

How to add eclipse project to existing git repo?

I already have an existing project in Eclipse that I want to add to my team's github repo. The github repo is empty right now. What's the best way to add this project to our github repo? I was thinking of git cloneing our repo into the workspace folder (parent to the project in question) and then adding the project files using git add, then pushing the changes. Would that work, or is there a better way to do this (perhaps with EGit)?
You have to add a remote to the project, and then push to it.
For example, you can do (from inside the project directory)
git init # if you haven't already
git remote add origin ssh://git#github.com:.....
git push -u origin master
there should be a way to do that from the eclipse plugin too, but I find it easiear to do it from the command line.. :)
By the way, remember to add all the IDE-specific files to .gitignore, to avoid pushing garbage to the world: they usually are .project, .classpath and directories like bin/*,.settings/* ...

Problems with SVN with a project in Eclipse

I was working with a project that I was uploading the source to a SVN repo.
For a few weeks I dind`t uploaded any code.
My computer has broken.
I could access to the HD and recover my eclipse project.
Now if I import my project into Eclipse and I want to synchronize with my repo, all my files appear to be in conflicts.
Is there any way that I could "clean" my recovered project so I can stop having conflicts and in this way start to sync my project again with my repo?
When I open a file to see the changes, in those files, where I know that there is no change between my local file and the repo file, my local file version is lower than the repo file, example (local file version: 244 and repo version: 351). But there is no change between one and another file.
How can I get my project working again with my repo?
First do a team -> cleanup on your project. This sometimes resolves some SVN-specific tree issues.
Then go to the team synchronization perspective and do an update of the complete project.
Select the conflicts tab and resolve each conflicted file, there are two options: 'override and update' (dismiss your local changes and continue with the repository version) or
'mark as merged' (indicate that your local file is correct, and the repository version should be overwritten)
Before selecting 'mark as merged' you can use the diff tool to view each discrepancy in turn and edit your local file if necessary. Note that the diff tool has a setting 'ignore whitespace' which might help reduce the clutter.
After you are done, before committing anything re-build the project from scratch and run all your tests.
If you still get stuck there is a more drastic solution: make a fresh checkout of the project in another directory and then copy your local changes into it by hand. Make sure you don't copy any .svn directories!

Categories