Here we can see that SVN is not adding files that need to be added, and not committing:
$ ls -la forum
drwxr-xr-x 6 dotan.cohen coders 4096 Apr 9 02:09 before
$ svn status
? tags
? forum/before
$ svn add forum/before --force
$ svn status
? tags
? forum/before
$ svn commit -m "Some Comment"
$
The first command (ls -la) shows us that forum/before/ is in fact a directory. The next command svn status shows us that the directory is not under version control. The next line (svn add) shows an attempt to add the directory to version control, and the line after it shows that the directory still is not under version control. The last line shows that an svn commit does nothing, i.e. no commit.
I can confirm that the directory in question is not added to the repository. Why might that be, and how can I fix it? This is on CentOS 5. Thanks.
If you ever find yourself in this situation again, I would suggest using svn switch rather than deleting the .svn directories. This will re-point all of the URLs. The general syntax is switch URL[#PEGREV] [PATH].
The problem was that the directory in question was copied from another directory under version control. Removing all the .svn subdirectories resolved the issue. I used the following command to remove them (from within forum/before/):
rm -rf `find . -name .svn`
Related
I have Rails project. When I try to run any rake task or rails server it give me this error
env: ruby\r: No such file or directory
Could someone help me?
If you are working on a Unix / Mac, then this error is because you have incorrect line endings.
Here is a solution using dos2unix; you may need to install this program on your system. If apt is available, you can use sudo apt install dos2unix.
Set your line endings correctly, and have git manage how it handles them:
git config --global core.autocrlf input
In your directory you are going to convert all of the files by running:
find ./ -type f -exec dos2unix {} \;
This will cycle through all of your files, converting them. and solving the problem. Add your changes. Commit them, and you should be good to go.
You probably have edited ./bin/rake file and added \r at the end of first line:
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require_relative '../config/boot'
require 'rake'
Rake.application.run
Make sure that after "ruby" you have only new line char.
Thanks to the comments above, I solved my server issue that was caused from cloning my group's github rails app and causing localhost:3000 to fail. I was just working on the backend from my fullstack app: ruby(-v 2.7.1)/rails(-v 6.0.3.4). And these 2 people's comments solved my error:
"For those of you who got "find: ‘dos2unix’: No such file or directory" error: sudo apt install dos2unix" – RealMan Jul 26 '17 at 14:59
"Note that that find command may be excessive... this point is arguable; it may well be fine, but it may be overkill in some situations. Another possible route (for step 2 in this answer) is git rm -r --cached . followed by git reset --hard HEAD... which is likely faster (if nothing else, it won't run dos2unix on files in the .git housekeeping directory!)... This has potential gotchas as well (probably quite fine if you're running from a "clean" checkout, though), but thought I'd at least mention it." – lindes Jul 13 '19 at 0:42
I kept getting this error and finally figured out how to fix it.
I made sure all the permissions on the files in my bin folder were
executable.
Run ls -lha in your current repository. You want each file to have an x at the end like this
-rwxr-xr-x.
To achieve this, you will want to run chmod +x <file_name_here> for each file in your bin folder, such as chmod +x rails, chmod +x bundle, etc.
Now when you run ls -lha you should see that they all have an x at the end.
Next, either in SublimeText, Atom or what ever text editor you have, you will want to check that you are not using Windows line endings. The \r character is something Windows uses. Unix just uses \n for a new line.
I use Atom so I went to the plugins section (Cmd + , on Mac) and then searched for line-ending-selector in the Packages section, and then went to the line-ending-selectors settings. Change your default to 'LF'.
You will find that at the bottom of files, Atom will tell you the type of line ending the file is using with a CRLF for Windows and LF for Unix/Mac. You want all your files to use 'LF'.
So in your terminal, open each file in your bin folder in Atom, by running atom ./bin/filename (such as atom ./bin/rake).
At the bottom you will see 'CRLF' or 'LF'. If you see 'CRLF', click on it and, at the top of Atom, you can choose 'LF'.
Cmd + s to save.
Do this for each. You are basically telling your file to strip all Windows line endings and use Unix line endings instead.
Once all files are edited, you should be able to run your rake or rails command.
Note: Sublime Text and Text Mate should have equivalents to Atom's line-ending-selector.
For macOS users
Step 1: HOMEBREW_NO_AUTO_UPDATE=1 brew install dos2unix
Step 2: git config --global core.autocrlf input
Step 3: find ./ -type f -exec dos2unix {} \; (in the repo you were trying to run your task on)
git add and git commit
You are good to go!
If none of the works, try this:
git config --global core.autocrlf true
rails app:update:bin
I had the same problem on Windows Terminal, using WSL 2! I followed a post that recommended to install the dos2unix dependencie: sudo apt install dos2unix (Using apt package manager) and run other two commands:
git config --global core.autocrlf input (Set your line endings correctly, and have git manage how it handles them)
find ./ -type f -exec dos2unix {} \; (In your directory you are going to convert all of the files)
The git will identify a couple of changes, but you don't need to commit it. I just made a git restore . , remove node dependencies rm -rf node_modules and download it again yarn install.
I wanted to "clean" my git repo before pushing by removing every JPG file, so I entered:
find . | xargs rm *.png
in the git root and now everything is delted. Also my *.py files are deleted, but I do not know why? It is a Linux, Ubuntu machine. Is there any chance to recover my files? Maybe over my OS?
The command you typed is plain wrong:
find .
This command outputs the name of every file and directory below ., including hidden files.
xargs
This command takes its input and runs the command given as its argument, feeding it one line at a time as an argument. Therefore, it will run rm *.png <line1_from_find>, then rm *.png <line2_from_find>, etc.
There is no safeguard like stop on errors, so if you let the command run completely, it unlinked all files and you know have an empty directory tree. And git will not help you, because it works by storing its metadata and current state within a .git directory at the root of the working directory. In which you just deleted all files.
So no, unless you made a copy, either manually or by pushing you state to some other place, it's probably gone, but see below. For future reference, here is the correct command to destroy all files ending in png:
find . -name '*.png' -delete
Optionnaly add -type f before the -delete if you may have directories ending in .png, to filter them out.
Okay, what now: it happens that git marks some of its internal state as read-only, which rm honors if you didn't use rm -f and you might be able to recover some data from that. Go to the .git directory at your working directory's root. It will contain a objects directory, and some files may have survived there.
Those files are raw compressed streams, you can see their content using that command:
zlib-flate -uncompress <path_to_the_file
(the zlib-flate command comes from qpdf package on ubuntu)
for me the following worked:
$ git checkout -- name_of_deleted_directory
or
$ git checkout -- path_to_local_delected_directory
In my case, I deleted a directory by mistake and I didn't change any code in that directory but I had changed code in other directories of my git repo.
What is the difference between running: svn update DIR and running svn update with DIR as cwd? (DIR is my checkout's root).
Intuitively, I'd expect the two to do the same thing, but I noticed that when running the former (when cwd is outside the local checkout), sometimes not all updates are fetched. But then running the latter fetches what it needs to.
(running on linux)
EDIT: to all the skeptics, here's a session I've just had:
$ svn up DIR/
Password for 'xxx': ...
Skipped 'DIR'
$ cd DIR/
$ svn up
Password for 'xxx': ...
U aaa
U bbb
...
U .
Updated to revision 8965.
$
The following is pure wild speculation. I know virtually nothing about svn and nothing about its internals.
That being said I would guess that from outside the checkout svn looks in the current directory for configuration information, doesn't find any, and then does the minimum necessary to update the given directory (by reading its specific configuration information) and that from inside the checkout svn operates in a more recursive/project-aware mode because the local directory contains the configuration it needs.
Examining the operational differences between the two runs with something like strace might provide some clues.
Assuming there is a difference after all and what you are seeing isn't merely later changes getting pulled in by a second update (with an active project for example).
There is no difference. svn update without a target specified simply uses . as the target.
Based on your updated question. There are two ways you get the "Skipped 'DIR/'" message:
You had a path in conflict (either the target or one of it's parents) and you would have had to resolve it between the two commands. Which seems unlikely given your example
You had typoed the path in the svn up command and have the cdspell option turned on in your shell.
Take this for example:
$ ls -d trunk
trunk/
$ svn up truunk/
Skipped 'truunk'
$ cd truunk/
trunk/
$ svn up
At revision 1540579.
If you have a simple reproduction method I'd be interested in it.
On Linux, I need to know which files were added/modified/moved/deleted after compiling and installing an application from source code, ie. the command-line, Linux equivalent to the venerale InCtrl5.
Is there a utility that does this, or a set of commands that I could run and would show me the changes?
Thank you.
Edit: The following commands are sort of OK, but I don't need to know the line numbers on which changes occured or that "./.." were updated:
# ls -aR /tmp > b4.txt
# touch /tmp/test.txt
# ls -aR /tmp > after.txt
# diff -u b4.txt after.txt
If you only need to know which files were touched, then you can use find for this:
touch /tmp/MARK
# install application here
find / -newercm /tmp/MARK
This will show you all files whose contents or metadata have changed since you touched /tmp/MARK (including newly added files).
I would personally use something like Mercurial (version control) to do this.
The main reason, is that it is not only effective but it is also clean, since it will only add a hidden directory to the top of the tree where you want to check these changes.
Let's say that you need to know what files changed in /etc/. So before installation (you need to have mercurial installed) you add the directory to mercurial:
cd /etc
hg init
hg add
hg ci -m "adding all files in /etc/ to track them down"
The above will effectively "add" all the files to track them. To verify nothing has changed:
hg st
Should return no files.
If you (or the installation) modifies a file, you should see something like this:
hg st
M foo.sh
The "M" before the file states the given file was modified.
For new files you would see a ? before the file like:
? bar.sh
After you are done and no longer want Mercurial, simple remove the hidden directory:
cd /etc
rm -rf .hg
svn add guess_language/
svn: warning: 'guess_language' is already under version control
Why is this? When I downloaded it, it was under SVN. (I downloaded it from SVN)
How do I release that svn...so that I can turn it into a regular directory?
Remove the .svn directory inside guess_language/ and it's parent (if that also came from another SVN repository). This should allow you to add it to another SVN repository.
This also must be done recursively through guess_language's children. A command which can do this for you (depending on your Linux environment) is:
find . -name '.svn' -type d -exec rm -rf {} \;
(You probably shouldn't just take that for granted, test it with a non-deleting version, i.e find . -name '.svn' -type d and check the only directories listed are the ones you want to remove.)
you can force it to be added to your repository. Use:
svn add --force [folder]
Inside the guess_language directory there will be a hidden directory called .svn. This is how SVN knows that the directory is under version control. Delete that directory and you will then be able to add it to your SVN repository. You will have to do this for every directory, as each directory will have its own .svn directory.
(As an aside, if you look at the contents of a file called entries inside that directory, you can see the url of the SVN repository that the directory originally belonged to)
If you want a "copy" of the directory out of version control, use svn export. The exported directory will contain all the under version control contents of the original one, but will be a "regular directory".
Best regards.
Nuke all the .svn directories.
cd guess_language
find . -name .svn | xargs rm -fr
As the others said, remove the .svn directories to make subversion forget that it's a working copy checkout out from some repository. In the future you can svn export instead of svn checkout to download the files from svn without creating a working copy from them.