package se.tla.mavenversionbumper.vcs;

import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteWatchdog;

import java.io.File;
import java.io.IOException;

/**
 * Common functionality for implementations of the VersionControl interface.
 */
public abstract class AbstractVersionControl implements VersionControl {

    public static final String VERSIONCONTROL = "versioncontrol";

    @Override
    public void prepareSave(File file) {
        // Default is to do nothing before saving.
    }

    /**
     * Execute this command line, optionally in this working directory.
     * @param cmdLine
     * @param workDir
     */
    protected void execute(CommandLine cmdLine, File workDir) {
        DefaultExecutor exec = new DefaultExecutor();
        exec.setWatchdog(new ExecuteWatchdog(60000));
        if (workDir != null) {
            exec.setWorkingDirectory(workDir);
        }

        try {
            exec.execute(cmdLine);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

@@ -33,16 +33,66 @@
 r.vcs;%0A%0A
+import java.io.File;%0Aimport java.io.IOException;%0A%0A
 import o
@@ -228,58 +228,8 @@
 g;%0A%0A
-import java.io.File;%0Aimport java.io.IOException;%0A%0A
 /**%0A
@@ -952,24 +952,97 @@
 %0A        %7D%0A%0A
+        System.out.println(%22Running command:   %22 + cmdLine.toString());%0A%0A
         try 

Print out what will actually be executed.