コード例 #1
0
 public function run()
 {
     echo '---------------------------------------------' . PHP_EOL;
     echo 'Dumping database ' . $this->database->getDatabaseName() . PHP_EOL;
     echo '---------------------------------------------' . PHP_EOL;
     Git::cloneRepository($this->cwd, $this->gitRepository);
     $this->dumpDatabase();
     Git::commit($this->cwd, $this->gitRepository);
     Git::push($this->cwd, $this->gitRepository);
 }
コード例 #2
0
ファイル: git.test.php プロジェクト: Theaxiom/chaw-source
 function testMultipleCommitsInSinglePush()
 {
     $Cleanup = new Folder(TMP . 'tests/git');
     if ($Cleanup->pwd() == TMP . 'tests/git') {
         $Cleanup->delete();
     }
     $Git = new Git($this->__repos[1]);
     $this->assertTrue($Git->create());
     $this->assertTrue(file_exists(TMP . 'tests/git/repo/test.git'));
     $this->assertTrue(file_exists(TMP . 'tests/git/working/test/master/.git'));
     $File = new File(TMP . 'tests/git/working/test/new.text', true);
     $File->write('this is something new');
     $Git->commit(array("-m", "'Pushing to fork'"));
     $File = new File(TMP . 'tests/git/working/test/new.text', true);
     $File->write('this is something new again');
     $Git->commit(array("-m", "'Pushing to fork again'"));
     $Git->push('origin', 'master');
     $data = $Git->read();
     $this->assertTrue($data['message'], 'Pushing to fork again');
     $this->assertTrue(file_exists(TMP . 'tests/git/working/test/new.text'));
     $File = new File(TMP . 'tests/git/working/test/new.text', true);
     $File->write('this is something new again');
     $Git->commit(array("-m", "'Pushing to fork again again'"));
     $Git->push('origin', 'master');
     $data = $Git->read();
     $this->assertTrue($data['message'], 'Pushing to fork again again');
     //pr($Git->run('log', array('--pretty=oneline')));
     //$info = $Git->run('log', array("--pretty=format:%P%x00%H%x00%an%x00%ai%x00%s"), 'capture');
     //list($parent, $revision, $author, $commit_date, $message) = explode(chr(0), $info[0]);
     //pr($Git->run('rev-list', array($parent, $revision)));
     //pr($Git->run('log', array($revision, "--pretty=format:%P%x00%H%x00%an%x00%ai%x00%s"), 'capture'));
     //pr($Git->debug);
 }
コード例 #3
0
ファイル: project.php プロジェクト: nurulimamnotes/php-git
 function getCommit($proj, $commit)
 {
     $commit = Git::commit($proj, $commit);
     if (is_array($commit) && count($commit) == 1) {
         return current($commit);
     }
     return $commit;
 }
コード例 #4
0
             foreach ($files as $file) {
                 $result = !(!$result | !$git->add(getWorkspacePath($_GET['path']), $file));
             }
             if ($result) {
                 echo '{"status":"success","message":"Changes added"}';
                 break;
             }
         }
         echo '{"status":"success","message":"Failed to add changes"}';
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';
     }
     break;
 case 'commit':
     if (isset($_GET['path']) && isset($_POST['message'])) {
         echo $git->commit(getWorkspacePath($_GET['path']), $_POST['message']);
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';
     }
     break;
 case 'log':
     if (isset($_GET['path'])) {
         $result = $git->getLog(getWorkspacePath($_GET['path']));
         if ($result === false) {
             echo '{"status":"error","message":"Failed to get log!"}';
         } else {
             echo '{"status":"success","data":' . json_encode($result) . '}';
         }
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';
     }