After reactoring packages in Netbeans, I can't commit anymore - java

After refactoring some packages/classes, when i try to commit my project i get this error:
org.tigris.subversion.javahl.ClientException: svn: Commit failed (details follow):
svn: Item 'One-of-my-project's-package' is out of date
svn: DELETE of '/svn/Repository/!svn/wrk/fe1d333f-3901-0010-acd1-d750d86b0019/One-of-my-project's-package': 409 Conflict (https://mysvnrepositoryserver.com)
The SVN command returned with an error which indicates that some files in your working copy are out of date.
Run update and attempt your command again.
How i can fix it? Running "update" won't overwrite my classes, deleting all the latest modifications?

This has happened many times to me, it is very frustrating. Updating won't disturb anything if nobody else has committed in the meantime, and even if there were other commits, only a regular update will happen that will merge the changes into your files (or, in case of a conflict, generate the usual commit markings). However, the update may not help, either. What is usually at hand is a "tree conflict", which doesn't concern any specific file, but directory info. You probably renamed a package, that renamed a directory and created your situation.
Try updating and, if it doesn't help, you probably will have to make a backup and manually revert parts of the working tree, then reapply your changed files.

Related

Git-Rebase: Failed on patch deleting a file that got already modified

I try to rebase my branch to catch up with master. But Git fails with the given problem:
...
warning: squelched 41 whitespace errors
warning: 46 lines add whitespace errors.
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): project/package/XXX.java deleted in CommitName and modified in HEAD. Version HEAD of project/package/XXX.java left in tree.
It seams that in the branch I deleted a file within a patch and that file got modified on master as well. When I now try to rebase the branch to origin/master, the merge process does not know what to do with the patch since the file I delete has changed now and the patch can not further applied.
What is the best way to fix it?
When a merge conflict like such occurs, you'll notice that you are still in process of rebase. In order to continue, those files need to be staged. You can stage the change with either git rm or git add. Then you have to continue the rebase with git rebase --continue.

JGit checkout over the same branch

I need to sequentially check out tags over a branch I created with JGit.
CheckoutCommand checkout = new Git(testRepository).checkout();
if (!branchExists())
checkout.setCreateBranch(true).setName("branch-for-test").setStartPoint(key);
else
checkout.setName(key);
checkout.call();
Where key is a String which contains the name of the commit I want to checkout (key changes in a loop). I don't want to create a branch each time I checkout as I don't need to. The following error is shown:
org.eclipse.jgit.api.errors.JGitInternalException: Could not rename file target\TestRepository\server\db\scripts\postgresql\._db_script.sql6197897692249726905.tmp to target\TestRepository\server\db\scripts\postgresql\_db_script.sql
at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:320)
Before this happened I was trying to checkout inside the else statement with
checkout.setName("branch-for-test").setStartPoint(key);
It did not throw any error but it did not checkout the tag either.
Well, it seems that using JGit in Windows may generate conflicts related to managed files sometimes. What I made for solving this recurrent issue was to execute a git clean --force followed by a git reset --hard before each git checkout <ref_name>. This was totally fine for me, as I didn't need to stage changes...
The problem was that basically after using some files (even in a read-only way), they were marked as changed (I verified it with git status). The solution explained above implied more operations, but totally solved my problem.
For further details, refer to git documentation about these actions:
Git clean: Removes untracked files from the working tree.
Git reset: Resets current HEAD to the specified state.
And develop the appropiate implementation of these two actions with JGit:
Clean with Clean Command.
Reset with Reset Command

svn: 'pre-commit' hook failed with error output:

Some of selected resources were not committed.
svn: Commit failed (details follow):
svn: 'pre-commit' hook failed with error output:
**
I am trying to commit 2 jsp files from Eclips Helios.Its updated with lates Subversion updated verison & mylyn.
Scratched google but nothing found.
However this issue is only coming with some of comments but I can commit the file using other comments and some file can't.
Only output given by the SVN commit is this.
Any help appriciated.
Thanks in advance.
Screen Shot Attached Below
Here is a possible workaround, if you really don't have access to the hooks dir:
Try to sync your changed files with the original (repository-stored ones) files, and find such differences that should be protected by hook scripts:
jsp contains accented or non-supported special chars (try this first)
jsp contains illegal whitespace chars
etc. If you find some suspicious, remove it and commit the rest of the changes.

JGit checkout vs `git checkout` problems

tl;dr JGit's checkout throws exceptions while command line git checkout works fine
I'm currently trying to use JGit to check out certain revisions from an online Git repository, in Java (for work). My current approach is (and I'm very new to Git, coming from a SVN background, so this may be wrong):
clone the repository to a temporary location on my hard drive
figure out which revision I want, (I have tried using the SHA-1 hash as well as the name of a branch)
checkout that revision
from there, I would be using the checked out files as inputs to a later part of the program.
checkout a different revision
use those files as inputs to another part of the program
Essentially, I want to be able to swap the contents of my temp folder with whichever revision. With the command line interface I've been able to do this with git checkout master and git checkout dylanbranch (where dylanbranch is a branch I made on my own clone with an arbitrarily chosen revision), but my Java code attempting to do the same thing fails:
Git git = Git.open(new File("checkout")); //checkout is the folder with .git
git.checkout().setName("master").call(); //succeeds
git.checkout().setName("dylanbranch").call(); //fails
And the exceptions printed to the console:
Exception in thread "main" org.eclipse.jgit.api.errors.JGitInternalException: Checkout conflict with files:
src/sizzle
test/qunit
at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:211)
at com.avi.scm.git.BranchCheckout.main(BranchCheckout.java:30)
Caused by: org.eclipse.jgit.errors.CheckoutConflictException: Checkout conflict with files:
src/sizzle
test/qunit
at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:387)
at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:162)
... 1 more
I can verify that the files in question are marked as deleted and not staged for commit by using git status though I'm not sure why those changes are there, and they come back any time I switch back to the master branch. Despite that, I can still successfully change the working tree with command line Git.
So my question: Why won't JGit work for this application when command line git will?
Any other helpful information is appreciated- educate me :)
Update I've been testing with the jQuery repository, and have noticed a few more problems with JGit: When I am working with the "master" branch, git status temms me that I'm #On branch master and that there is nothing to commit (working directory clean), but using JGit's status command I see that test/qunit and src/sizzle are marked as Missing. JGit's reset seems to do nothing.
The two directories mentioned in the stack trace are Git submodules (test/qunit and src/sizzle) which is most likely the cause of the problem since JGit does not have full submodule support yet.
This may function differently in the 1.1 JGit release due out this month based on this commit.
You can read more about the current state of JGit submodule support here.
I know this doesn't directly answer your question, but I've also had problems with the Java implementations of Git. What worked best for me was to simply ditch the java implementations, and execute command-line calls to git from within the application. It may not be ideal, but it'll do exactly what you want since you'll fully control the command.
Simply call
Runtime.getRuntime().exec(...)
Link to Javadoc for Runtime class
I had a similar problem with Checkout. I think that the fact that you can switch branch with unstaged content in Git is actually a tolerance, not a feature.
JGit is globally not as tolerant as Git, so you should usually test many cases.
It seems it is not directly your problem (which is related to the submodules), but for more general cases you would want to commit your changes before using checkout to switch to another branch.
Note that the CheckoutCommand works perfectly for me to start a new branch from an old revision (you have to set the name of the branch and the start revision).

Why do I keep getting 'SVN: Working Copy XXXX locked; try performing 'cleanup'?

If you have worked with SVN tools in Eclipse (Subversion, subversive) before, then you are likely familiar with the 'working copy 'XXX' locked..." error.
I found a very useful post with a workaround for this problem at: Working copy XXX locked and cleanup failed in SVN
As great as the workaround is, it is a pain to do it over and over again. Does anyone know why I keep getting this error and what steps I could take to prevent it?
Context: I am creating an Eclipse plugin that involves listening for SVN events, so in testing this plugin, I am constantly opening and closing the workspace. I usually do 1 or 2 commits each time I open the workspace. Every so often the commit will fail and I get the 'working copy locked' error. I would love for this error to not happen anymore, so any advice is appreciated.
Thanks!
Select the project
Right click on the selected Project
Team -> Cleanup
Problem Solved.
Note: The Above steps will work only Eclipse(Indigo package)
Generally a .lock file is created and it decides lock/unlock state checking the existince of this file. I think if you delete this .lock file only, then the problem will go away.
I've had a lot of issues with SVN before and one thing that has definitely caused me problems is modifying files outside of Eclipse or manually deleting folders (which contains the .svn folders), that has probably given me the most trouble.
edit
You should also be careful not to interrupt SVN operations, though sometimes a bug may occur and this could cause the .lock file to not be removed, and hence your error.
Make sure you exactly cleanup what the console says. For example if a subfolder (a package) is locked:
svn: E155004: Commit failed (details follow):
svn: E155004: Working copy 'C:\Users\laura\workspace\tparser\src\de\test\order' locked
svn: E155004: 'C:\Users\laura\workspace\tparser\src\de\test\order' is already locked.
cleanup C:/Users/liparulol/workspace/tparser/src/de/mc/etn/parsers/order
Then you need to cleanup the specified folder and not the whole project. If you are in eclipse right click on the package, not on the project folder and execute the clean up.
After more exploration and testing, it appears that this issue was being caused by debugging the plugin and using breakpoints. SVN/Subclipse apparently didn't like having breakpoints midway through their execution and as a result this lock files were being created. As soon as I started just running the plugin, this issue disappeared.
This will happen when something went wrong in one of your folders in you project.
You need to find out the exact folder that locked and execute svn cleanup under the specific folder.
You can solve this as follows:
run svn commit command to find out which folder went wrong.
change directory to that folder and run svn cleanup. Then it's done.
The following should unlock a locked working copy (tested on svn client version 1.6.11 and elipse version: Mars.2 Release (4.5.2))
step 1: (go to working copy directory) $cd working_copy_dir
step 2: (connect to svn sqlite database) $sqlite3 .svn/wc.db
step 3: (delete all records from table WC_LOCK) sqlite> delete from WC_LOCK;
step 4: (disconnect from sqlite 3 database) sqlite>ctrl + d
step 5: (from eclipse) right click on your working copy, then click Team -> Refresh/Cleanup
I had the same problem using the com.xxx.service.model package.
To fix it, I first made a backup of the code changes in the model package. Then deleted model package and synchronized with the repository. It will show incoming the entire folder/package. Then updated my code.
Finally, paste the old code commit to the SVN Repository. It works fine.
This happened to me when I copied a directory from another subversion project and tried to commit. The soluction was to delete the .svn director inside the directory I wanted to commit.
This type of problem can happen when you delete/move files around - in essence making changes to your directory structure. Subversion only checks for changes made in files already added to subversion, not changes made to the directory structure. Instead of using your OS's copy etc commands rather use svn copy etc. Please see http://svnbook.red-bean.com/en/1.7/svn.tour.cycle.html
Further, upon committing changes svn first stores a "summary" of changes in a todo list. Upon performing the svn operations in this todo list it locks the file to prevent other changes while these svn actions are performed. If the svn action is interrupted midway, say by a crash, the file will remain locked until svn could complete the actions in the todo list. This can be "reactivated" by using the svn cleanup command. Please see http://svnbook.red-bean.com/en/1.7/svn.tour.cleanup.html
Solution:
Step1: Have to remove “lock” file which present under “.svn” hidden file.
Step2: In case if there is no “lock” file then you would see “we.db” you have to open this database and need to delete content alone from the following tables
– lock
– wc_lock
Step3: Clean your project
Step4: Try to commit now.
Step5: Done.

Categories