當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Git::commit方法代碼示例

本文整理匯總了PHP中Git::commit方法的典型用法代碼示例。如果您正苦於以下問題:PHP Git::commit方法的具體用法?PHP Git::commit怎麽用?PHP Git::commit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Git的用法示例。


在下文中一共展示了Git::commit方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 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);
 }
開發者ID:sinergi,項目名稱:devtools,代碼行數:10,代碼來源:DumpDatabaseCommand.php

示例2: testMultipleCommitsInSinglePush

 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);
 }
開發者ID:Theaxiom,項目名稱:chaw-source,代碼行數:33,代碼來源:git.test.php

示例3: getCommit

 function getCommit($proj, $commit)
 {
     $commit = Git::commit($proj, $commit);
     if (is_array($commit) && count($commit) == 1) {
         return current($commit);
     }
     return $commit;
 }
開發者ID:nurulimamnotes,項目名稱:php-git,代碼行數:8,代碼來源:project.php

示例4: foreach

             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!"}';
     }
開發者ID:practico,項目名稱:Codiad-CodeGit,代碼行數:31,代碼來源:controller.php


注:本文中的Git::commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。