Package org.tmatesoft.svn.core.wc.xml

Examples of org.tmatesoft.svn.core.wc.xml.SVNXMLSerializer


        if (getCommandLine().hasArgument(SVNArgument.REVISION)) {
            revision = SVNRevision.parse((String) getCommandLine().getArgumentValue(SVNArgument.REVISION));
        }
        SVNWCClient wcClient = getClientManager().getWCClient();
        myOut = out;
        SVNXMLSerializer serializer = new SVNXMLSerializer(myOut);
        SVNXMLInfoHandler handler = new SVNXMLInfoHandler(serializer);
        if (getCommandLine().hasArgument(SVNArgument.XML) && !getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
            handler.startDocument();
        }
        ISVNInfoHandler infoHandler = getCommandLine().hasArgument(SVNArgument.XML) ? handler : (ISVNInfoHandler) this;
        for (int i = 0; i < getCommandLine().getPathCount(); i++) {
            myBaseFile = new File(getCommandLine().getPathAt(i));
            SVNRevision peg = getCommandLine().getPathPegRevision(i);
            handler.setTargetPath(myBaseFile);
            wcClient.doInfo(myBaseFile, peg, revision, recursive, infoHandler);
        }
        myBaseFile = null;
        for (int i = 0; i < getCommandLine().getURLCount(); i++) {
            String url = getCommandLine().getURL(i);
            SVNRevision peg = getCommandLine().getPegRevision(i);
            wcClient.doInfo(SVNURL.parseURIEncoded(url), peg, revision, recursive, infoHandler);
        }
        if (getCommandLine().hasArgument(SVNArgument.XML)&& !getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
            handler.endDocument();
        }
        if (getCommandLine().hasArgument(SVNArgument.XML)) {
            try {
                serializer.flush();
            } catch (IOException e) {
            }
        }
    }
View Full Code Here


                return;
            }
        }
        SVNLogClient logClient = getClientManager().getLogClient();
        ISVNLogEntryHandler handler = this;
        SVNXMLSerializer serializer = null;
        if (getCommandLine().hasArgument(SVNArgument.XML)) {
            serializer = new SVNXMLSerializer(out);
            handler = new SVNXMLLogHandler(serializer);
            if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
                ((AbstractXMLHandler) handler).startDocument();
            }               
        }
        if (getCommandLine().hasURLs()) {
            String url = getCommandLine().getURL(0);
            SVNRevision pegRevision = getCommandLine().getPegRevision(0);
            Collection targets = new ArrayList();
            for(int i = 0; i < getCommandLine().getPathCount(); i++) {
                targets.add(getCommandLine().getPathAt(i));
            }
            String[] paths = (String[]) targets.toArray(new String[targets.size()]);
            logClient.doLog(SVNURL.parseURIEncoded(url), paths, pegRevision, startRevision ,endRevision, stopOnCopy, myReportPaths, limit, handler);
        } else if (getCommandLine().hasPaths()) {
            Collection targets = new ArrayList();
            SVNRevision[] pegRevisions = new SVNRevision[getCommandLine().getPathCount()];
            for(int i = 0; i < getCommandLine().getPathCount(); i++) {
                targets.add(new File(getCommandLine().getPathAt(i)).getAbsoluteFile());
                pegRevisions[i] = getCommandLine().getPathPegRevision(i);
            }
            File[] paths = (File[]) targets.toArray(new File[targets.size()]);
            logClient.doLog(paths, pegRevisions[0], startRevision ,endRevision, stopOnCopy, myReportPaths, limit, handler);
        }
        if (getCommandLine().hasArgument(SVNArgument.XML)) {
            if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
                ((AbstractXMLHandler) handler).endDocument();
            }
            try {
                serializer.flush();
            } catch (IOException e) {
            }
        } else if (myHasLogEntries) {
            myPrintStream.print(SEPARATOR);
            myPrintStream.flush();
View Full Code Here

        SVNRevision[] revRange = getStartEndRevisions();
        SVNRevision startRevision = revRange[0];
        SVNRevision endRevision = revRange[1];
        boolean force = getCommandLine().hasArgument(SVNArgument.FORCE);
        ISVNAnnotateHandler handler = this;
        SVNXMLSerializer serializer = null;
        if (getCommandLine().hasArgument(SVNArgument.XML)) {
            serializer = new SVNXMLSerializer(System.out);
            handler = new SVNXMLAnnotateHandler(serializer);
            if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
                ((AbstractXMLHandler) handler).startDocument();
            }
        }
       
        for(int i = 0; i < getCommandLine().getURLCount(); i++) {
            String url = getCommandLine().getURL(i);
            SVNRevision pegRevision = getCommandLine().getPegRevision(i);
            if (serializer != null) {
                ((SVNXMLAnnotateHandler) handler).startTarget(url);
            }
            SVNRevision endRev = endRevision;
            if ((endRevision == null || !endRevision.isValid()) && (pegRevision == null || !pegRevision.isValid())) {
                endRev = SVNRevision.HEAD;
            }
            try {
                logClient.doAnnotate(SVNURL.parseURIEncoded(url), pegRevision, startRevision, endRev, force, handler, null);
            } catch (SVNException e) {
                if (e.getMessage() != null && e.getMessage().indexOf("binary") >= 0) {
                    out.println("Skipping binary file: '" + url + "'");
                } else {
                    throw e;
                }
            }
            if (serializer != null) {
                ((SVNXMLAnnotateHandler) handler).endTarget();
            }
        }
        endRevision = parseRevision(getCommandLine());
        for(int i = 0; i < getCommandLine().getPathCount(); i++) {
            File path = new File(getCommandLine().getPathAt(i)).getAbsoluteFile();
            SVNRevision pegRevision = getCommandLine().getPathPegRevision(i);
            if (serializer != null) {
                ((SVNXMLAnnotateHandler) handler).startTarget(getCommandLine().getPathAt(i));
            }
            SVNRevision endRev = endRevision;
            if ((endRevision == null || !endRevision.isValid()) && (pegRevision == null || !pegRevision.isValid())) {
                endRev = SVNRevision.BASE;
            }
            try {
                logClient.doAnnotate(path, pegRevision, startRevision, endRev, force, handler);
            } catch (SVNException e) {
                if (e.getMessage() != null && e.getMessage().indexOf("binary") >= 0) {
                    err.println("Skipping binary file: '" + SVNFormatUtil.formatPath(path) + "'");
                } else {
                    throw e;
                }
            }
            if (serializer != null) {
                ((SVNXMLAnnotateHandler) handler).endTarget();
            }
        }
        if (getCommandLine().hasArgument(SVNArgument.XML)) {
            if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
                ((AbstractXMLHandler) handler).endDocument();
            }
            try {
                serializer.flush();
            } catch (IOException e) {
            }
        }
    }
View Full Code Here

        boolean recursive = getCommandLine().hasArgument(SVNArgument.RECURSIVE);
        myIsVerbose = getCommandLine().hasArgument(SVNArgument.VERBOSE);
        myPrintStream = out;
       
        boolean isXml = getCommandLine().hasArgument(SVNArgument.XML);
        SVNXMLSerializer serializer = isXml ? new SVNXMLSerializer(myPrintStream) : null;
        SVNXMLDirEntryHandler handler = isXml ? new SVNXMLDirEntryHandler(serializer) : null;

        SVNRevision revision = parseRevision(getCommandLine());
        SVNLogClient logClient = getClientManager().getLogClient();
        if (!getCommandLine().hasURLs() && !getCommandLine().hasPaths()) {
            getCommandLine().setPathAt(0, "");
        }
        if (handler != null) {
            if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
                handler.startDocument();
            }
        }
        for(int i = 0; i < getCommandLine().getURLCount(); i++) {
            String url = getCommandLine().getURL(i);
            if (handler != null) {
                handler.startTarget(url);
            }
            logClient.doList(SVNURL.parseURIEncoded(url), getCommandLine().getPegRevision(i), revision == null ? SVNRevision.UNDEFINED : revision, myIsVerbose || isXml, recursive, isXml ? handler : (ISVNDirEntryHandler) this);
            if (handler != null) {
                handler.endTarget();
            }
        }
        for(int i = 0; i < getCommandLine().getPathCount(); i++) {
            File path = new File(getCommandLine().getPathAt(i)).getAbsoluteFile();
            if (handler != null) {
                handler.startTarget(path.getAbsolutePath().replace(File.separatorChar, '/'));
            }
            logClient.doList(path, getCommandLine().getPathPegRevision(i), revision == null || !revision.isValid() ? SVNRevision.BASE : revision, myIsVerbose || isXml, recursive, isXml ? handler : (ISVNDirEntryHandler) this);
            if (handler != null) {
                handler.endTarget();
            }
        }
        if (handler != null) {
            if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
                handler.endDocument();
            }
            try {
                serializer.flush();
            } catch (IOException e) {
            }
        }
    }
View Full Code Here

        if (!getCommandLine().hasArgument(SVNArgument.XML)) {
            getClientManager().setEventHandler(new SVNCommandEventProcessor(out, err, false));
        }
        SVNStatusClient stClient = getClientManager().getStatusClient();
        ISVNStatusHandler handler = new SVNCommandStatusHandler(out, reportAll || showUpdates, reportAll, quiet, showUpdates);
        SVNXMLSerializer serializer;
        serializer = getCommandLine().hasArgument(SVNArgument.XML) ? new SVNXMLSerializer(System.out) : null;
        if (serializer != null) {
            handler = new SVNXMLStatusHandler(serializer);
            if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
                ((SVNXMLStatusHandler) handler).startDocument();
            }
        }
        boolean error = false;
        for (int i = 0; i < paths.length; i++) {
              String path = paths[i];
              if (path == null) {
                  continue;
              }
              File file = new File(path).getAbsoluteFile();
              if (serializer != null) {
                  ((SVNXMLStatusHandler) handler).startTarget(new File(getCommandLine().getPathAt(i)));
              }
              long rev = -1;
              try {
                rev = stClient.doStatus(file, recursive, showUpdates, reportAll, ignored, handler);
              } catch (SVNException e) {
                  stClient.getDebugLog().info(e);
                  err.println(e.getMessage());
                  error = true;
              }
              if (serializer != null) {
                  ((SVNXMLStatusHandler) handler).endTarget(rev);
              }
        }
        if (serializer != null) {
            if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
                ((SVNXMLStatusHandler) handler).endDocument();
            }
            try {
                serializer.flush();
            } catch (IOException e) {
            }
        }
        if (error) {
            System.exit(1);
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.wc.xml.SVNXMLSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.