Linux SVN中checkout和export的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/419467/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 16:51:22  来源:igfitidea点击:

Difference between checkout and export in SVN

linuxsvnexportsvn-checkout

提问by andycjw

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

SVN 结帐和 SVN 导出之间的确切区别是什么?

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 exportworks, but the one that is checked out doesn't work at all.

据我所知,导出不包括包含元数据的 .svn 目录,而结帐包含该 .svn 目录。然而,我的同事最近遇到了这个问题,即从 SVN 存储库检出和导出的源编译的东西有不同的行为。两者都编译正确,但是编译出来svn export的一个是有效的,但是检出的那个根本就行不通。

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?

PS:正在编译的东西是在嵌入式设备中使用的 Linux 2.4 内核。图像编译并正确加载,但检出的图像不起作用。它会在 insmod 期间导致内核崩溃。为什么会发生这种情况?

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.

PPS:我们尝试了校验和和差异工具来检查从 SVN 导出和检出的两个目录之间的差异。除了 .svn 目录外,它们都是相同的。

回答by notbenh

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.

正如您所说,结帐包括 .svn 目录。因此,它是一个工作副本,并且将具有正确的信息来进行提交(如果您有权限)。如果您进行导出,您只是获取存储库当前状态的副本,并且无法提交任何更改。

回答by gak

svn exportsimply 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 export只是从修订中提取所有文件,并且不允许对其进行修订控制。它也不会用 .svn 目录乱扔每个目录。

svn checkoutallows you to use version control in the directory made, e.g. your standard commands such as svn updateand svn commit.

svn checkout允许您在创建的目录中使用版本控制,例如您的标准命令,如svn updatesvn commit

回答by Pawka

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

如果您想上传(或提供给某人)项目,请使用导出。如果您正在处理一个项目,请使用 checkout。

回答by gbarry

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.

构建过程是否有可能查看子目录并包含不应该包含的内容?顺便说一句,您可以进行合法结帐,然后删除 .svn 及其包含的所有内容。那应该给你和出口一样的东西。尝试在删除元数据之前和之后编译它,就像它一样。

回答by gbarry

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"?

额外的思考。你说 insmod 崩溃了。Insmod 加载模块。这些模块是在构建内核的另一个编译操作中构建的。内核和模块必须从相同的头文件等构建。所有模块都是在内核构建期间构建的,还是“存在”的?

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.

另一个想法,我知之甚少,是 svn externals,它(如果使用)会影响检出到您的项目的内容。看看这在导出时是否有任何不同。

回答by exception

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.

因为如果是,checkout 将更新工作副本,包括删除任何文件。

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?

因此,您导出副本可能仅起作用,因为它依赖于已在存储库中删除的文件?

回答by Robino

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

(补充杰拉德的回答......)另一个微妙的区别是,尽管命令:

svn checkout ...repos_location/my_dir .

svn checkout ...repos_location/my_dir .

puts the files in my_dirinto the current directory (with the .svnfolder)

将文件my_dir放入当前目录(带有.svn文件夹)

in certain versions of the svn, the command:

在某些版本的 svn 中,命令:

svn export ...repos_location/my_dir .

svn export ...repos_location/my_dir .

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

my_dir在当前目录中创建一个名为的文件夹,然后将导出的文件放入其中。

回答by SteveScm

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.

如果你想处理你的文件,那么你需要签出,因为它将包含 .svn 文件夹,其中包含制作工作副本的元数据,否则你会在导出时出错。

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

如果你这样做svn export然后编辑一些文件然后提交,那么你会得到一个错误:

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

../../xxx 不是您的工作副本。

回答by TheFixer

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"

如果您使用的是 tortoise svn 客户端 - 导出时 - 它显示 ..export / checkout ,令人困惑,它只是导出。仅查看/阅读使用 export ,提交使用 - “结帐”