Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java  view on Meta::CPAN


    /**
     * @since 1.5
     */
    public void status(String path, int depth, boolean onServer,
                       boolean getAll, boolean noIgnore,
                       boolean ignoreExternals, String[] changelists,
                       final StatusCallback callback)
            throws ClientException
    {
        try
        {
            aSVNClient.status(path, Depth.toADepth(depth), onServer, getAll,
                              noIgnore, ignoreExternals,
                              changelists == null ? null
                                : Arrays.asList(changelists),
        new org.apache.subversion.javahl.callback.StatusCallback () {
         public void doStatus(String path,
                              org.apache.subversion.javahl.types.Status aStatus)
                    {
                        if (aStatus != null)
                            callback.doStatus(new Status(aSVNClient, aStatus));
                        else
                            callback.doStatus(new Status(path));
                    }
                });
        }
        catch (org.apache.subversion.javahl.ClientException ex)
        {
            throw new ClientException(ex);
        }
    }

    /**
     * @deprecated Use {@link #list(String, Revision, Revision, int, int,
     *                              boolean, ListCallback)} instead.
     * @since 1.0
     */
    public DirEntry[] list(String url, Revision revision, boolean recurse)
            throws ClientException
    {
        return list(url, revision, revision, recurse);
    }

    /**
     * @deprecated Use {@link #list(String, Revision, Revision, int, int,
     *                              boolean, ListCallback)} instead.
     * @since 1.2
     */
    public DirEntry[] list(String url, Revision revision,
                                  Revision pegRevision, boolean recurse)
            throws ClientException
    {
        class MyListCallback implements ListCallback
        {
            private List<DirEntry> dirents = new ArrayList<DirEntry>();

            public void doEntry(DirEntry dirent, Lock lock)
            {
                // All of this is meant to retain backward compatibility with
                // the old svn_client_ls-style API.  For further information
                // about what is going on here, see the comments in
                // libsvn_client/list.c:store_dirent().

                if (dirent.getPath().length() == 0)
                {
                    if (dirent.getNodeKind() == NodeKind.file)
                    {
                        String absPath = dirent.getAbsPath();
                        int lastSeparator = absPath.lastIndexOf('/');
                        String path = absPath.substring(lastSeparator,
                                                        absPath.length());
                        dirent.setPath(path);
                    }
                    else
                    {
                        // It's the requested directory, which we don't want
                        // to add.
                        return;
                    }
                }

                dirents.add(dirent);
            }

            public DirEntry[] getDirEntryArray()
            {
                return dirents.toArray(new DirEntry[dirents.size()]);
            }
        }

        MyListCallback callback = new MyListCallback();

        list(url, revision, pegRevision, Depth.infinityOrImmediates(recurse),
             DirEntry.Fields.all, false, callback);

        return callback.getDirEntryArray();
    }

    /**
     * @since 1.5
     */
    public void list(String url, Revision revision,
                            Revision pegRevision, int depth, int direntFields,
                            boolean fetchLocks, final ListCallback callback)
            throws ClientException
    {
        try
        {
            aSVNClient.list(url,
                         revision == null ? null : revision.toApache(),
                         pegRevision == null ? null : pegRevision.toApache(),
                         Depth.toADepth(depth), direntFields, fetchLocks,
        new org.apache.subversion.javahl.callback.ListCallback () {
            public void doEntry(org.apache.subversion.javahl.types.DirEntry dirent,
                                org.apache.subversion.javahl.types.Lock lock)
            {
                callback.doEntry(new DirEntry(dirent),
                                 lock == null ? null : new Lock(lock));
            }
                });



( run in 0.977 second using v1.01-cache-2.11-cpan-39bf76dae61 )