简体   繁体   中英

In Perl subversion bindings how do I dtermine if a directory is in a working copy

I'm using the perl Subversion bindings (SVN::Client et al). If I have a directory path, how do I determine if that path is part of a working copy - it must be fast.

Before svn 1.7 one could check for a path/.svn directory, but obviously that doesn't work in svn 1.7 with a single higher level .svn directory. I can't just recurse directories upwards for .svn, as that will fail in non-tracked directories far under a working copy.

$SVN::Error::handler = undef;
$client->status2($path, undef, sub {
    my ($path,$wc_status2) = @_;
    if ($wc_status2->entry()) { it exists }

seems close, but this returns an error (I suppress) if the path is outside a working copy, and benchmarks fairly slow. I suspect there's some basic function I'm missing in my reading. Thanks much.

I am not familiar with SVN::Client, but svn info gives Working Copy Root Path . Perhaps it is possible to access this with SVN::Client::info. In fact, if you are only interested in whether a directory is under Subversion control, svn info output may be sufficient.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM