Hi,

Den sön 27 apr. 2025 kl 13:02 skrev Jian Wang <jasonwang0...@gmail.com>:

> Hi~
> I'm coding to use svn in my Unity project, and want find a way to get file
> status
> I've tried `svn status` command, in most cases it works well,
> however when  -u and --depth=empty are both enabled, the entry block is
> missing.
> The following is my test:
>
> Step 1
> svn status --depth=empty "H:/svn/UnityTest/Assets/ddd.meta
>

I assume you also have the --xml option here, based on the below output.


> got
>
> <?xml version="1.0" encoding="UTF-8"?>
> <status>
> <target
>   path="H:\svn\UnityTest\Assets\ddd.meta">
> <entry
>   path="H:\svn\UnityTest\Assets\ddd.meta">
> <wc-status
>   props="none"
>   item="unversioned">
>
> Please note the "unversioned" status here (without the --xml option you
would get
[[[
?        H:\svn\UnityTest\Assets\ddd.meta
 ]]]
This means the file isn't under version control.


> </wc-status>
> </entry>
> </target>
> </status>
>
> Step 2
> And I add -u
> svn status --depth=empty -u "H:/svn/UnityTest/Assets/ddd.meta
> the output is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <status>
> <target
>    path="H:\svn\UnityTest\Assets\ddd.meta">
> <against
>    revision="27"/>
> </target>
> </status>
>
> The entry part disappear
>

You are asking the repository for any updates (-u) on the Assets\ddd.meta
file (and only that file). Since that file doesn't exist in the repository
it isn't reported.


>
> Step 3
> Try remove arg --depth=empty
>
> svn status -u "H:/svn/UnityTest/Assets/ddd.meta
> The output is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <status>
> <target
>   path="H:\svn\UnityTest\Assets\ddd.meta">
> <entry
>   path="H:\svn\UnityTest\Assets\ddd.meta">
> <wc-status
>   props="none"
>   item="unversioned">
> </wc-status>
> </entry>
> <against
>   revision="27"/>
> </target>
> </status>
>
> The entry part came back.
>
> After trying --depth=files and --depth=immediates, they all return xml
> contains the entry part.
>

With any depth other than empty, Subversion will do some level of
recursion. So it is probably reasonable to indicate that "we stopped
recursing on ddd.meta because it is a local file/path". But I could see a
point in arguing that we shouldn't return an <entry> at all in these cases.


>
> So why when  -u and --depth=empty are both enabled, the entry block is
> missing?  How can I tell if the target is unversioned in this case?
>

I assume you need -u to catch the case when the file is actually version
controlled and is changed in the repository.

Is there a particular reason why you need --depth=empty?

Kind regards,
Daniel

Reply via email to