@Override public void merge( @NotNull SvnTarget source1, @NotNull SvnTarget source2, @NotNull File destination, @Nullable Depth depth, boolean useAncestry, boolean dryRun, boolean recordOnly, boolean force, @Nullable DiffOptions diffOptions, @Nullable ProgressTracker handler) throws VcsException { assertUrl(source1); assertUrl(source2); List<String> parameters = new ArrayList<String>(); CommandUtil.put(parameters, source1); CommandUtil.put(parameters, source2); fillParameters(parameters, destination, depth, dryRun, recordOnly, force, false, diffOptions); CommandUtil.put(parameters, !useAncestry, "--ignore-ancestry"); run(destination, handler, parameters); }
// $ANTLR start actionStmt // ECL.g:21:1: actionStmt : actionName idSet ; public final void actionStmt() throws RecognitionException { actionName_return actionName1 = null; java.util.Set<Long> idSet2 = null; try { // ECL.g:21:12: ( actionName idSet ) // ECL.g:21:14: actionName idSet { pushFollow(FOLLOW_actionName_in_actionStmt71); actionName1 = actionName(); _fsp--; pushFollow(FOLLOW_idSet_in_actionStmt73); idSet2 = idSet(); _fsp--; CommandUtil.performAction(input.toString(actionName1.start, actionName1.stop), idSet2); } } catch (RecognitionException re) { reportError(re); recover(input, re); } finally { } return; }
private void run(File destination, ProgressTracker handler, List<String> parameters) throws VcsException { BaseUpdateCommandListener listener = new BaseUpdateCommandListener(CommandUtil.correctUpToExistingParent(destination), handler); execute(myVcs, SvnTarget.fromFile(destination), SvnCommandName.merge, parameters, listener); listener.throwWrappedIfException(); }
@Override public void merge( @NotNull SvnTarget source, @NotNull File destination, boolean dryRun, @Nullable DiffOptions diffOptions, @Nullable final ProgressTracker handler) throws VcsException { assertUrl(source); List<String> parameters = new ArrayList<String>(); CommandUtil.put(parameters, source); fillParameters(parameters, destination, null, dryRun, false, false, true, diffOptions); run(destination, handler, parameters); }
@Override public boolean run() { CheckingAccount account = CommandUtil.askCheckingAccount(); Scanner in = new Scanner(System.in); System.out.println("Amount:"); double amount = in.nextDouble(); Overdraft newOverdraft = new Overdraft(); newOverdraft.setAccount(account); newOverdraft.setAmount(amount); newOverdraft.save(); account.addBalance(-1 * amount); account.save(); return true; }
// $ANTLR start installStmt // ECL.g:28:1: installStmt : 'install ' jarSet ; public final void installStmt() throws RecognitionException { java.util.Set<String> jarSet3 = null; try { // ECL.g:28:13: ( 'install ' jarSet ) // ECL.g:28:15: 'install ' jarSet { match(input, 13, FOLLOW_13_in_installStmt107); pushFollow(FOLLOW_jarSet_in_installStmt109); jarSet3 = jarSet(); _fsp--; CommandUtil.install(jarSet3); } } catch (RecognitionException re) { reportError(re); recover(input, re); } finally { } return; }
@Override public void merge( @NotNull SvnTarget source, @NotNull SVNRevisionRange range, @NotNull File destination, @Nullable Depth depth, boolean dryRun, boolean recordOnly, boolean force, @Nullable DiffOptions diffOptions, @Nullable ProgressTracker handler) throws VcsException { assertUrl(source); List<String> parameters = new ArrayList<String>(); parameters.add("--revision"); parameters.add(range.getStartRevision() + ":" + range.getEndRevision()); CommandUtil.put(parameters, source); fillParameters(parameters, destination, depth, dryRun, recordOnly, force, false, diffOptions); run(destination, handler, parameters); }
private static void fillParameters( @NotNull List<String> parameters, @NotNull File destination, @Nullable Depth depth, boolean dryRun, boolean recordOnly, boolean force, boolean reintegrate, @Nullable DiffOptions diffOptions) { CommandUtil.put(parameters, destination); CommandUtil.put(parameters, diffOptions); CommandUtil.put(parameters, dryRun, "--dry-run"); CommandUtil.put(parameters, depth); CommandUtil.put(parameters, force, "--force"); CommandUtil.put(parameters, recordOnly, "--record-only"); parameters.add("--accept"); parameters.add("postpone"); // deprecated for 1.8, but should be specified for previous clients CommandUtil.put(parameters, reintegrate, "--reintegrate"); }
public long commit( File[] paths, String message, @Nullable SVNDepth depth, boolean noUnlock, boolean keepChangelist, Collection<String> changelists, Map revpropTable) throws VcsException { if (paths.length == 0) return INVALID_REVISION_NUMBER; final List<String> parameters = new ArrayList<String>(); CommandUtil.put(parameters, depth); CommandUtil.put(parameters, noUnlock, "--no-unlock"); CommandUtil.put(parameters, keepChangelist, "--keep-changelists"); CommandUtil.putChangeLists(parameters, changelists); if (revpropTable != null && !revpropTable.isEmpty()) { final Set<Map.Entry<Object, Object>> set = revpropTable.entrySet(); for (Map.Entry<Object, Object> entry : set) { parameters.add("--with-revprop"); parameters.add(entry.getKey() + "=" + entry.getValue()); } } parameters.add("-m"); parameters.add(message); // TODO: seems that sort is not necessary here Arrays.sort(paths); CommandUtil.put(parameters, paths); myCommandListener.setBaseDirectory(CommandUtil.correctUpToExistingParent(paths[0])); CommandUtil.execute( myVcs, SvnTarget.fromFile(paths[0]), SvnCommandName.ci, parameters, myCommandListener); myCommandListener.throwExceptionIfOccurred(); return validateRevisionNumber(); }
@NotNull private File toFile(@NotNull String path) { return CommandUtil.resolvePath(myBase, path); }
@Override public void execute() throws StagingCommandException { if (help) { CommandUtil.printUsage(CommandUtil.MIGRATE, this.getClass()); return; } EntityManagerFactory stagingEmf = StagingPersistenceManager.getInstance().getEntityManagerFactory(); EntityManager stagingEm = stagingEmf.createEntityManager(); try { LastRun lastRun = stagingEm.find(LastRun.class, LAST_RUN_TYPE); Date lastRunDate = new Date(); if (lastRun != null) { LOGGER.info("Found last run"); lastRunDate = lastRun.getRunDate(); } else { LOGGER.info("Didn't find last run"); Calendar cal = Calendar.getInstance(); cal.set(1970, 1, 1, 0, 0); lastRunDate = cal.getTime(); } String collections = StagingProperties.getProperty("modified.since.collections", "staging"); String[] splitColls = collections.split(","); List<Integer> owningCollections = new ArrayList<Integer>(); for (String coll : splitColls) { try { owningCollections.add(Integer.valueOf(coll)); } catch (Exception e) { LOGGER.info("Unable to parse value: {}", coll); } } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); String lastRunDateStr = sdf.format(lastRunDate); LOGGER.info("Last run date: {}", lastRunDateStr); List<Item> lastItems = getLastModifiedSinceItems(lastRunDateStr, owningCollections); if (lastRun == null) { lastRun = new LastRun(); lastRun.setRunType(LAST_RUN_TYPE); } Date newRunDate = new Date(); lastRun.setRunDate(newRunDate); stagingEm.getTransaction().begin(); stagingEm.persist(lastRun); stagingEm.getTransaction().commit(); if (lastItems == null || lastItems.size() == 0) { sendNoNewItems(lastRunDate, newRunDate); LOGGER.info("No new items to email to RSD"); return; } String[][] itemsMatrix = processItems(lastItems); sendNewItems(itemsMatrix, lastRunDate, newRunDate); } finally { stagingEm.close(); DSpacePersistenceManager.getInstance().closeEntityManagerFactory(); StagingPersistenceManager.getInstance().closeEntityManagerFactory(); } }