can't commit code after renaming a file - version-control

What I did:
renamed a file
tried to commit
cvs fails with error message
file should be removed and is still there (or back again)
What is the problem and how do I solve it so that I can commit?
Additional information:
I'm using Eclipse with the CVS plugin.
doing an ls in the directory where the file was shows that it is not there
All the other Google hits for this problem (including this question) seem to be asking what to do when a file has been removed with cvs, and then restored outside of cvs' scope. My problem is different: I just need to rename a file.

It means that the file was flagged for deletion by CVS but then appeared again. Renaming for CVS is just a deletion of the file with old name and adding the file with new name. The file must be appeared again with its old name.
You can do 2 things:
1) If you don't need this file then just delete it. (Use cvs -n update command to find its name.) Then you will be able to commit.
1) if you need this file to stay, go to the .CVS subfolder of the folder where the file is located and edit Entries file. Find a line with your file and delete it. Then rename you file (give it a temporary name), call cvs update, rename your file back overriding the new one appeared after cvs update.

Related

.gitignore file not ignoring .env.local or any other supposed private file

I encountered this error because I once mistakenly committed .env.local before adding it to .gitignore. The answer to it below.
If you're facing something similar and you use the Git GUI in VSCode, just follow these steps:
Open your .env.local file or any file that's having this issue, copy the content to clipboard, and delete the file entirely.
Open your .gitignore file and delete the line that removes that file.
Commit your changes (not necessarily publish).
Now create a new .env.local file (or the file you deleted earlier in your case.)
Switch to your Source Control tab (where you see staged files), right click on this newly created file and add it to .gitignore
Now, it will be ignored for real.

In CVS how to ignore a file which is already checked in

In our CVS (not git!) repo I have a file which I checked in a while ago. Now we have decided not to keep it in version control.
How can I keep the file in my local directory but tell CVS not to store it? Just adding it to .cvsignore (obviously) doesn't do the trick.
As #tripleee mentioned in the comments, the following works:
Move the file in question out of the repository (but don't delete it).
Check in the removal of the file.
Commit the change to CVS.
Move the file back into its location the repo.
Add it to the appropriate .cvsignore file.
Done.

How to get deleted file from SVN Repository

I deleted a file from my Eclipse work space but that file is in SVN repository. Could any one help me to get my deleted file from SVN without using the command line?
There's a simpliest way to recover the file with Eclipse+SVN only.
Go to SVN Repositories view, find a folder your file was located, make a right click and choose Show History. You will see the list of commits to THIS FOLDER in the History view. Please make sure it's switched to Remote Revisions. From the list of commits find a commit that deleted the file. In the pane below there's a list of files involved with this commit - you can find deleted files with minus sign. Double click will open this file in editor...
If you've deleted the file in Eclipse, Eclipse has told Subversion to mark the file for deletion. This means the next commit will delete the file. You'll have to do a revert.
If you've deleted this file via Internet Explorer or some other file browser, and didn't tell Subversion, then the file isn't marked for deletion. Simply updating the file will bring it back.
This is where the command line client sings. With the command line client, I could tell Subversion to update or revert a nonexistent file. With a GUI, I would first have to select the file, then tell Subversion what to do. But without a file, I can't do anything.
Easiest solution: Recreate the file. The contents are not important. It can be empty or contain a dirty limerick for all you care. You're basically making a file you can select with your file browser.
Then, you can select the file and tell Subversion and/or Eclipse via the Team menu to revert it. This way, it doesn't matter how the file was deleted. Subversion will restore the file back to its original checked out version.
Along the lines of Bryn's solution, using Subclipse, find the delete 'D' entry for the file in SVN history, right-click and do "Copy..." which will then ask you to specifiy a location in your Eclipse workspace. Click OK, it will probably take a little while, and that's it.
I first tried "Export...", but that didn't work for me, seems like subclipse is looking in HEAD, even though an older revision was selected.

Restore revision history of a copied file using Perforce

I copied a bunch of java classes into another java package outside of perforce by accident and made a bunch of changes to them. I now realised that the revision history of those files has been lost as I didn't use perforce to copy the files over.
Example:
original file - dir1/Class1.java
copied file - dir2/Class1.java
The original file still exists.
If I want to restore the revision history of the files what would be the appropriate command to run in order to do this?
You should have branched the file in Perforce rather than copied it outside of Perforce, but that can be remedied.
Copy dir2/Class1.java to another location then delete the original
Branch dir1/Class1.java to dir2/Class1.java
Check out dir2/Class1.java
Copy the backup of the file you made in step 1. to dir2/Class1.java
Check in dir2/Class1.java
You will then have your recent modifications to the file dir2/Class1.java in version control and the file will be linked to its original via the branch history.

cvs, "file should be removed and is still there (or back again)"

I am trying to commit a project in which a file has been "cvs remove"d, but actually needs to be there. The contents has been completely rewritten, but it needs to retain the same name.
I am unable to either commit the project or re-add the file without getting this annoying error message. How do I "unremove" a file in CVS?
This worked for me:
Rename the file
mv mistakenly_removed_file wtf
Ask cvs to add the old version:
cvs add mistakenly_removed_file
cvs then reports it has resurrected the removed file.
mv wtf mistakenly_removed_file
cvs status reveals that the file is now "locally modified"
cvs add FILE
Or, alternatively, if you want to get the latest copy back from the repository
cvs update -C FILE