Discussion:
Remote path of a file in WC
Dario Imparato
2015-07-24 14:32:24 UTC
Permalink
Hello,
I am trying to "discover" the remote path (absolute path from root of svn repository) of a file in my working copy using Java SvnKit API.
Could you help me?

Thanks in advance.



Dario Imparato

Email : ***@codin.it

skype : darioimparato1987

CODIN S.p.A. - http://www.codin.it

Via del Pescaccio, 30

00166 Rome - Italy
Dmitry Pavlenko
2015-07-24 14:49:14 UTC
Permalink
Hello Dario,
Please use this code:

final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
try {
....
final SvnGetInfo getInfo = svnOperationFactory.createGetInfo();
getInfo.setSingleTarget(SvnTarget.fromFile(file));
final SvnInfo info = getInfo.run();

if (info != null) {
final SVNURL itemUrl = info.getUrl();
final SVNURL repositoryRootUrl = info.getRepositoryRootUrl();

if (itemUrl != null && repositoryRootUrl != null) {
final String pathAsChild = SVNPathUtil.getPathAsChild(repositoryRootUrl.toDecodedString(), itemUrl.toDecodedString());
if (pathAsChild != null) {
System.out.println("path = " + pathAsChild);
}
}
}
} finally {
svnOperationFactory.dispose();
}
--
Dmitry Pavlenko,
TMate Software,
http://subgit.com/ - git-svn bridge
Post by Dario Imparato
Hello,
I am trying to "discover" the remote path (absolute path from root of svn
repository) of a file in my working copy using Java SvnKit API. Could you
help me?
Thanks in advance.
Dario Imparato
skype : darioimparato1987
CODIN S.p.A. - http://www.codin.it
Via del Pescaccio, 30
00166 Rome - Italy
Dario Imparato
2015-07-25 12:14:09 UTC
Permalink
Thank you very much pavlenko
Post by Dmitry Pavlenko
Hello Dario,
        final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
        try {
            ....
            final SvnGetInfo getInfo = svnOperationFactory.createGetInfo();
            getInfo.setSingleTarget(SvnTarget.fromFile(file));
            final SvnInfo info = getInfo.run();
            if (info != null) {
                final SVNURL itemUrl = info.getUrl();
                final SVNURL repositoryRootUrl = info.getRepositoryRootUrl();
           
                if (itemUrl != null && repositoryRootUrl != null) {
                    final String pathAsChild = SVNPathUtil.getPathAsChild(repositoryRootUrl.toDecodedString(), itemUrl.toDecodedString());
                    if (pathAsChild != null) {
                        System.out.println("path = " + pathAsChild);
                    }
                }
            }
        } finally {
            svnOperationFactory.dispose();
        }
--
Dmitry Pavlenko,
TMate Software,
http://subgit.com/ - git-svn bridge
Post by Dario Imparato
Hello,
I am trying to "discover" the remote path (absolute path from root of svn
repository) of a file in my working copy using Java SvnKit API. Could you
help me?
Thanks in advance.
Dario Imparato
skype : darioimparato1987
CODIN S.p.A. - http://www.codin.it
Via del Pescaccio, 3
Loading...