         return ok
     }
 
+    func prepareGitRepro(folder:String, tag:String?) -> Void {
+        let currentBranch = Shell.gitCurrentBranch(folder)
+        if (tag != nil) {
+            if (tag!.containsString(assetTagIgnore)) {
+                return
+            }
+            else if (tag!.lowercaseString.containsString(assetTagHead)) {
+                if (Shell.gitResetHead(folder, branch: currentBranch) == false) {
+                    print("Error: Can't reset asset repo to HEAD")
+                    exit(-1)
+                }
+            }
+            else {
+                if (Shell.gitCheckoutAtTag(folder, tag: tag!) == false) {
+                    print("Error: Can't set asset repo to \(tag) tag")
+                    exit(-1)
+                }
+            }
+        }
+    }
+    
     private let baseAssetTemplate = [keySchemaVersion :SchemaVersion,
                                     keyFonts: [],
                                     keyLocale: ["enUS":""],

        }

        if (result != nil) {
            var currentBranch:String? = nil
            if (gitEnabled) && (sourceAssetFolder != nil) {
                currentBranch = Shell.gitCurrentBranch(sourceAssetFolder!)
                if (assetTag != nil) {
                    if (Shell.gitCheckoutAtTag(sourceAssetFolder!, tag: assetTag!) == false) {
                        print("Error: Can't set asset repo to \(assetTag) tag")
                        exit(-1)
                    }
                }
                else {
                    if (Shell.gitResetHead(sourceAssetFolder!, branch: currentBranch!) == false) {
                        print("Error: Can't reset asset repo to HEAD")
                        exit(-1)
                    }
                }
            }

            // process
            consume(result!, type: compileType, langOutputFile: outputClassFile!)

            if (gitEnabled) && (assetTag != nil) && (sourceAssetFolder != nil) {
                if (currentBranch != nil) {
                    Shell.gitSetBranch(sourceAssetFolder!, branch: currentBranch!)
                }
            }
        }
        else {
            print("Error: missing input file")

    case Image
    case Raw
}

private let assetTagIgnore = "~"
private let assetTagHead = "head"

class App
{
