[PHP-CVS] [git] commit karma.git: lib/Git/PostReceiveHook.php
Commit: bdcf0e849a28c2b06017f225dd488bd26366bf88 Author: Derick Rethans(git...@derickrethans.nl) Tue, 20 Mar 2012 07:59:37 + Committer: Derick Rethans(git...@derickrethans.nl) Tue, 20 Mar 2012 07:59:37 + Parents: 3586d1c6652ce0f202daa2894d7862ff4e698140 Link: http://git.php.net/?p=karma.git;a=commitdiff;h=bdcf0e849a28c2b06017f225dd488bd26366bf88 Log: Add commit message "subject" and change "commit" to "com" to save space. Changed paths: M lib/Git/PostReceiveHook.php Diff: bdcf0e849a28c2b06017f225dd488bd26366bf88 diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php index 4aec7b7..b05feca 100644 --- a/lib/Git/PostReceiveHook.php +++ b/lib/Git/PostReceiveHook.php @@ -567,7 +567,7 @@ class PostReceiveHook extends ReceiveHook $diff = \Git::gitExec('diff-tree -c -p %s', escapeshellarg($revision)); $mail = new \Mail(); -$mail->setSubject($this->emailPrefix . 'commit ' . $this->getRepositoryName() . ': ' . implode(' ', array_keys($paths))); +$mail->setSubject($this->emailPrefix . 'com ' . $this->getRepositoryName() . ': ' . $info['subject'] . ': '. implode(' ', array_keys($paths))); $message = ''; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] [git] commit karma.git: lib/Git/PostReceiveHook.php
Commit: 3bacfbd956538305c8f604271071d839ecb1f559 Author: Derick Rethans(git...@derickrethans.nl) Tue, 20 Mar 2012 08:25:38 + Committer: Derick Rethans(git...@derickrethans.nl) Tue, 20 Mar 2012 08:25:38 + Parents: bdcf0e849a28c2b06017f225dd488bd26366bf88 11bc19461cfada676edd5852edc529532ef7a3ac Link: http://git.php.net/?p=karma.git;a=commitdiff;h=3bacfbd956538305c8f604271071d839ecb1f559 Log: Merge branch 'master' of git.php.net:/karma Changed paths: MM lib/Git/PostReceiveHook.php Diff: 3bacfbd956538305c8f604271071d839ecb1f559 diff --combined lib/Git/PostReceiveHook.php index b05feca,ee3aab7..4201508 --- a/lib/Git/PostReceiveHook.php +++ b/lib/Git/PostReceiveHook.php @@@ -39,70 -39,6 +39,6 @@@ class PostReceiveHook extends ReceiveHo $this->allBranches = $this->getAllBranches(); } - - public function getReceivedMessages() - { - $this->hookInput(); - - $paths = array_map( - function ($input) { - return $this->getReceivedMessagesForRange($input['old'], $input['new']); - }, - $this->refs); - - /* remove empty lines, and flattern the array */ - $flattend = array_reduce($paths, 'array_merge', []); - $paths= array_filter($flattend); - - return array_unique($paths); - } - - /** - * Returns an array of commit messages between revision $old and $new. - * - * @param string $old The old revison number. - * @parma string $new The new revison umber. - * - * @return array - */ - private function getReceivedMessagesForRange($old, $new) - { - $repourl = \Git::getRepositoryPath(); - $output = []; - - if ($old == '') { - $cmd = sprintf( - "%s --git-dir=%s for-each-ref --format='%%(refname)' 'refs/heads/*'", - self::GIT_EXECUTABLE, - $repourl - ); - exec($cmd, $output); - - /* do we have heads? otherwise it's a new repo! */ - $heads = implode(' ', $output); - $not = count($output) > 0 ? sprintf('--not %s', escapeshellarg($heads)) : ''; - $cmd = sprintf( - '%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s %s', - \Git::GIT_EXECUTABLE, - $repourl, - $not, - escapeshellarg($new) - ); - exec($cmd, $output); - } else { - $cmd = sprintf( - '%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s..%s', - \Git::GIT_EXECUTABLE, - $repourl, - escapeshellarg($old), - escapeshellarg($new) - ); - exec($cmd, $output); - } - - return $output; - } - /** * Find user name by nickname in users data file * @param string $user user nickname @@@ -225,11 -161,8 +161,8 @@@ } } - - - $mail = new \Mail(); -$mail->setSubject($this->emailPrefix . ' branch ' . $this->getRepositoryName() . ': ' . $status[$changeType] . ' branch ' . $shortname); +$mail->setSubject($this->emailPrefix . 'branch ' . $this->getRepositoryName() . ': ' . $status[$changeType] . ' branch ' . $shortname); $message = 'Branch ' . $shortname . ' in ' . $this->getRepositoryName() . ' was ' . $status[$changeType] . 'd' . "\n"; $message .= 'Date: ' . date('r') . "\n"; @@@ -567,7 -500,7 +500,7 @@@ $diff = \Git::gitExec('diff-tree -c -p %s', escapeshellarg($revision)); $mail = new \Mail(); -$mail->setSubject($this->emailPrefix . ' commit ' . $this->getRepositoryName() . ': ' . implode(' ', array_keys($paths))); +$mail->setSubject($this->emailPrefix . 'com ' . $this->getRepositoryName() . ': ' . $info['subject'] . ': '. implode(' ', array_keys($paths))); $message = ''; @@@ -585,7 -518,9 +518,9 @@@ } - if (strlen($pathsString) < 8192) { + if ($pathsString == '') { + $message .= "\nTrivial merge\n"; + } elseif (strlen($pathsString) < 8192) { // inline changed paths $message .= "\nChanged paths:\n" . $pathsString . "\n"; if ((strlen($pathsString) + strlen($diff)) < 8192) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] [git] commit karma.git: lib/Git/PostReceiveHook.php
Commit: 9c54157ce5bcc8e2a414014ddd234efedd8d135c Author: Alexander Moskaliov(ir...@php.net) Tue, 20 Mar 2012 11:31:31 +0400 Committer: Alexander Moskaliov(ir...@php.net) Tue, 20 Mar 2012 11:31:31 +0400 Parents: 42d233ae4752adbce2709553cef0cd456b92a2e0 Link: http://git.php.net/?p=karma.git;a=commitdiff;h=9c54157ce5bcc8e2a414014ddd234efedd8d135c Log: Remove not used methods This methods was moved to bugsweb class early Changed paths: M lib/Git/PostReceiveHook.php Diff: 9c54157ce5bcc8e2a414014ddd234efedd8d135c diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php index bd3be9b..da755f4 100644 --- a/lib/Git/PostReceiveHook.php +++ b/lib/Git/PostReceiveHook.php @@ -39,70 +39,6 @@ class PostReceiveHook extends ReceiveHook $this->allBranches = $this->getAllBranches(); } - -public function getReceivedMessages() -{ -$this->hookInput(); - -$paths = array_map( -function ($input) { -return $this->getReceivedMessagesForRange($input['old'], $input['new']); -}, -$this->refs); - -/* remove empty lines, and flattern the array */ -$flattend = array_reduce($paths, 'array_merge', []); -$paths= array_filter($flattend); - -return array_unique($paths); -} - -/** - * Returns an array of commit messages between revision $old and $new. - * - * @param string $old The old revison number. - * @parma string $new The new revison umber. - * - * @return array - */ -private function getReceivedMessagesForRange($old, $new) -{ -$repourl = \Git::getRepositoryPath(); -$output = []; - -if ($old == '') { -$cmd = sprintf( -"%s --git-dir=%s for-each-ref --format='%%(refname)' 'refs/heads/*'", -self::GIT_EXECUTABLE, -$repourl -); -exec($cmd, $output); - -/* do we have heads? otherwise it's a new repo! */ -$heads = implode(' ', $output); -$not = count($output) > 0 ? sprintf('--not %s', escapeshellarg($heads)) : ''; -$cmd = sprintf( -'%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s %s', -\Git::GIT_EXECUTABLE, -$repourl, -$not, -escapeshellarg($new) -); -exec($cmd, $output); -} else { -$cmd = sprintf( -'%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s..%s', -\Git::GIT_EXECUTABLE, -$repourl, -escapeshellarg($old), -escapeshellarg($new) -); -exec($cmd, $output); -} - -return $output; -} - /** * Find user name by nickname in users data file * @param string $user user nickname @@ -225,9 +161,6 @@ class PostReceiveHook extends ReceiveHook } } - - - $mail = new \Mail(); $mail->setSubject($this->emailPrefix . ' branch ' . $this->getRepositoryName() . ': ' . $status[$changeType] . ' branch ' . $shortname); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] [git] commit karma.git: lib/Git/PostReceiveHook.php
Commit: 11bc19461cfada676edd5852edc529532ef7a3ac Author: Alexander Moskaliov(ir...@php.net) Tue, 20 Mar 2012 11:36:28 +0400 Committer: Alexander Moskaliov(ir...@php.net) Tue, 20 Mar 2012 11:36:28 +0400 Parents: 9c54157ce5bcc8e2a414014ddd234efedd8d135c Link: http://git.php.net/?p=karma.git;a=commitdiff;h=11bc19461cfada676edd5852edc529532ef7a3ac Log: Add trivial merge. For merge commits without change any files (trivial merge) we not show changes path and diff in mail Changed paths: M lib/Git/PostReceiveHook.php Diff: 11bc19461cfada676edd5852edc529532ef7a3ac diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php index da755f4..ee3aab7 100644 --- a/lib/Git/PostReceiveHook.php +++ b/lib/Git/PostReceiveHook.php @@ -518,7 +518,9 @@ class PostReceiveHook extends ReceiveHook } -if (strlen($pathsString) < 8192) { +if ($pathsString == '') { +$message .= "\nTrivial merge\n"; +} elseif (strlen($pathsString) < 8192) { // inline changed paths $message .= "\nChanged paths:\n" . $pathsString . "\n"; if ((strlen($pathsString) + strlen($diff)) < 8192) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] [git] commit karma.git: lib/Git/PostReceiveHook.php lib/Git/ReceiveHook.php lib/Mail.php
Commit: 4a6cbdd7b551664f76c536fd67c009ba25c98d2d Author: Alexander Moskaliov(ir...@php.net) Sun, 18 Mar 2012 19:43:31 +0400 Committer: Alexander Moskaliov(ir...@php.net) Sun, 18 Mar 2012 19:43:31 +0400 Parents: 7c4de5d5a9e10eb0322d87e69f07e32ad843de60 Link: http://git.php.net/?p=karma.git;a=commitdiff;h=4a6cbdd7b551664f76c536fd67c009ba25c98d2d Log: add "in-reply-to" test support and fix phpdoc Changed paths: M lib/Git/PostReceiveHook.php M lib/Git/ReceiveHook.php M lib/Mail.php 4a6cbdd7b551664f76c536fd67c009ba25c98d2d diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php index 5955bc2..743b6ac 100644 --- a/lib/Git/PostReceiveHook.php +++ b/lib/Git/PostReceiveHook.php @@ -17,12 +17,14 @@ class PostReceiveHook extends ReceiveHook private $allBranches = []; +private $branchesMailIds = []; + /** - * @param $basePath string base path for all repositories - * @param $pushAuthor string user who make push - * @param $usersFile string path to file with users data - * @param $mailingList string mail recipient - * @param $emailPrefix string prefix for mail subject + * @param string $basePath base path for all repositories + * @param string $pushAuthor user who make push + * @param string $usersFile path to file with users data + * @param string $mailingList mail recipient + * @param string $emailPrefix prefix for mail subject */ public function __construct($basePath, $pushAuthor, $usersFile, $mailingList, $emailPrefix) { @@ -39,7 +41,7 @@ class PostReceiveHook extends ReceiveHook /** * Find user name by nickname in users data file - * @param $user user nickname + * @param string $user user nickname * @return string user name */ public function getUserName($user) @@ -83,7 +85,7 @@ class PostReceiveHook extends ReceiveHook if ($ref['reftype'] == self::REF_TAG) { $this->sendTagMail($ref['refname'], $ref['changetype'], $ref['old'], $ref['new']); } elseif ($ref['reftype'] == self::REF_BRANCH){ -$this->sendBranchMail($ref['refname'], $ref['changetype'], $ref['old'], $ref['new']); +$this->branchesMailIds[$ref['refname']] = $this->sendBranchMail($ref['refname'], $ref['changetype'], $ref['old'], $ref['new']); } } @@ -91,12 +93,11 @@ class PostReceiveHook extends ReceiveHook foreach ($this->revisions as $revision => $branches) { // check if it commit was already in other branches if (!$this->isRevExistsInBranches($revision, array_diff($this->allBranches, $branches))) { -$this->sendCommitMail($revision); +$this->sendCommitMail($revision, $branches); } } } - /** * Send mail about branch. * Subject: [git] [branch] %PROJECT%: %STATUS% branch %BRANCH_NAME% @@ -119,10 +120,11 @@ class PostReceiveHook extends ReceiveHook * * --/part1-- * - * @param $name string branch fullname (refs/heads/example) - * @param $changeType int delete, create or update - * @param $oldrev string old revision - * @param $newrev string new revision + * @param string $name branch fullname (refs/heads/example) + * @param int $changeType delete, create or update + * @param string $oldrev old revision + * @param string $newrev new revision + * @return string mail uniq id */ private function sendBranchMail($name, $changeType, $oldrev, $newrev) { @@ -202,12 +204,13 @@ class PostReceiveHook extends ReceiveHook $mail->send(); +return $mail->getId(); } /** * Cache revisions per branche for use it later - * @param $branchName string branch fullname + * @param string $branchName branch fullname * @param array $revisions revisions array */ private function cacheRevisions($branchName, array $revisions) @@ -245,10 +248,10 @@ class PostReceiveHook extends ReceiveHook * %PATHS% * --/part1-- * - * @param $name string tag fullname (refs/tags/example) - * @param $changeType int delete, create or update - * @param $oldrev string old revision - * @param $newrev string new revision + * @param string $name tag fullname (refs/tags/example) + * @param int $changeType delete, create or update + * @param string $oldrev old revision + * @param string $newrev new revision */ private function sendTagMail($name, $changeType, $oldrev, $newrev) { @@ -321,7 +324,7 @@ class PostReceiveHook extends ReceiveHook * only for annotated tag: * 'tagger', 'tagger_email', 'tagger_date' - info about tagger person * 'log' - tag message - * @param $tag string tag fullname + * @param string $tag tag fullname * @return array array with tag info */ private function getTagInfo($tag) @@ -351,10 +354
[PHP-CVS] [git] commit karma.git: lib/Git/PostReceiveHook.php lib/Git/ReceiveHook.php
Commit: 42d233ae4752adbce2709553cef0cd456b92a2e0 Author: Alexander Moskaliov(ir...@php.net) Tue, 20 Mar 2012 10:34:35 +0400 Committer: Alexander Moskaliov(ir...@php.net) Tue, 20 Mar 2012 10:35:41 +0400 Parents: c3c822e0f983c7514f8043ec11ceeef9c80100c0 4a6cbdd7b551664f76c536fd67c009ba25c98d2d Link: http://git.php.net/?p=karma.git;a=commitdiff;h=42d233ae4752adbce2709553cef0cd456b92a2e0 Log: Merge branch 'PHP_POST_RECEIVE' Changed paths: MM lib/Git/PostReceiveHook.php MM lib/Git/ReceiveHook.php 42d233ae4752adbce2709553cef0cd456b92a2e0 diff --combined lib/Git/PostReceiveHook.php index 633ff77,743b6ac..bd3be9b --- a/lib/Git/PostReceiveHook.php +++ b/lib/Git/PostReceiveHook.php @@@ -17,12 -17,14 +17,14 @@@ class PostReceiveHook extends ReceiveHo private $allBranches = []; + private $branchesMailIds = []; + /** - * @param $basePath string base path for all repositories - * @param $pushAuthor string user who make push - * @param $usersFile string path to file with users data - * @param $mailingList string mail recipient - * @param $emailPrefix string prefix for mail subject + * @param string $basePath base path for all repositories + * @param string $pushAuthor user who make push + * @param string $usersFile path to file with users data + * @param string $mailingList mail recipient + * @param string $emailPrefix prefix for mail subject */ public function __construct($basePath, $pushAuthor, $usersFile, $mailingList, $emailPrefix) { @@@ -37,73 -39,9 +39,73 @@@ $this->allBranches = $this->getAllBranches(); } + +public function getReceivedMessages() +{ +$this->hookInput(); + +$paths = array_map( +function ($input) { +return $this->getReceivedMessagesForRange($input['old'], $input['new']); +}, +$this->refs); + +/* remove empty lines, and flattern the array */ +$flattend = array_reduce($paths, 'array_merge', []); +$paths= array_filter($flattend); + +return array_unique($paths); +} + +/** + * Returns an array of commit messages between revision $old and $new. + * + * @param string $old The old revison number. + * @parma string $new The new revison umber. + * + * @return array + */ +private function getReceivedMessagesForRange($old, $new) +{ +$repourl = \Git::getRepositoryPath(); +$output = []; + +if ($old == '') { +$cmd = sprintf( +"%s --git-dir=%s for-each-ref --format='%%(refname)' 'refs/heads/*'", +self::GIT_EXECUTABLE, +$repourl +); +exec($cmd, $output); + +/* do we have heads? otherwise it's a new repo! */ +$heads = implode(' ', $output); +$not = count($output) > 0 ? sprintf('--not %s', escapeshellarg($heads)) : ''; +$cmd = sprintf( +'%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s %s', +\Git::GIT_EXECUTABLE, +$repourl, +$not, +escapeshellarg($new) +); +exec($cmd, $output); +} else { +$cmd = sprintf( +'%s --git-dir=%s log --pretty=format:"[%%ae] %%H %%s" %s..%s', +\Git::GIT_EXECUTABLE, +$repourl, +escapeshellarg($old), +escapeshellarg($new) +); +exec($cmd, $output); +} + +return $output; +} + /** * Find user name by nickname in users data file - * @param $user user nickname + * @param string $user user nickname * @return string user name */ public function getUserName($user) @@@ -147,7 -85,7 +149,7 @@@ if ($ref['reftype'] == self::REF_TAG) { $this->sendTagMail($ref['refname'], $ref['changetype'], $ref['old'], $ref['new']); } elseif ($ref['reftype'] == self::REF_BRANCH){ - $this->sendBranchMail($ref['refname'], $ref['changetype'], $ref['old'], $ref['new']); + $this->branchesMailIds[$ref['refname']] = $this->sendBranchMail($ref['refname'], $ref['changetype'], $ref['old'], $ref['new']); } } @@@ -155,12 -93,11 +157,11 @@@ foreach ($this->revisions as $revision => $branches) { // check if it commit was already in other branches if (!$this->isRevExistsInBranches($revision, array_diff($this->allBranches, $branches))) { - $this->sendCommitMail($revision); + $this->sendCommitMail($revision, $branches); } } } - /** * Send mail about branch. * Subject:
[PHP-CVS] [git] commit karma.git: lib/Git/PostReceiveHook.php
Commit: c3c822e0f983c7514f8043ec11ceeef9c80100c0 Author: David Soria Parra(d...@php.net) Mon, 19 Mar 2012 22:12:42 +0100 Committer: David Soria Parra(d...@php.net) Mon, 19 Mar 2012 22:12:42 +0100 Parents: 04cd724385b1ccb846f846d14250caf34628d0f4 Link: http://git.php.net/?p=karma.git;a=commitdiff;h=c3c822e0f983c7514f8043ec11ceeef9c80100c0 Log: Initialize logString Changed paths: M lib/Git/PostReceiveHook.php Diff: c3c822e0f983c7514f8043ec11ceeef9c80100c0 diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php index 15487ca..633ff77 100644 --- a/lib/Git/PostReceiveHook.php +++ b/lib/Git/PostReceiveHook.php @@ -191,6 +191,7 @@ class PostReceiveHook extends ReceiveHook private function sendBranchMail($name, $changeType, $oldrev, $newrev) { +$logString = ''; $status = [self::TYPE_UPDATED => 'update', self::TYPE_CREATED => 'create', self::TYPE_DELETED => 'delete']; $shortname = str_replace('refs/heads/', '', $name); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] [git][commit] karma.git: lib/Git/PostReceiveHook.php
Commit: db438a4a9ec117fec2767de6a0f79147d48285cc Author: David Soria Parra(d...@php.net) Sun, 18 Mar 2012 21:22:53 +0100 Committer: David Soria Parra(d...@php.net) Sun, 18 Mar 2012 21:22:53 +0100 Parents: 3162a39a2c0068c7ad0d718df30599a660d3bd2b Link: http://git.php.net/?p=karma.git;a=commitdiff;h=db438a4a9ec117fec2767de6a0f79147d48285cc Log: Less square brackets Changed paths: M lib/Git/PostReceiveHook.php Diff: db438a4a9ec117fec2767de6a0f79147d48285cc diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php index 5e28dee..15487ca 100644 --- a/lib/Git/PostReceiveHook.php +++ b/lib/Git/PostReceiveHook.php @@ -226,7 +226,7 @@ class PostReceiveHook extends ReceiveHook $mail = new \Mail(); -$mail->setSubject($this->emailPrefix . '[branch] ' . $this->getRepositoryName() . ': ' . $status[$changeType] . ' branch ' . $shortname); +$mail->setSubject($this->emailPrefix . ' branch ' . $this->getRepositoryName() . ': ' . $status[$changeType] . ' branch ' . $shortname); $message = 'Branch ' . $shortname . ' in ' . $this->getRepositoryName() . ' was ' . $status[$changeType] . 'd' . "\n"; $message .= 'Date: ' . date('r') . "\n"; @@ -320,7 +320,7 @@ class PostReceiveHook extends ReceiveHook $status = [self::TYPE_UPDATED => 'update', self::TYPE_CREATED => 'create', self::TYPE_DELETED => 'delete']; $shortname = str_replace('refs/tags/', '', $name); $mail = new \Mail(); -$mail->setSubject($this->emailPrefix . '[tag] ' . $this->getRepositoryName() . ': ' . $status[$changeType] . ' tag ' . $shortname); +$mail->setSubject($this->emailPrefix . 'tag ' . $this->getRepositoryName() . ': ' . $status[$changeType] . ' tag ' . $shortname); $message = 'Tag ' . $shortname . ' in ' . $this->getRepositoryName() . ' was ' . $status[$changeType] . 'd' . (($changeType != self::TYPE_CREATED) ? ' from ' . $oldrev : '' ) . "\n"; @@ -562,7 +562,7 @@ class PostReceiveHook extends ReceiveHook $diff = \Git::gitExec('diff-tree -c -p %s', escapeshellarg($revision)); $mail = new \Mail(); -$mail->setSubject($this->emailPrefix . '[commit] ' . $this->getRepositoryName() . ': ' . implode(' ', array_keys($paths))); +$mail->setSubject($this->emailPrefix . ' commit ' . $this->getRepositoryName() . ': ' . implode(' ', array_keys($paths))); $message = ''; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php