svn - single file not under version control - linux

I've added a new file (pdf) to a directory and when I try and commit the new file it is saying that it is not under version control, the directory and every other file in the directory is under version control as when I tried svn add * it listed all the files as being under version control.
What is causing this problem and how do I fix it?
EDIT: OK I am now able to add the file, am I right in saying that the svn add * command added this file under version control thus allowing me to commit the file?

Yes, the svn add * did that.
You have to svn add Name_of_File any new files before you can svn commit them.

you can try something like this...
in the checkout directory run this command
svn add . --force
then just commit it all
svn commit -m "your text" *

In some cases the add command doesn't do it, and still gives an error. the best thing is to perform the svn cleanup [PATH...] command then try to add or commit.

Related

How to go back to the Working Directory that was not committed

I forgot to commit on the directory where I was working and then I checkout to the previous commit and now I want to back to the directory where I used to work. What can i do ?
If your checkout of the previous version somehow deleted your folder, which was not added/committed, then you would need to rely on a file recovery utility, as detailed in "Can I restore deleted files (undo a git clean -fdx)?", or on your IDE. Some of them keep a local history (IntelliJ IDEA, VSCode through an extension, ...): you might get back some of your files content that way.
In the end, it depends on the exact git checkout command you did, considering this command can update files and/or branches.
That is why it is recommanded to use git switch (branch only) or git restore (files only), instead of git checkout.

Copying file from desktop to remote repository on SVN

I am extremely new to SVN, I am using SVN on Mac OS terminal. I have a file on my laptop that I want to transfer to my repository on my remote server.
This is what I have done:
I have checked out the repository. It says "checked out revision *".
I have used cd until the folder that I want to insert the file. So at this point I have a path like: (...../src/soln$) so I want to insert the file in the 'soln' folder.
When I try:
svn add ('...../lo.java') (the path to my file on my computer) it says:
('....../src/soln/') is not a working copy
svn import ...../lo.java it brought something weird to the screen
Please help me figure out what I am doing wrong or not doing.
The error indicates that the parent is not yet in svn. Try to svn add each folder above lo.java.
As an example if the repo root is at /path/to/my/repo and your file is in /path/to/my/repo/src/soln/lo.java then you'll not only want to svn add lo.java from inside the soln directory, but you'll also want to svn add /path/to/my/repo/src and then svn add /path/to/my/repo/src/soln before you can perform the svn add lo.java

Subversion: File properties

I am using Subversion to manage my python code. But I have no idea how to put the file properties of my configuration file.
For example I have the configuration file checked in on my development platform. I want to make sure that
After the configuration file is being checked out. The SVN up process should ignore the modified configuration file.
On the server side I have the golden configuration file. Therefore the SVN commit should ignore the configuration file as well.
I have no idea how to set the properties of the configuration file so I am seeking help here.
Thanks in advance
This comes up enough that it's in the Subversion FAQ
Short version: Create (and version) a "template" configuration file. Users check out a WC, make a filesystem local (not svn) copy which is to be ignored by Subversion, and then modify that copy.
You might want to look at my pre-commit hook.
But first, uou need to remove that configuration file from your Subversion repository. Instead, add a configuration template that developers can copy and use.
Once you remove the configuration file from your repository, you want to set svn:ignore to ignore it. This way, it doesn't accidentally get added if a user does a svn add * or sees it when they do a svn status.
However, if you want to be absolutely certain that this configuration file is never added to the project, you need a pre-commit hook that will refuse a commit if a user does add it.
Why don't you tell SVN to ignore the file?
$ cd path/to/config/file
$ svn delete --keep-local config.file
$ svn propset svn:ignore config.file
$ svn commit
What this does is first tell SVN that it should stop tracking the file (svn delete), then we set the svn:ignorepoperty on the directory in which the file resides, and then we commit these changes.
If you still want the configuration file to be tracked by SVN, then you can either commit your changes excluding the modifications on the file, or external the file in and be sure to ignore externals when committing.

svn Merge Problem (3 levels of svn)

I am new to use svn and the company in which I work uses three levels (I don't know whether this is a correct word to use here) of svn. I mean the developers are provided a working directory on a testing server. When we commit, it goes to the dev server. When a manager commits it from there it goes to production server. I am a developer here and one of my files is giving error (conflict) when I commit from directory. Not only, but also it gives conflict when manager tries to commit. I am now given access as manager too but I am still unable to resolve it.
What I've tried till now:
svn update
svn delete
svn commit
It gives conflict on all of these operations.
Earlier on a simple error happened and the manager preferred to just delete file on dev, copy it manually and then commit from there. I don't know this may be a reason of this problem or not.
Please help me resolve this issue. I've read some things in read-bean book too but to no avail yet.
Thanks
Ok, here's the update. The actual problem is that a file (ex lib/a.php) used to be in my working directory as well as in dev and production servers. Now it was deleted by someone (using del command, not svn delete) from dev server. Now question here is how I add it again so that it becomes part of svn again. The simple svn add doesn't work.
Update 2
From one of the answers below I understood that its a tree conflict. Some searching brought me to http://svnbook.red-bean.com/nightly/en/svn.tour.treeconflicts.html . Following the instructions, I took the backup of the file and then svn delete it from everywhere. Then I svn add it to my directory, commit it and tried to update dev and production. End result is that it doesn't go there. No error is shown either.
svn info in my directory shows complete info of the file but on dev and production it shows
file_name: (Not a versioned resource)
:S
Any more ideas please?
Alternatively you can take backup of the file ,then say svn revert filename insert you new code.Do a svn up just to make sure you do not have any conflicts,and then commit
Or
fix the conflicts in the file and then you can say svn resolved filename and then you can continue operations on the file
Update:If your file is deleted using rm or del command use svn revert filename to get it back and you do not have to add it again.Just put in your new changes and say svn ci -m"your comments" filename
svn revert will fetch back the last checked in copy into SVN and it wouldnt have your any changes made before the user had used del command
Update 2:After u say svn delete ,u need to commit it until u get the message Deleting filename with a new revision number.Then add the file using svn add command,then commit again.Once this is done you can check the svn info, let me know..
Use svn status command to know the status of the file
The only problem apart from this i can think of is this the directory may not have been added.Is this a new directory?
ah, the old tree conflict problem.
The issue is that SVN is letting you know that you're adding a file that used to be there but it cannot tell whether you're trying to delete it, add it or just update it! So it does the only thing it can - flags a conflict so you can sort it out and fix it. Its basically a conflict on the directory level (rather than a conflict of a file's contents).
What you do is resolve the error (as others have pointed out), then update the directory to get the original file back, then commit your changes. Note that the file was never deleted from SVN - its still in the repo, and if you checkout out a new WC, you'd get the file.
Try to resolve the conflicts then commit again:
svn resolve --accept working

SVN - How to upload a single file?

How do I upload a single file from my local computer to a SVN repository?
I can import a directory, but I can't import a single file into existing directory.
I use SVN in linux (command line).
Any help would be appreciated.
Edit:
I forgot to mention, I need to upload this file into a specific directory that has nothing to do with directory structure in my local computer (say I upload from Desktop).
So I want to upload a file from Desktop to https://.../somefolder
This can be done as the OP requires.
svn import -m "Adding a new file" file_to_upload.ext http://example.org/path/to/repo/file_to_upload.ext
This allows uploading a file directly into the repository without checking out to a local working directory.
Well, short answer is that it doesn't work like that :)
In SVN you work with a checked-out revision of your repository. In order to "upload a single file" you have to "add" the file with "svn add foo.txt" and then run "svn commit -m "Added file foo" foo.txt". But you can only do this to an existing repository. Therefore you must first checkout the revision (rev of trunk or a given branch) of the repository to add the file to. So the entire steps would be something like
svn co https://svn.internal.foo.com/svn/mycoolgame/branches/1.81
create your new file in the correct place in the folder structure checked out.
svn add your new file
svn ci -m "added file lalalalala" you new file
After this, you can delete your local copy again.
8-year edit: As mentioned svn import can also be used to accomplish this without having a local copy under version control. Do note though that this does so recursively and will add directories not present in the repository. This could be desired behavior or a source of potential errors depending on the situation.
svn add /path/to/your/file.txt
svn ci /path/to/your/file.txt -m "This is where the message goes"
Or if you havn't added anything else just commit with
svn ci -m "Your message"
svn add filename
svn commit filename

Resources