package com.perforce.cvs.process; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.perforce.common.node.Action; import com.perforce.cvs.RevisionEntry; import com.perforce.cvs.RevisionSorter; public class CvsChangeList { private static Logger logger = LoggerFactory.getLogger(CvsChangeList.class); transient private RevisionSorter delayedBranch = new RevisionSorter(true); private ArrayList<CvsChange> list = new ArrayList<CvsChange>(); public CvsChangeList(RevisionSorter revSort) throws Exception { // Initialise counters long sequence = 1; RevisionEntry changeEntry = revSort.next(); RevisionEntry entry; revSort.reset(); RevisionSorter revs = revSort; // Iterate over all revisions do { entry = changeEntry; if (logger.isTraceEnabled()) { logger.trace("... next change uses: " + entry); logger.trace("... from remainder: " + revs.isRemainder()); } // construct next change CvsChange cvsChange = new CvsChange(sequence); // add matching entries to current change while (entry != null && entry.within(changeEntry, revs.getWindow())) { if (entry.matches(changeEntry)) { buildCvsChange(entry, revs, cvsChange); } else { // else, revision belongs in another change if (logger.isTraceEnabled()) { logger.trace("... leaving: " + entry + "(outside)"); } } entry = revs.next(); } // update revision list revs = revSort; revSort.reset(); delayedBranch.reset(); if (delayedBranch.hasNext()) { revs = delayedBranch; if (revSort.hasNext()) { long rDate = revSort.next().getDate().getTime(); long dDate = delayedBranch.next().getDate().getTime(); if (rDate < dDate) { revs = revSort; } else { revs.setWindow(rDate - dDate); } } } revs.reset(); // fetch revision for next change changeEntry = revs.next(); revs.reset(); // add change and update counters if (!cvsChange.isEmpty()) { list.add(cvsChange); System.out.print("Creating change: " + sequence + "\r"); sequence++; } } while (changeEntry != null); } /** * Calculates next entry. * * @param entry * @param changeEntry * @throws Exception */ private void buildCvsChange(RevisionEntry entry, RevisionSorter revs, CvsChange change) throws Exception { if (entry.isPseudo() && !revs.isRemainder()) { if (logger.isTraceEnabled()) { logger.trace("... delaying: " + entry); } delayedBranch.add(entry); revs.drop(entry); } else { // if no pending revisions... if (!change.isPending(entry)) { // add entry to current change change.addEntry(entry); revs.drop(entry); } else { // if pending revision is a REMOVE and current is a PSEUDO // branch if (entry.isPseudo() && entry.getState() == Action.REMOVE) { // overlay REMOVE with branch and down-grade to ADD entry.setState(Action.ADD); change.addEntry(entry); revs.drop(entry); } else { // else, revision belongs in another change if (logger.isTraceEnabled()) { logger.trace("... leaving: " + entry + "(opened)"); } } } } } public int size() { return list.size(); } public List<CvsChange> getChanges() { return list; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 13876 | Paul Allen | Rename/move file(s) | ||
//guest/paul_allen/p4convert-maven/src/com/perforce/cvs/process/CvsChangeList.java | |||||
#1 | 13873 | Paul Allen | Branching using p4convert-maven | ||
//guest/perforce_software/p4convert/src/com/perforce/cvs/process/CvsChangeList.java | |||||
#4 | 13776 | Paul Allen |
CVS: Update to node Action detection. The RCS State is normally set to 'Exp' and 'dead', but this change allows more user defined states. - Move Action class to common.node package. - Modified test case061 to test custom states. |
||
#3 | 12890 | Paul Allen |
Extended start/stop change limits to CVS. - Moved start and stop configuration options out of SVN name space to the generic P4 space. - Abstracted shared range logic to ProcessChange #review-12880 |
||
#2 | 12492 | Paul Allen |
CVS: Do not add empty CVS changes to the process list. Fix for: Caught exception on exit java.lang.NullPointerException at com.perforce.common.process.ChangeInfo.<init>(ChangeInfo.java:37) at com.perforce.cvs.process.CvsProcessChange.processChange(CvsProcessChange.java:94) at com.perforce.common.process.ProcessChange.runSingle(ProcessChange.java:90) at com.perforce.common.process.ProcessChange.call(ProcessChange.java:53) at com.perforce.common.process.ProcessChange.call(ProcessChange.java:20) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caught EXIT shutting down ... |
||
#1 | 12405 | Paul Allen |
CVS: Save change list data to a JSON formatted file 'changes.json'. (Work-In-Progress) - need to add load option and resume flags |