Remote path of a file in WC

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Remote path of a file in WC

neo1987
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 [hidden email]

skype: darioimparato1987

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

Via del Pescaccio, 30

00166 Rome - Italy


Reply | Threaded
Open this post in threaded view
|

Re: Remote path of a file in WC

Dmitry Pavlenko-2
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

> 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 : [hidden email]
>
> skype : darioimparato1987
>
> CODIN S.p.A. - http://www.codin.it
>
> Via del Pescaccio, 30
>
> 00166 Rome - Italy

Reply | Threaded
Open this post in threaded view
|

Re: Remote path of a file in WC

neo1987
Thank you very much pavlenko

Il 24/lug/2015 16:49, Dmitry Pavlenko <[hidden email]> ha scritto:

>
> 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
>
> > 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 : [hidden email]
> >
> > skype : darioimparato1987
> >
> > CODIN S.p.A. - http://www.codin.it 
> >
> > Via del Pescaccio, 30
> >
> > 00166 Rome - Italy