由于SVN存储库中的结构复杂,因此无法从存储库中正确检索某些外部文件。由于更改存储库结构不是一个选项,我已经开发了一个脚本,它遍历外部并在需要时“手动”检索它们(感谢'svn export')。为了检测是否确实需要这个操作,我执行'svn info',假设如果文件不存在它将返回0,或者它没有版本化。这确实是在host1(SVN Client 1.6.17)中获得的行为:
# Initially, the directory is empty
host1$ ls
host1$ svn update
Fetching external item into 'main.rbf'
svn: warning: '<REMOTE_SVN_LOCATION1>'
is not the same repository as
'<REMOTE_SVN_LOCATION2>'
At revision 18413.
# Although we do the update, the external item is not fetched,
# as it is a single file coming from a different repository
# (known problem)
host1$ ls
# The file is not present, and SVN info acts accordingly
host1$ svn info main.rbf
main.rbf: (Not a versioned resource)
svn: A problem occurred; see other errors for details
# If we force the SVN export
host1$ svn export <REMOTE_SVN_LOCATION1> main.rbf
A main.rbf
Export complete.
host1$ ls
main.rbf
# then SVN info detects it and acts accordingly
host1$ svn info main.rbf
main.rbf: (Not a versioned resource)
svn: A problem occurred; see other errors for details
host1$
在host2,(SVN Client 1.6.11)中,“SVN信息”的行为完全不同:无论文件是否存在(来自先前的导出),答案是:
# Directory is empty
host2$ ls
host2$ svn info main.rbf
Path: .
URL: <REMOTE_LOCATION>
Repository Root: ...
Repository UUID: ...
Revision: 18413
Node Kind: directory
Schedule: normal
Last Changed Author: ...
Last Changed Rev: 18326
Last Changed Date: ...
host2$
有没有理由解释这种不一致的行为?如何在host2中检测到这个未版本控制的文件?
答案 0 :(得分:0)
svn info
和svn info FILENAME
执行不同的事情。
第二个表单可以获取有关无版本文件的信息,第一个表格获取有关WC内当前目录的信息