package com.perforce.workshop.tjuricek.p4java_ext; import com.perforce.p4java.exception.P4JavaException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; /** * Exposure to the "p4 changes" command */ public interface P4Changes extends P4Connection, P4Errors { static P4Changes create(P4Connection conn) { return new DefaultP4Changes(conn); } /** * List the changelist numbers meeting the filter criteria * * @param client Perforce client workspace name, optional * @param status Changelist status, e.g., 'pending', 'shelved', * 'submitted', optional * @param user Perforce login, optional * @return List of changelist IDs */ default List<String> list(String client, String status, String user) { try { List<String> opts = new ArrayList<String>(); if (client != null) { Collections.addAll(opts, "-c", client); } if (status != null) { Collections.addAll(opts, "-s", status); } if (user != null) { Collections.addAll(opts, "-u", user); } Map<String, Object> res[] = getOptionsServer().execMapCmd("changes", opts.toArray(new String[0]), null); checkError(res); List<String> changes = new ArrayList<String>(); for (Map<String, Object> row : res) { String change = (String) row.get("change"); try { int num = Integer.parseInt(change, 10); } catch (Exception ex) { change = null; } if (change != null) { changes.add((String) row.get("change")); } } return changes; } catch (P4JavaException e) { throw new P4Exception(e); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 9086 | tjuricek |
0.1.0 Initial release of p4java_ext Mostly just contains enough of the P4 API to build the test data initializer. About 4 commands have minimal testing, so it works. Kind of. |
||
//guest/tjuricek/p4java_ext/src/main/java/com/perforce/p4java_ext/P4Changes.java | |||||
#1 | 9085 | tjuricek | First import of the project, before package refactoring. |