Mercurial > hg > icedrobot > ika
view src/main/java/org/icedrobot/ika/runtime/scm/GITPatchQueue.java @ 21:096237a7473d
Fix typo.
author | Mario Torre <neugens.limasoftware@gmail.com> |
---|---|
date | Wed, 06 Apr 2011 20:47:35 +0200 |
parents | 9c7b23248996 |
children | ccf79014e2ca |
line wrap: on
line source
/* * IKA - IcedRobot Kiosk Application * Copyright (C) 2011 IcedRobot team * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.icedrobot.ika.runtime.scm; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.icedrobot.ika.runtime.IkaRuntime; public class GITPatchQueue { public static void newPatch(String name, boolean force) { String forceCmd = ""; if (force) { forceCmd = "-f"; } IkaRuntime.exec(new File("."), "guilt", "new", forceCmd, name); } public static void refresh(boolean force) { String forceCmd = ""; if (force) { forceCmd = "-f"; } IkaRuntime.exec(new File("."), "guilt", forceCmd, "refresh"); } public static void status() { IkaRuntime.exec(new File("."), "guilt", "status"); } public static void applied() { IkaRuntime.exec(new File("."), "guilt", "applied"); } public static void add(List<String> args, boolean force) { List<String> argList = new ArrayList<String>(); argList.add("guilt"); if (force) { argList.add("-f"); } argList.add("add"); argList.addAll(args); exec(argList); } public static void push(boolean force, boolean all) { push(null, force, all); } public static void push(String patchName, boolean force, boolean all) { exec("push", patchName, force, all); } public static void pop(boolean force, boolean all) { push(null, force, all); } public static void pop(String patchName, boolean force, boolean all) { exec("pop", patchName, force, all); } private static void exec(String command, String patchName, boolean force, boolean all) { List<String> argList = new ArrayList<String>(); argList.add("guilt"); argList.add(command); if (force) { argList.add("-f"); } if (all) { argList.add("--all"); } if (patchName != null) { argList.add(patchName); } exec(argList); } private static void exec(List<String> args) { String[] argsAsArray = args.toArray(new String[args.size()]); IkaRuntime.exec(new File("."), argsAsArray); } }