Lines Matching +full:delete +full:- +full:branch
70 $reference = "--reference $reference";
72 $repo->cloneRemote($source, $reference);
74 $repo->cloneFrom($source);
77 $repo->run('init');
100 $this->plugin = $plugin;
102 $this->setRepoPath($repo_path, $create_new, $_init);
125 $this->repo_path = $repo_path;
126 $this->bare = false;
131 $this->repo_path = $repo_path;
132 $this->bare = true;
135 $this->repo_path = $repo_path;
137 $this->run('init');
140 throw new \Exception($this->handleRepoPathError(
146 throw new \Exception($this->handleRepoPathError(
154 $this->repo_path = $repo_path;
155 if ($_init) $this->run('init');
157 throw new \Exception($this->handleRepoPathError(
159 'cannot create repository in non-existent directory'
163 throw new \Exception($this->handleRepoPathError(
179 return ($this->bare) ? $this->repo_path : $this->repo_path . "/.git";
215 //dbglog("Git->runCommand(command=[".$command."])");
218 $cwd = $this->repo_path;
219 //dbglog("GitBacked - cwd: [".$cwd."]");
220 /* Provide any $this->envopts via putenv
228 foreach ($this->envopts as $k => $v) {
242 //dbglog("GitBacked - stderr: [".$stderr."]");
249 //dbglog("GitBacked - error_message: [".$error_message."]");
250 throw new \Exception($this->handleCommandError(
251 $this->repo_path,
258 $this->handleCommandSuccess($this->repo_path, $cwd, $command);
275 return $this->runCommand(Git::getBin() . " " . $command);
289 $plugin->notifyCreateNewError($repo_path, $reference, $error_message);
304 if ($this->plugin instanceof \action_plugin_gitbacked_editcommit) {
305 $this->plugin->notifyRepoPathError($repo_path, $error_message);
323 if ($this->plugin instanceof \action_plugin_gitbacked_editcommit) {
324 $this->plugin->notifyCommandError($repo_path, $cwd, $command, $status, $error_message);
340 if ($this->plugin instanceof \action_plugin_gitbacked_editcommit) {
341 $this->plugin->notifyCommandSuccess($repo_path, $cwd, $command);
356 $msg = $this->run("status");
377 return $this->run("add $files -v");
387 * @param Boolean use the --cached flag?
395 return $this->run("rm " . ($cached ? '--cached ' : '') . $files);
406 * @param boolean should all files be committed automatically (-a flag)
411 $flags = $commit_all ? '-av' : '-v';
414 return $this->run("commit --allow-empty " . $flags . " --file=" . $msgfile);
432 return $this->run("clone --local " . $this->repo_path . " $target");
447 return $this->run("clone --local $source " . $this->repo_path);
463 return $this->run("clone $reference $source " . $this->repo_path);
472 * @param bool delete directories?
478 return $this->run("clean" . (($force) ? " -f" : "") . (($dirs) ? " -d" : ""));
482 * Runs a `git branch` call
484 * Accepts a name for the branch
487 * @param string branch name
490 public function createBranch($branch) argument
492 return $this->run("branch $branch");
496 * Runs a `git branch -[d|D]` call
498 * Accepts a name for the branch
501 * @param string branch name
504 public function deleteBranch($branch, $force = false) argument
506 return $this->run("branch " . (($force) ? '-D' : '-d') . " $branch");
510 * Runs a `git branch` call
513 * @param bool keep asterisk mark on active branch
518 $branchArray = explode("\n", $this->run("branch"));
519 foreach ($branchArray as $i => &$branch) {
520 $branch = trim($branch);
522 $branch = str_replace("* ", "", $branch);
524 if ($branch == "") {
532 * Lists remote branches (using `git branch -r`).
534 * Also strips out the HEAD reference (e.g. "origin/HEAD -> origin/master").
541 $branchArray = explode("\n", $this->run("branch -r"));
542 foreach ($branchArray as $i => &$branch) {
543 $branch = trim($branch);
544 if ($branch == "" || strpos($branch, 'HEAD -> ') !== false) {
552 * Returns name of active branch
555 * @param bool keep asterisk mark on branch name
560 $branchArray = $this->listBranches(true);
573 * Accepts a name for the branch
576 * @param string branch name
579 public function checkout($branch) argument
581 return $this->run("checkout $branch");
588 * Accepts a name for the branch to be merged
591 * @param string $branch
594 public function merge($branch) argument
596 return $this->run("merge $branch --no-ff");
601 * Runs a git fetch on the current branch
608 return $this->run("fetch");
627 return $this->run("tag -a $tag --file=" . $msgfile);
644 $tagArray = explode("\n", $this->run("tag -l $pattern"));
656 * Push specific branch to a remote
658 * Accepts the name of the remote and local branch
661 * @param string $branch
664 public function push($remote, $branch) argument
666 return $this->run("push --tags $remote $branch");
670 * Pull specific branch from remote
672 * Accepts the name of the remote and local branch
675 * @param string $branch
678 public function pull($remote, $branch) argument
680 return $this->run("pull $remote $branch");
692 return $this->run('log');
694 return $this->run('log --pretty=format:"' . $format . '"');
705 $path = $this->gitDirectoryPath();
716 $path = $this->gitDirectoryPath();
728 $this->envopts[$key] = $value;