0

由于 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 info”的行为完全不同:无论文件是否存在(来自以前的导出),答案是:

# 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 中检测到这个未版本控制的文件?

4

1 回答 1

0

svn infosvn info FILENAME不同的事情。

第二种形式可以获取有关未版本化文件的信息,第一种形式可以获取有关WC中当前目录的信息

于 2013-07-25T10:34:38.070 回答