⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svnclient.java

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
package org.tigris.subversion.javahl;/** * @copyright * ==================================================================== * Copyright (c) 2003-2005 CollabNet.  All rights reserved. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution.  The terms * are also available at http://subversion.tigris.org/license-1.html. * If newer versions of this license are posted there, you may use a * newer version instead, at your option. * * This software consists of voluntary contributions made by many * individuals.  For exact contribution history, see the revision * history and logs, available at http://subversion.tigris.org/. * ==================================================================== * @endcopyright */import java.io.File;import java.io.OutputStream;/** * This is the main interface class. All subversion commandline client svn & * svnversion operation are implemented in this class. This class is not * threadsafe. If you need threadsafe access, use SVNClientSynchronized */public class SVNClient implements SVNClientInterface{    /**     * Load the required native library.     */    static    {        NativeResources.loadNativeLibrary();    }    /**     * Standard empty contructor, builds just the native peer.     */    public SVNClient()    {        cppAddr = ctNative();        // Ensure that Subversion's config file area and templates exist.        try        {            setConfigDirectory(determineInitialConfigDir());        }        catch (ClientException suppressed)        {            // Not an exception-worthy problem, continue on.        }    }    /**     * Attempt to determine an initial configuration directory,     * <code>%APPDATA%\Subversion</code> on Windows and     * <code>~/.subversion</code> on other operating systems.     *     * @return The initial configuration directory, or     * <code>null</code> to use the library default.  Note that native     * library versions older than 1.4 may segfault if we return     * <code>null</code>.     */    protected String determineInitialConfigDir()    {        String path;        if (isOSWindows())        {            // On Windows, use the %APPDATA%\Subversion directory.            path = getEnv("APPDATA");            if (path == null)            {                path = getUserHomeDirectory();                if (path != null)                {                    path = new File(path, "Application Data").getPath();                }            }            if (path != null)            {                path = new File(path, "Subversion").getAbsolutePath();            }        }        else        {            // Everywhere else, use the ~/.subversion directory.            path = getUserHomeDirectory();            if (path != null)            {                path = new File(path, ".subversion").getAbsolutePath();            }        }        return path;    }    /**     * @return The absolute path to the current user's home directory,     * or <code>null</code> if it cannot be determined.     */    private static String getUserHomeDirectory()    {        // ### LATER: Wrap the svn_user_get_homedir() API and try it        // ### first.        String path = System.getProperty("user.home");        return (path != null ? path : getEnv("HOME"));    }    /**     * @param envVar The name of the environment variable to retrieve.     * @return The named environment variable, or <code>null</code> if     * it cannot be retrieved.     */    private static final String getEnv(String envVar)    {        try        {            return System.getenv(envVar);        }        catch (Throwable jreComplaint)        {            // As an example, Sun JRE 1.4.2_12-b03 throws            // java.lang.Error, with the message "getenv no longer            // supported, use properties and -D instead: HOME".            return null;        }    }    /**     * @return Whether the current operating system is Windows.     */    private static final boolean isOSWindows()    {        String opSys = System.getProperty("os.name");        return (opSys.toLowerCase().indexOf("windows") >= 0);    }    /**     * Build the native peer     * @return the adress of the peer     */    private native long ctNative();     /**     * release the native peer (should not depend on finalize)     */    public native void dispose();    /**     * release the native peer (should use dispose instead)     */    protected native void finalize();    /**     * slot for the adress of the native peer. The JNI code is the only user     * of this member     */    protected long cppAddr;    /**     * @return Version information about the underlying native libraries.     */    public Version getVersion()    {        return NativeResources.version;    }    /**     * @return The name of the working copy's administrative     * directory, which is usually <code>.svn</code>.     * @see <a     * href="http://svn.collab.net/repos/svn/trunk/notes/asp-dot-net-hack.txt">Instructions</a>     * on changing this as a work-around for the behavior of ASP.Net     * on Windows.     * @since 1.3     */    public native String getAdminDirectoryName();    /**     * @param name The name of the directory to compare.     * @return Whether <code>name</code> is that of a working copy     * administrative directory.     * @since 1.3     */    public native boolean isAdminDirectory(String name);    /**      * Returns the last destination path submitted.      * @deprecated      * @return path in Subversion format.      */     public native String getLastPath();    /**     * List a directory or file of the working copy.     *     * @param path      Path to explore.     * @param descend   Recurse into subdirectories if they exist.     * @param onServer  Request status information from server.     * @param getAll    get status for uninteristing files (unchanged).     * @return Array of Status entries.     */    public Status[] status(String path, boolean descend, boolean onServer,                           boolean getAll) throws ClientException    {        return status(path, descend, onServer, getAll, false);    }    /**     * List a directory or file of the working copy.     *     * @param path      Path to explore.     * @param descend   Recurse into subdirectories they exist.     * @param onServer  Request status information from server.     * @param getAll    get status for uninteristing files (unchanged).     * @param noIgnore  get status for normaly ignored files and directories.     * @return Array of Status entries.     */    public Status[] status(String path, boolean descend,                                  boolean onServer, boolean getAll,                                  boolean noIgnore) throws ClientException    {        return status(path, descend, onServer, getAll, noIgnore, false);    }    /**     * List a directory or file of the working copy.     *     * @param path            Path to explore.     * @param descend         Recurse into subdirectories if they exist.     * @param onServer        Request status information from server.     * @param getAll          get status for uninteristing files (unchanged).     * @param noIgnore        get status for normaly ignored files and     * *                      directories.     * @param ignoreExternals if externals are ignored during status     * @return Array of Status entries.     * @since 1.2     */    public native Status[] status(String path, boolean descend,                                  boolean onServer, boolean getAll,                                  boolean noIgnore, boolean ignoreExternals)            throws ClientException;    /**     * Lists the directory entries of an url on the server.     * @param url       the url to list     * @param revision  the revision to list     * @param recurse   recurse into subdirectories     * @return  Array of DirEntry objects.     */    public DirEntry[] list(String url, Revision revision, boolean recurse)            throws ClientException    {        return list(url, revision, revision, recurse);    }    /**     * Lists the directory entries of an url on the server.     *     * @param url         the url to list     * @param revision    the revision to list     * @param pegRevision the revision to interpret url     * @param recurse     recurse into subdirectories     * @return Array of DirEntry objects.     * @since 1.2     */    public native DirEntry[] list(String url, Revision revision,                                  Revision pegRevision, boolean recurse)            throws ClientException;    /**     * Returns the status of a single file in the path.     *     * @param path      File to gather status.     * @param onServer  Request status information from the server.     * @return  the subversion status of the file.     */    public native Status singleStatus(String path, boolean onServer)            throws ClientException;    /**     * Sets the user name used for authentification.     * @param username The user name.     */    public native void username(String username);    /**     * Sets the password used for authification.     * @param password  the password     */    public native void password(String password);    /**     * Register callback interface to supply user name and password on     * demand.  This callback can also be used to provide the     * equivalent of the <code>--no-auth-cache</code> and     * <code>--non-interactive</code> arguments accepted by the     * command-line client.     *     * @param prompt the callback interface     */    public native void setPrompt(PromptUserPassword prompt);    /**     * Retrieve the log messages for an item     * @param path          path or url to get the log message for.     * @param revisionStart first revision to show     * @param revisionEnd   last revision to show     * @return array of LogMessages     */    public LogMessage[] logMessages(String path, Revision revisionStart,                                    Revision revisionEnd) throws ClientException    {        return logMessages(path, revisionStart, revisionEnd, true, false);    }    /**     * Retrieve the log messages for an item     * @param path          path or url to get the log message for.     * @param revisionStart first revision to show     * @param revisionEnd   last revision to show     * @param stopOnCopy    do not continue on copy operations     * @return array of LogMessages     */    public LogMessage[] logMessages(String path, Revision revisionStart,                                     Revision revisionEnd, boolean stopOnCopy)            throws ClientException    {        return logMessages(path, revisionStart, revisionEnd, stopOnCopy, false);    }    /**     * Retrieve the log messages for an item     * @param path          path or url to get the log message for.     * @param revisionStart first revision to show     * @param revisionEnd   last revision to show     * @param stopOnCopy    do not continue on copy operations     * @param discoverPath     * @return array of LogMessages     */    public LogMessage[] logMessages(String path, Revision revisionStart,                                           Revision revisionEnd,                                           boolean stopOnCopy,                                           boolean discoverPath)            throws ClientException    {        return logMessages(path, revisionStart, revisionEnd, stopOnCopy,                discoverPath, 0);    }    /**     * Retrieve the log messages for an item     * @param path          path or url to get the log message for.     * @param revisionStart first revision to show     * @param revisionEnd   last revision to show     * @param stopOnCopy    do not continue on copy operations     * @param discoverPath  returns the paths of the changed items in the     *                      returned objects     * @param limit         limit the number of log messages (if 0 or less no     *                      limit)     * @return array of LogMessages     * @since 1.2     */    public native LogMessage[] logMessages(String path, Revision revisionStart,                                           Revision revisionEnd,                                           boolean stopOnCopy,                                           boolean discoverPath,                                           long limit) throws ClientException;    /**     * Executes a revision checkout.     * @param moduleName name of the module to checkout.     * @param destPath destination directory for checkout.     * @param revision the revision to checkout.     * @param pegRevision the peg revision to interpret the path     * @param recurse whether you want it to checkout files recursively.     * @param ignoreExternals if externals are ignored during checkout     * @exception ClientException     * @since 1.2     */    public native long checkout(String moduleName, String destPath,                                Revision revision, Revision pegRevision,                                boolean recurse, boolean ignoreExternals)            throws ClientException;    /**     * Executes a revision checkout.     * @param moduleName name of the module to checkout.     * @param destPath destination directory for checkout.     * @param revision the revision to checkout.     * @param recurse whether you want it to checkout files recursively.     * @exception ClientException     */    public long checkout(String moduleName, String destPath,                         Revision revision, boolean recurse)            throws ClientException    {        return checkout(moduleName, destPath, revision, revision, recurse,                false);    }    /**     * Sets the notification callback used to send processing information back     * to the calling program.     * @param notify listener that the SVN library should call on many     *               file operations.     * @deprecated use notification2 instead     */    public native void notification(Notify notify);    /**     * Sets the notification callback used to send processing information back     * to the calling program.     *     * @param notify listener that the SVN library should call on many     *               file operations.     * @since 1.2     */    public native void notification2(Notify2 notify);    /**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -