changeset 5:24bc15b8e27b

Add new method create.
author Mario Torre <neugens.limasoftware@gmail.com>
date Wed, 09 Mar 2011 00:39:33 +0100
parents 82de5424529c
children 2bd34951aadf
files src/org/icedrobot/ika/plugins/scm/GITRepository.java src/org/icedrobot/ika/plugins/scm/HGRepository.java src/org/icedrobot/ika/plugins/scm/Repository.java
diffstat 3 files changed, 39 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/icedrobot/ika/plugins/scm/GITRepository.java	Tue Mar 08 00:20:49 2011 +0100
+++ b/src/org/icedrobot/ika/plugins/scm/GITRepository.java	Wed Mar 09 00:39:33 2011 +0100
@@ -64,6 +64,36 @@
         exec(command, getFullPath());
     }
 
+
+    /**
+     *
+     */
+    @Override
+    public void create() {
+
+        String command = "git init .";
+        System.err.println(command);
+        exec(command, getFullPath());
+
+        command = "git add --all";
+        System.err.println(command);
+        exec(command, getFullPath());
+
+        command = "git commit -m initial_repository --verbose";
+        System.err.println(command);
+        exec(command, getFullPath());
+
+        command = "git branch " + branch;
+        System.err.println(command);
+        exec(command, getFullPath());
+
+        command = "git checkout " + branch;
+        System.err.println(command);
+        exec(command, getFullPath());
+
+        System.err.println(">>>>>>>> done: " + this + " <<<<<<<<");
+    }
+
     /**
      *
      */
@@ -78,29 +108,7 @@
             new GITRepository(name, new File(getFullPath() + File.separator +
                                              getName()),
                               relativePath, null, branch);
-
-        String command = "git init .";
-        System.err.println(command);
-        exec(command, subRepository.getFullPath());
-
-        command = "git add --all";
-        System.err.println(command);
-        exec(command, subRepository.getFullPath());
-
-        command = "git commit -m initial_repository --verbose";
-        System.err.println(command);
-        exec(command, subRepository.getFullPath());
-
-        command = "git branch " + branch;
-        System.err.println(command);
-        exec(command, subRepository.getFullPath());
-
-        command = "git checkout " + branch;
-        System.err.println(command);
-        exec(command, subRepository.getFullPath());
-
-        System.err.println(">>>>>>>> done: " + subRepository + " <<<<<<<<");
-
+        subRepository.create();
         return subRepository;
     }
 
--- a/src/org/icedrobot/ika/plugins/scm/HGRepository.java	Tue Mar 08 00:20:49 2011 +0100
+++ b/src/org/icedrobot/ika/plugins/scm/HGRepository.java	Wed Mar 09 00:39:33 2011 +0100
@@ -75,4 +75,9 @@
     public void applyPatchQueue() {
         throw new UnsupportedOperationException("Not supported yet.");
     }
+
+    @Override
+    public void create() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
 }
--- a/src/org/icedrobot/ika/plugins/scm/Repository.java	Tue Mar 08 00:20:49 2011 +0100
+++ b/src/org/icedrobot/ika/plugins/scm/Repository.java	Wed Mar 09 00:39:33 2011 +0100
@@ -42,6 +42,7 @@
     protected String remotePath;
     protected String branch;
 
+    public abstract void create();
     public abstract void applyPatchQueue();
     public abstract void makeClone();
     public abstract Repository makeSubRepository(String name,
@@ -71,7 +72,8 @@
     }
 
     /**
-     *
+     * Create the directory under which this repository will be located if it
+     * doesn't exist.
      */
     public void createRoot() {
         getFullPath().mkdir();