78

What is the exact difference between SVN checkout and SVN export?

From what I know, export does not include the .svn directory which include metadata, and checkout included that .svn directory. Yet, my colleague had this problem recently that there is a different behaviour for the stuff compiled from sources that is checkout and exported from SVN repo. Both of them compiled correctly, but the one compiled from svn export works, but the one that is checked out doesn't work at all.

PS: The stuff being compiled is the Linux 2.4 kernel that is being used in an embedded device. The image compiles and load correctly, but the checked out one doesn't work. It causes a kernel panic during insmod. Why could this happen at all?

PPS: We've tried checksumming and diff tool to check the difference between the two directories that are exported and checked out from SVN. Both of them are the same except for the .svn directory.

Zoe
  • 27,060
  • 21
  • 118
  • 148
andycjw
  • 1,021
  • 1
  • 8
  • 11
  • 6
    The title of your question unfortunately invites a lot of explanation of the difference between checkout and export. Mentioning the crashing could bring better help. – gbarry Jan 07 '09 at 17:57

9 Answers9

107

svn export simply extracts all the files from a revision and does not allow revision control on it. It also does not litter each directory with .svn directories.

svn checkout allows you to use version control in the directory made, e.g. your standard commands such as svn update and svn commit.

gak
  • 32,061
  • 28
  • 119
  • 154
11

As you stated, a checkout includes the .svn directories. Thus it is a working copy and will have the proper information to make commits back (if you have permission). If you do an export you are just taking a copy of the current state of the repository and will not have any way to commit back any changes.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
notbenh
  • 197
  • 6
9

Are you re-running your checkout or export into an existing directory?

Because if you are, checkout will update the working copy, including deleting any files.

But export will simply transfer all the files from the reporsitory to the destination - if the destination is the same directory, this means any files deleted in the repository will NOT be deleted.

So you export copy may only work because it is relying on a file which has been deleted in the repository?

exception
  • 569
  • 7
  • 20
  • Thanks, This works for me, as my deleted files were showing even after commit, as i was using svn export rather than svn checkout. – useranon Dec 22 '16 at 14:39
6

Any chance the build process is looking into the subdirectories and including something it shouldn't? BTW, you can do a legal checkout, then remove the .svn and all it contains. That should give you the same as an export. Try compiling that, before and after removing the metadata, as it were.

gbarry
  • 10,352
  • 6
  • 33
  • 43
  • We've tried this before, it's not working for us, it's really frustrating for both of us. – andycjw Jan 07 '09 at 09:24
  • Are you comparing a fresh checkout to an export or a repository that was once checked out and updated to an export? If the latter, you might have some cruft lying around that gets pulled into the build. –  Jan 07 '09 at 09:49
  • Wait...! What does "not working" mean? That the build works and so the experiment fails, or the build fails and thus proves that the metadata is what confuses it? – gbarry Jan 07 '09 at 17:39
  • 'not working' here meant with the legal checkout and stripped of .svn using 'find . -name .svn | xargs rm -rf', the build doesn't work exactly like export, when it should be, since like everyone knows, export is just checkout without the .svn metadata for version control – andycjw Jan 08 '09 at 03:36
  • So, now, if you were to remove *parts* of .svn (or maybe just having an empty .svn) you can "divide and conquer" and ultimately discover just what is causing it to fail. Given infinite time, anyway. Have you diff'ed the two kernel images? (and the module images?) – gbarry Jan 08 '09 at 06:32
2

Use export if you want to upload (or give to somebody) a project. If you are working with a project, use checkout.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Pawka
  • 2,526
  • 3
  • 25
  • 32
2

(To complement Gerald's answer...) One further subtle difference is that, although the command:

svn checkout ...repos_location/my_dir .

puts the files in my_dir into the current directory (with the .svn folder)

in certain versions of the svn, the command:

svn export ...repos_location/my_dir .

will create a folder called my_dir in the current directory and then place the exported files inside it.

Robino
  • 4,530
  • 3
  • 37
  • 40
1

Additional musings. You said insmod crashes. Insmod loads modules. The modules are built in another compile operation from building the kernel. Kernel and modules have to be built from the same headers and so forth. Are all the modules built during the kernel build, or are they "existing"?

The other idea, and something I know little about, is svn externals, which (if used) can affect what is checked out to your project. Look and see if this is any different when exporting.

gbarry
  • 10,352
  • 6
  • 33
  • 43
0

Very simple difference, If you just want to see the structure of your project then go for export.

And if you want to work on your files then you need to checkout as it will include the .svn folder which contains the metadata which makes the working copy, else you get the error in export.

If you do svn export and then edit some files and then commit, then you will get an error:

../../xxx is not your working copy.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
SteveScm
  • 545
  • 1
  • 7
  • 15
-1

if you are using tortoise svn client - while exporting - it displays ..export / checkout , it is confusing , it is just export only. only view/read use export , to commit use - "checkout"

TheFixer
  • 89
  • 1
  • 2