Przeglądaj źródła

Arreglo para obtener branchs

gabriel 6 lat temu
rodzic
commit
5ee9bc4154
1 zmienionych plików z 11 dodań i 3 usunięć
  1. 11 3
      tools/src/GetSource.php

+ 11 - 3
tools/src/GetSource.php

@@ -66,14 +66,22 @@ class GetSource extends Command
             } catch (GitException $e) {
                 $output->writeln("<error>" . $e->getMessage() . "</error>");
             }
+
+            $branches = $git->branch(array("all" => false, "remotes" => true));
+
             $branch_from_options = $input->getOption("branch");
             if (!empty($branch_from_options)) {
                 $git->checkout($branch_from_options);
                 $conf["branch"] = $branch_from_options;
-            } else {
-                $git->checkout($conf["branch"]);
+            } else if (strtolower($conf["branch"]) != "master"){
+                try {
+                    $git->checkout->create($conf["branch"]);
+                } catch (GitException $e) {
+                    $output->writeln($e->getTraceAsString());
+                    die;
+                }
+                $git->merge("origin/" . $conf["branch"]);
             }
-            $branches = $git->branch(array("all" => false, "remotes" => true));
 
             if (isset($branches["remotes/" . $input->getOption("remote-name") . "/" . $conf["branch"]])) {
                 $git->merge($input->getOption("remote-name") . "/" . $conf["branch"]);