3

Is there a utility like ls -l in Subversion?

The purpose is to differentiate between files and directories. There is svn ls command but it simply lists all files and directories so if a file is committed without extension it looks like a directory.

For example.

M/trunk/Database/Base
M/trunk/Database/Upgrade
M/trunk/Database/readme

readme is a file here.

4

4 回答 4

0

好的...明白了.. svn info就是答案

例如:

Path: /root/trunk/testproj
URL: https://my.svn.net/svn/testproj/trunk
Repository Root: https://my.svn.net/svn/testproj
Repository UUID: cdc0d28-0418-b024-f56a02f096e4
Revision: 100
**Node Kind: directory**
Schedule: normal
Last Changed Author: jack
Last Changed Rev: 100
Last Changed Date: 2013-06-10 14:11:08 +0530 (Mon, 10 Jun 2013)

这里的“节点种类”提供了我需要的信息。

于 2013-06-12T06:59:00.960 回答
0

您可以使用svn info <URL>命令来确定路径是代表文件还是目录。

运行命令svn info http://svn.apache.org/repos/asf/subversion/trunk/tools,结果将是:

Path: tools
URL: http://svn.apache.org/repos/asf/subversion/trunk/tools
Relative URL: ^/subversion/trunk/tools
Repository Root: http://svn.apache.org/repos/asf
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 1663737
Node Kind: directory
Last Changed Author: danielsh
Last Changed Rev: 1663005
Last Changed Date: 2015-03-01 00:31:24 +0300 (Sun, 01 Mar 2015)

“Node Kind:directory”条目表示/asf/subversion/trunk/tools是一个目录。

运行命令svn info http://svn.apache.org/repos/asf/subversion/trunk/README,结果将是:

Path: README
Name: README
URL: http://svn.apache.org/repos/asf/subversion/trunk/README
Relative URL: ^/subversion/trunk/README
Repository Root: http://svn.apache.org/repos/asf
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 1663738
Node Kind: file
Last Changed Author: danielsh
Last Changed Rev: 1242804
Last Changed Date: 2012-02-10 18:58:53 +0400 (Fri, 10 Feb 2012)

“Node Kind:file”条目表示/asf/subversion/trunk/README是一个文件。


您可以在命令中添加--xml命令行选项以svn info获取更易于解析的 XML 输出:

svn info http://svn.apache.org/repos/asf/subversion/trunk/README --xml

<?xml version="1.0" encoding="UTF-8"?>
<info>
<entry
   path="README"
   revision="1663740"
   kind="file">
<url>http://svn.apache.org/repos/asf/subversion/trunk/README</url>
<relative-url>^/subversion/trunk/README</relative-url>
<repository>
<root>http://svn.apache.org/repos/asf</root>
<uuid>13f79535-47bb-0310-9956-ffa450edef68</uuid>
</repository>
<commit
   revision="1242804">
<author>danielsh</author>
<date>2012-02-10T14:58:53.499287Z</date>
</commit>
</entry>
</info>
于 2015-03-03T16:48:49.043 回答
0

这可以通过将svn status和的输出合并的脚本来完成ls -l

于 2013-06-11T07:29:37.120 回答
0

在 的输出中svn ls,任何以结尾的行/都是一个目录。如果没有/并且条目结束,则它是一个文件。

您还可以使用 的输出svn ls --verbose并对其进行解析,以在“文件长度”列(日期戳之前的列)中查找整数。如果没有整数,则为目录。如果有,那就是一个文件。

于 2013-06-11T14:11:53.717 回答