|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.vcs.profiles.cvsprofiles.commands; import java.util.*; import java.io.*; import org.netbeans.modules.vcscore.VcsFileSystem; import org.netbeans.modules.vcscore.Variables; import org.netbeans.modules.vcscore.commands.*; import org.netbeans.modules.vcscore.cmdline.*; import org.netbeans.modules.vcscore.cmdline.exec.*; import org.netbeans.modules.vcscore.util.*; /** * * @author Martin Entlicher */ public class CvsLogInfo extends Object implements CommandDataOutputListener { private StringBuffer logBuffer = new StringBuffer(4096); private Vector revisions = new Vector(); private Vector revisionsFile = new Vector(); private Vector branches = new Vector(); private Vector branchesFile = new Vector(); private Vector orderRevBranch = new Vector(); private Vector orderRevBranchFile = new Vector(); private static final int ORDER_REVISION = 0; private static final int ORDER_BRANCH = 1; /** * Contains revision number as the key and the tag name as the value. */ private Hashtable symbolicNames = new Hashtable(); private Hashtable symbolicNamesFile = new Hashtable(); private boolean matchingSymbolicNames = false; private boolean mergeIsEmpty = true; private CvsRevisionGraph revisionGraph = null; private String revisionStr = new String("revision"); // NOI18N private String branchesStr = new String("branches"); // NOI18N private String symbNamesStr = new String("symbolic names"); // NOI18N private String nextFileStr = new String("=================="); // NOI18N private VcsFileSystem fileSystem = null; /** Creates new CvsLogInfo */ public CvsLogInfo() { } public void setFileSystem(VcsFileSystem fileSystem) { this.fileSystem = fileSystem; } public Vector getRevisions() { return revisions; } public Vector getBranches() { return branches; } public Hashtable getSymbolicNames() { return symbolicNames; } public Vector getRevisionsWithSymbolicNames() { String revision; Vector revisions = getRevisions(); Vector revSN = new Vector(revisions); Hashtable sn = getSymbolicNames(); Enumeration enum = sn.keys(); while(enum.hasMoreElements()) { revision = (String) enum.nextElement(); String symbName = (String) sn.get(revision); int revIndex = revSN.indexOf(revision); if (symbName != null) revision += " "+symbName; // NOI18N if (revIndex >= 0) { revSN.setElementAt(revision, revIndex); } else { revSN.addElement(revision); } } return revSN; } public Vector getBranchesWithSymbolicNames() { String revision; Vector branches = getBranches(); Vector brSN = new Vector(branches); Hashtable sn = getSymbolicNames(); Enumeration enum = sn.keys(); while(enum.hasMoreElements()) { revision = (String) enum.nextElement(); String symbName = (String) sn.get(revision); int brIndex = brSN.indexOf(revision); if (brIndex >= 0) { if (symbName != null) revision += " "+symbName; // NOI18N brSN.setElementAt(revision, brIndex); } else { int lastDot = revision.lastIndexOf('.'); if (lastDot > 1 && revision.charAt(lastDot - 1) == '0' && revision.charAt(lastDot - 2) == '.') { String branch = revision.substring(0, lastDot-1) + revision.substring(lastDot+1); brIndex = brSN.indexOf(branch); if (symbName != null) branch += " "+symbName; // NOI18N if (brIndex >= 0) { brSN.setElementAt(branch, brIndex); } else { brSN.addElement(branch); } } } } return brSN; } public CvsRevisionGraph getRevisionGraph() { return revisionGraph; } public boolean updateLogInfo(Hashtable vars, String cmdName, CommandOutputListener stdoutListener, CommandOutputListener stderrListener) { revisionGraph = new CvsRevisionGraph(); mergeIsEmpty = true; VcsCommand cmd = fileSystem.getCommand(cmdName); VcsCommandExecutor vce = fileSystem.getVcsFactory().getCommandExecutor(cmd, new Hashtable(vars)); vce.addDataOutputListener(this); fileSystem.getCommandsPool().startExecutor(vce, fileSystem); try { fileSystem.getCommandsPool().waitToFinish(vce); } catch (InterruptedException iexc) { return false; } if (vce.getExitStatus() != VcsCommandExecutor.SUCCEEDED) { return false; } for(int i = 0; i < orderRevBranch.size(); i++) { Integer what = (Integer) orderRevBranch.get(i); i++; if (what.intValue() == ORDER_REVISION) { Integer revision = (Integer) orderRevBranch.get(i); revisionGraph.insertRevision((String) revisions.get(revision.intValue())); } else { Integer branch = (Integer) orderRevBranch.get(i); revisionGraph.insertBranch((String) branches.get(branch.intValue())); } } //for(int i = 0; i < branches.size(); i++) revisionGraph.insertBranch((String) branches.get(i)); //for(int i = 0; i < revisions.size(); i++) revisionGraph.insertRevision((String) revisions.get(i)); return true; } /** * Merge the common content of Hashtables |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.