package com.perforce.cvs.process; import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.perforce.cvs.RevisionSorter; public class ChangeSorter { private static Logger logger = LoggerFactory.getLogger(ChangeSorter.class); private CvsChangeList changes; /** * Build CVS Changelists from RCS revisions * * @param revSort * @throws Exception */ public void build(RevisionSorter revSort) throws Exception { logger.info("Sorting revision into changes:"); changes = new CvsChangeList(revSort); logger.info("... found " + changes.size() + " changes\n"); } /** * Load CVS change lists from file * * @param filename * @throws Exception */ public void load(String filename) throws Exception { logger.info("Loading changes: " + filename); GsonBuilder gbuilder = new GsonBuilder(); gbuilder.setPrettyPrinting(); Gson gson = gbuilder.create(); FileReader fr = new FileReader(filename); BufferedReader br = new BufferedReader(fr); changes = gson.fromJson(br, CvsChangeList.class); br.close(); logger.info("... found " + changes.size() + " changes\n"); } /** * Save CVS change lists to file in JSON * * @param filename * @throws Exception */ public void store(String filename) throws Exception { logger.info("Saving changes to file: " + filename); GsonBuilder gbuilder = new GsonBuilder(); gbuilder.setPrettyPrinting(); Gson gson = gbuilder.create(); String json = gson.toJson(changes); FileWriter fw = new FileWriter(filename); fw.write(json); fw.close(); logger.info("... done\n"); } public List<CvsChange> getChanges() { return changes.getChanges(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 13920 | Paul Allen | copy part 2 (no errors) | ||
#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 |