What is the difference between svn import and checkout?
"import" and "checkout" are polar opposites.
"Import" is to bring something completely outside of version control into SVN.
Once something is under SVN control, you can "commit" (new modifications), or "checkout" (stuff you've already committed).
At any time, you can "export" some or all of your project into a "clean directory". The source you've exported is not under version control.
You "import into" and "export out of" SVN.
You "commit" and "checkout" stuff that's already under SVN control.
Subversion - What are the differences between the SVN checkout and SVN update commands?
As I see it, the big difference is that checkout
creates a working copy, whereas update
brings down changes to an existing working copy.
svn checkout between two revisions on the same branch
You can only check out individual revisions. What you are probably looking to do is export only the files changed between 2 revisions. Pseudocode:
svn diff --summarize -rSTART:END
for each item
svn export URL_TO_ITEM LOCAL_PATH
svn export and commit back to server
If you don't mind doing the svn command twice, you can checkout a single file using this method:
$ svn co --depth=empty http://svn.vegicorp.net/svn/proj
$ cd proj
$ svn up foo.txt
A foo.txt
$ vi foo.txt # Change foo.txt
$ svn commit -m"Modified foo.txt for the heck of it"
sending foo.txt
Transmitting file data .
Committed revision 194833
The --depth=empty
checks out your project and creates a working directory. However, it doesn't download any files in that working directory. Then, you can update the files you want which will download only those files. Here I'm downloading foo.txt to edit.
Once you're done, you can commit the changes and you've modified just one file without downloading the entire directory.
One little question
Exactly why are you doing this? I ask because usually when I see something like this, I find out that the build process is doing something wrong sub-opitmally. For example, one site was taking WSDL files, creating the Java source files from the WSDL, and then checking in the generated Java source files. I had to convince them that if they did their build correctly, they'd be automatically generating the Java source files during the build process, and there would be no reason to commit them.
I am not saying it should never be done. For example, you maybe updating a versioning file in this particular context, and want it saved as part of your versioning since the source code will use this file. It's that a process like this usually raises a flag for me. If I knew the reason, I might be able to suggest a better alternative.
How to find out difference between directory and svn checkout?
If you have svn installed, it's very easy: just execute svn status
inside the directory in question and it will tell if you if the current folder is a working copy or not.
If you do not have svn installed, you need to check for a .svn
folder. Note, however, that since svn 1.7 only the root node of a svn working copy contains the .svn
folder.
Update
If you need to check multiple directories at once, you can try this command:
for dir in dirs_to_check; do
svn info && echo $dir
done
This will print out all svn directories. dirs_to_check
should be a space-separated list of directories, e.g.
/home/user/proj1 /home/user/proj2 /home/user/proj3
What does SVN checkout do?
svn checkout
checks out (retrieves) a working copy of the repository into the specified folder. If you don't have access to the repository, and there's not already a current copy of the source in the folder, you can't possibly do a build.
If there is a current copy of the source there, it should include build.xml
.
If you had access to the repository, svn checkout
would only retrieve a copy of build.xml
if there was one in the repository for the copy being checked out. In other words, it won't magically add a build.xml
if one doesn't exist in the repository.
Related Topics
Bash Script; How to Use Vars and Funcs Defined After Command
Awk - Count Each Unique Value and Match Values Between Two Files
Linux - Replacing Spaces in the File Names
Comparing Two Unsorted Lists in Linux, Listing the Unique in the Second File
How to Convert Date to Unix Timestamp in Shell Script on MACos
Trying to Use Bash on Windows and Got No Installed Distributions Message
How to Hide Wget Output in Linux
Rename All Files in Folder to Numbered List 1.Jpg 2.Jpg
Shared Libraries: Windows VS Linux Method
Executing String Sent from One Terminal in Another in Linux Pseudo-Terminal
How to Clear All History in Linux/Ubuntu Terminal or Bash Permanently
How to Shield a CPU from the Linux Scheduler (Prevent It Scheduling Threads Onto That Cpu)
How to Install Crontab on Centos
What Exactly Is Sudo Bang Bang