[PHP-CVS] [git] karma.git branch master updated. c388fdc

2012-03-06 Thread dsp
The branch, master on karma.git has been updated
  discards  002a63c12dc1eadb3885d9fc5c6b97cf3863913a (commit)
   via  c388fdc594d5cf8f8f695eef47c179e2e1acc39e (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (002a63c12dc1eadb3885d9fc5c6b97cf3863913a)
\
 N -- N -- N (c388fdc594d5cf8f8f695eef47c179e2e1acc39e)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

http://git.php.net/?p=karma.git;a=log;h=c388fdc594d5cf8f8f695eef47c179e2e1acc39e;hp=002a63c12dc1eadb3885d9fc5c6b97cf3863913a

Summary of changes:
 hooks/pre-receive |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

-- Log 
commit c388fdc594d5cf8f8f695eef47c179e2e1acc39e
Author: David Soria Parra d...@php.net
Date:   Fri Mar 2 03:06:30 2012 +0100

Require access to all the repository in case we do a forced push

A forced push can happen when you delete a tag or rewrite commits. We allow
this, but only if you have access to the root of the repository.

diff --git a/hooks/pre-receive b/hooks/pre-receive
index 46195a4..6a7c29f 100755
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@ -11,11 +11,15 @@ namespace Karma;
 
 const KARMA_FILE = '/git/checkout/SVNROOT/global_avail';
 const REPOSITORY_PATH = '/git/repositories';
+const LIB_PATH = '/git/checkout/karma/lib';
 
-set_include_path('/git/checkout/karma/lib' .
+set_include_path(
+getenv('KARMA_LIB_PATH') ?: LIB_PATH .
 PATH_SEPARATOR .
 get_include_path());
 
+include 'Git.php';
+include 'Git/PushInformation.php';
 include 'Git/ReceiveHook.php';
 
 function deny($reason)
@@ -107,16 +111,18 @@ if ($hook-isKarmaIgnored()) {
 accept(No karma check necessary. Thank you for your contribution.\n);
 }
 
-$requested_paths = $hook-getReceivedPaths();
+$repo_name = $hook-getRepositoryName();
+$pi= new \Git\PushInformation($hook);
+$req_paths = ($pi-isForced()) ? [''] : $hook-getReceivedPaths();
 
-if (empty($requested_paths)) {
+if (empty($req_paths)) {
 deny(We cannot figure out what you comitted!);
 }
 
-$prefix  = sprintf('%s/', $hook-getRepositoryName());
+$prefix  = sprintf('%s/', $repo_name);
 $avail_lines = $hook-getKarmaFile();
-$requested_paths = array_map(function ($x) use ($prefix) { return $prefix . 
$x;}, $requested_paths);
-$unavail_paths   = get_unavail_paths($user, $requested_paths, $avail_lines);
+$req_paths   = array_map(function ($x) use ($prefix) { return $prefix . 
$x;}, $req_paths);
+$unavail_paths   = get_unavail_paths($user, $req_paths, $avail_lines);
 
 if (!empty($unavail_paths)) {
 deny(sprintf(
diff --git a/lib/Git/PushInformation.php b/lib/Git/PushInformation.php
new file mode 100644
index 000..edf73dc
--- /dev/null
+++ b/lib/Git/PushInformation.php
@@ -0,0 +1,86 @@
+?php
+namespace Git;
+
+class PushInformation
+{
+const GIT_EXECUTABLE = 'git';
+
+private $karmaFile;
+private $repositoryBasePath;
+
+private $hook= null;
+private $repourl = null;
+
+public function __construct(ReceiveHook $hook)
+{
+$this-repourl = \Git::getRepositoryPath();
+$this-hook= $hook;
+}
+
+/**
+ * Returns the common ancestor revision for two given revisions
+ *
+ * Returns false if no sha1 was returned. Throws an exception if calling
+ * git fails.
+ *
+ * @return boolean
+ */
+protected function mergeBase($oldrev, $newrev)
+{
+$baserev = exec(sprintf('%s --git-dir=%s merge-base %s %s',
+\Git::GIT_EXECUTABLE,
+$this-repourl,
+escapeshellarg($oldrev),
+escapeshellarg($newrev)), $output, $retval);
+
+$baserev = trim($baserev);
+
+if (0 !== $retval) {
+throw new \Exception('Failed to call git');
+}
+
+if (40 != strlen($baserev)) {
+return false;
+}
+
+return $baserev;
+}
+
+/**
+ * Returns true if merging $newrev would be fast forward
+ *
+ * @return boolean
+ */
+public function isFastForward()
+{
+$result = $this-hook-mapInput(
+function ($oldrev, $newrev) {
+if ($oldrev == \Git::NULLREV) {
+return true;
+}
+return $oldrev == $this-mergeBase($oldrev, $newrev);
+});
+
+return array_reduce($result, function($a, $b) { return $a  $b; }, 
true);
+}
+
+/**
+ * Returns true if updating the refs would fail if push is not forced.
+ *
+ * @return boolean
+ */
+public 

[PHP-CVS] [git] karma.git branch PHP_POST_RECEIVE updated. b841aac

2012-03-06 Thread irker
The branch, PHP_POST_RECEIVE on karma.git has been updated
   via  b841aacab5e1e9af103b1d38e11822debda5ea22 (commit)
  from  89a2d90e9e5d2e8a661b91c1fdb3f32cf2d90cdd (commit)

http://git.php.net/?p=karma.git;a=log;h=b841aacab5e1e9af103b1d38e11822debda5ea22;hp=89a2d90e9e5d2e8a661b91c1fdb3f32cf2d90cdd

Summary of changes:
 lib/Git/PostReceiveHook.php |   52 --
 1 files changed, 44 insertions(+), 8 deletions(-)

-- Log 
commit b841aacab5e1e9af103b1d38e11822debda5ea22
Author: Alexander Moskaliov ir...@php.net
Date:   Tue Mar 6 12:16:03 2012 +0400

commit mail

diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php
index 0530ac4..195c8c2 100644
--- a/lib/Git/PostReceiveHook.php
+++ b/lib/Git/PostReceiveHook.php
@@ -36,7 +36,8 @@ class PostReceiveHook extends ReceiveHook
 {
 $args = func_get_args();
 array_shift($args);
-$output = shell_exec(vsprintf($cmd, $args));
+$cmd = vsprintf($cmd, $args);
+$output = shell_exec($cmd);
 return $output;
 }
 
@@ -53,13 +54,18 @@ class PostReceiveHook extends ReceiveHook
 }
 }
 
-// TODO: mail per commit
-// send mail only about new commits
-// But for new branches we must check if this branch was
+// TODO: For new branches we must check if this branch was
 // cloned from other branch in this push - it's especial case
 // TODO: check old post-receive for other especial cases
-}
 
+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);
+}
+}
+
+}
 
 /*
  * Note:
@@ -122,6 +128,8 @@ class PostReceiveHook extends ReceiveHook
 $revisions = $this-getRevisions($branch['new']. ' --not ' . 
implode(' ', $this-allBranches));
 }
 
+$this-cacheRevisions($branch['refname'], $revisions);
+
 $message .= LOG\n;
 foreach ($revisions as $revision) {
 $diff = $this-execute(
@@ -136,6 +144,17 @@ class PostReceiveHook extends ReceiveHook
 $this-mail($this-emailprefix . '[push] ' . $title , $message);
 }
 
+
+private function cacheRevisions($branchName, array $revisions)
+{
+//TODO: add mail order from older commit to newer
+foreach ($revisions as $revision)
+{
+$this-revisions[$revision][] = $branchName;
+}
+}
+
+
 private function sendTagMail(array $tag)
 {
 
@@ -162,9 +181,6 @@ class PostReceiveHook extends ReceiveHook
 $message .= Old tag sha: \n . $tag['old'];
 }
 
-
-// TODO: write info about tag and target
-
 $this-mail($this-emailprefix . '[push] ' . $title , $message);
 }
 
@@ -205,6 +221,26 @@ class PostReceiveHook extends ReceiveHook
 }
 
 
+private function sendCommitMail($revision)
+{
+$title = Commit  . $revision .  was added;
+$message = $title . \n\n;
+
+
+$info = $this-execute('git diff-tree --stat --pretty=fuller -c %s', 
$revision);
+
+$message .= $info .\n\n;
+
+$message .= DIFF\n;
+
+$diff = $this-execute('git diff-tree -c -p %s', $revision);
+
+$message .= $diff .\n\n;
+
+$this-mail($this-emailprefix . '[commit] ' . $title , $message);
+}
+
+
 private function mail($subject, $message) {
 $headers = array(
 'From: ' . $this-pushAuthor . '@php.net',

Thank you for your contribution.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/Zend/ README.ZEND_MM zend_API.c

2012-03-06 Thread Derick Rethans
derick   Tue, 06 Mar 2012 18:25:55 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323961

Log:
Add the ZEND_DONT_UNLOAD_MODULES environment variable for debugging to 5.3 as
well.

Changed paths:
U   php/php-src/branches/PHP_5_3/Zend/README.ZEND_MM
U   php/php-src/branches/PHP_5_3/Zend/zend_API.c

Modified: php/php-src/branches/PHP_5_3/Zend/README.ZEND_MM
===
--- php/php-src/branches/PHP_5_3/Zend/README.ZEND_MM2012-03-06 17:42:59 UTC 
(rev 323960)
+++ php/php-src/branches/PHP_5_3/Zend/README.ZEND_MM2012-03-06 18:25:55 UTC 
(rev 323961)
@@ -24,6 +24,14 @@

 $ USE_ZEND_ALLOC=0 valgrind --leak-check=full sapi/cli/php -r 'leak();'

+Shared extensions:
+--
+
+Since PHP 5.4 it is possible to prevent shared extensions from unloading so
+that valgrind can correctly track the memory leaks in shared extensions. For
+this there is the ZEND_DONT_UNLOAD_MODULES environment variable. If set, then
+DL_UNLOAD() is skipped during the shutdown of shared extensions.
+
 Tweaking:
 -


Modified: php/php-src/branches/PHP_5_3/Zend/zend_API.c
===
--- php/php-src/branches/PHP_5_3/Zend/zend_API.c2012-03-06 17:42:59 UTC 
(rev 323960)
+++ php/php-src/branches/PHP_5_3/Zend/zend_API.c2012-03-06 18:25:55 UTC 
(rev 323961)
@@ -2137,7 +2137,7 @@

 #if HAVE_LIBDL
 #if !(defined(NETWARE)  defined(APACHE_1_BUILD))
-   if (module-handle) {
+   if (module-handle  !getenv(ZEND_DONT_UNLOAD_MODULES)) {
DL_UNLOAD(module-handle);
}
 #endif

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/Zend/ README.ZEND_MM zend_API.c

2012-03-06 Thread Stas Malyshev

Hi!


+Since PHP 5.4 it is possible to prevent shared extensions from unloading so


Since 5.4 doesn't look right in 5.3 upgrading :) ITYM since 5.3.11?

--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/Zend/README.ZEND_MM branches/PHP_5_4/Zend/README.ZEND_MM trunk/Zend/README.ZEND_MM

2012-03-06 Thread Derick Rethans
derick   Tue, 06 Mar 2012 18:34:10 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323962

Log:
Fixed version numbers.

Changed paths:
U   php/php-src/branches/PHP_5_3/Zend/README.ZEND_MM
U   php/php-src/branches/PHP_5_4/Zend/README.ZEND_MM
U   php/php-src/trunk/Zend/README.ZEND_MM

Modified: php/php-src/branches/PHP_5_3/Zend/README.ZEND_MM
===
--- php/php-src/branches/PHP_5_3/Zend/README.ZEND_MM2012-03-06 18:25:55 UTC 
(rev 323961)
+++ php/php-src/branches/PHP_5_3/Zend/README.ZEND_MM2012-03-06 18:34:10 UTC 
(rev 323962)
@@ -27,7 +27,7 @@
 Shared extensions:
 --

-Since PHP 5.4 it is possible to prevent shared extensions from unloading so
+Since PHP 5.3.11 it is possible to prevent shared extensions from unloading so
 that valgrind can correctly track the memory leaks in shared extensions. For
 this there is the ZEND_DONT_UNLOAD_MODULES environment variable. If set, then
 DL_UNLOAD() is skipped during the shutdown of shared extensions.

Modified: php/php-src/branches/PHP_5_4/Zend/README.ZEND_MM
===
--- php/php-src/branches/PHP_5_4/Zend/README.ZEND_MM2012-03-06 18:25:55 UTC 
(rev 323961)
+++ php/php-src/branches/PHP_5_4/Zend/README.ZEND_MM2012-03-06 18:34:10 UTC 
(rev 323962)
@@ -27,7 +27,7 @@
 Shared extensions:
 --

-Since PHP 5.4 it is possible to prevent shared extensions from unloading so
+Since PHP 5.3.11 it is possible to prevent shared extensions from unloading so
 that valgrind can correctly track the memory leaks in shared extensions. For
 this there is the ZEND_DONT_UNLOAD_MODULES environment variable. If set, then
 DL_UNLOAD() is skipped during the shutdown of shared extensions.

Modified: php/php-src/trunk/Zend/README.ZEND_MM
===
--- php/php-src/trunk/Zend/README.ZEND_MM   2012-03-06 18:25:55 UTC (rev 
323961)
+++ php/php-src/trunk/Zend/README.ZEND_MM   2012-03-06 18:34:10 UTC (rev 
323962)
@@ -27,7 +27,7 @@
 Shared extensions:
 --

-Since PHP 5.4 it is possible to prevent shared extensions from unloading so
+Since PHP 5.3.11 it is possible to prevent shared extensions from unloading so
 that valgrind can correctly track the memory leaks in shared extensions. For
 this there is the ZEND_DONT_UNLOAD_MODULES environment variable. If set, then
 DL_UNLOAD() is skipped during the shutdown of shared extensions.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/Zend/ README.ZEND_MM zend_API.c

2012-03-06 Thread Derick Rethans
On Tue, 6 Mar 2012, Stas Malyshev wrote:

  +Since PHP 5.4 it is possible to prevent shared extensions from  unloading 
  so
 
 Since 5.4 doesn't look right in 5.3 upgrading :) ITYM since 5.3.11?

Fixed, thanks :-)

Derick

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ UPGRADING

2012-03-06 Thread Christopher Jones
sixd Tue, 06 Mar 2012 19:12:39 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323967

Log:
Typo: outout

Changed paths:
U   php/php-src/branches/PHP_5_4/UPGRADING

Modified: php/php-src/branches/PHP_5_4/UPGRADING
===
--- php/php-src/branches/PHP_5_4/UPGRADING  2012-03-06 19:05:24 UTC (rev 
323966)
+++ php/php-src/branches/PHP_5_4/UPGRADING  2012-03-06 19:12:39 UTC (rev 
323967)
@@ -122,7 +122,7 @@
 - Added cli.prompt to configure the CLI interactive shell prompt.

 - Added cli_server.color to enable the CLI web server to use ANSI color coding
-  in terminal outout.
+  in terminal output.

 
 2. Changes to reserved words and classes

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ UPGRADING

2012-03-06 Thread Christopher Jones
sixd Tue, 06 Mar 2012 20:20:50 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323968

Log:
Typo and missing zend ini param

Changed paths:
U   php/php-src/branches/PHP_5_4/UPGRADING

Modified: php/php-src/branches/PHP_5_4/UPGRADING
===
--- php/php-src/branches/PHP_5_4/UPGRADING  2012-03-06 19:12:39 UTC (rev 
323967)
+++ php/php-src/branches/PHP_5_4/UPGRADING  2012-03-06 20:20:50 UTC (rev 
323968)
@@ -74,7 +74,7 @@
   - safe_mode_exec_dir
   - safe_mode_allowed_env_vars
   - safe_mode_protected_env_vars
-  - session.bug_compat42
+  - session.bug_compat_42
   - session.bug_compat_warn
   - y2k_compliance
   - zend.ze1_compatibility_mode
@@ -106,6 +106,8 @@
 - Added zend.script_encoding. This value will be used unless a
   declare(encoding=...) directive appears at the top of the script.

+- Added zend.signal_check to check for replaced signal handlers on shutdown
+
 - Added enable_post_data_reading, which is enabled by default. When it's
   disabled, the POST data is not read (or processed); the behavior is similar
   to that of other request methods with body, like PUT. This allows reading

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/buildconf trunk/buildconf

2012-03-06 Thread Christopher Jones
sixd Tue, 06 Mar 2012 21:30:59 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323973

Log:
Make buildconf --force more robust, per IRC chat.  Not backported to 5.3 to 
avoid destabilization.

Changed paths:
U   php/php-src/branches/PHP_5_4/buildconf
U   php/php-src/trunk/buildconf

Modified: php/php-src/branches/PHP_5_4/buildconf
===
--- php/php-src/branches/PHP_5_4/buildconf  2012-03-06 20:57:56 UTC (rev 
323972)
+++ php/php-src/branches/PHP_5_4/buildconf  2012-03-06 21:30:59 UTC (rev 
323973)
@@ -32,7 +32,12 @@
   echo use buildconf --force to override this check.
   exit 1
 fi
-
+
+if test $devok = 1; then
+  echo Removing configure caches
+  rm -rf autom4te.cache config.cache
+fi
+
 rm -f generated_lists

 if test $debug = yes; then

Modified: php/php-src/trunk/buildconf
===
--- php/php-src/trunk/buildconf 2012-03-06 20:57:56 UTC (rev 323972)
+++ php/php-src/trunk/buildconf 2012-03-06 21:30:59 UTC (rev 323973)
@@ -32,7 +32,12 @@
   echo use buildconf --force to override this check.
   exit 1
 fi
-
+
+if test $devok = 1; then
+  echo Removing configure caches
+  rm -rf autom4te.cache config.cache
+fi
+
 rm -f generated_lists

 if test $debug = yes; then

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ UPGRADING

2012-03-06 Thread Christopher Jones
sixd Tue, 06 Mar 2012 23:34:57 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323975

Log:
Sync char set wording with migration doc

Changed paths:
U   php/php-src/branches/PHP_5_4/UPGRADING

Modified: php/php-src/branches/PHP_5_4/UPGRADING
===
--- php/php-src/branches/PHP_5_4/UPGRADING  2012-03-06 23:08:16 UTC (rev 
323974)
+++ php/php-src/branches/PHP_5_4/UPGRADING  2012-03-06 23:34:57 UTC (rev 
323975)
@@ -36,9 +36,10 @@
 1. Changes to INI directives
 =

-- The php.ini default_charset directive now defaults to UTF-8.  If you
-  were relying on the previous default of ISO-88590-1, you will need
-  to add:
+- The default character set is now UTF-8 when the default_charset
+  php.ini directive is not explicitly set. This applies to functions
+  such as htmlentities() and htmlspecialchars(). If you were relying
+  on the previous default of ISO-8859-1 you will need to add:

 default_charset = iso-8859-1


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] [git] karma.git branch PHP_POST_RECEIVE updated. 67c322f

2012-03-06 Thread irker
The branch, PHP_POST_RECEIVE on karma.git has been updated
   via  67c322fe22b0cb6f561711a4041325974b9bfc31 (commit)
  from  b841aacab5e1e9af103b1d38e11822debda5ea22 (commit)

http://git.php.net/?p=karma.git;a=log;h=67c322fe22b0cb6f561711a4041325974b9bfc31;hp=b841aacab5e1e9af103b1d38e11822debda5ea22

Summary of changes:
 README.POST_RECEIVE |   84 +++
 lib/Git/PostReceiveHook.php |   37 ---
 2 files changed, 84 insertions(+), 37 deletions(-)
 create mode 100644 README.POST_RECEIVE

-- Log 
commit 67c322fe22b0cb6f561711a4041325974b9bfc31
Author: Alexander Moskaliov ir...@php.net
Date:   Tue Mar 6 22:46:15 2012 +0400

Move git push situations description to README

diff --git a/README.POST_RECEIVE b/README.POST_RECEIVE
new file mode 100644
index 000..90a9f59
--- /dev/null
+++ b/README.POST_RECEIVE
@@ -0,0 +1,84 @@
+Post receive mail script solutions.
+
+
+digits - commits,
+chars - branches (except N  O)
+N, O - new and old revisions in push per branch.
+
+
+Branch mail:
+This part contains info only about mail per branch. For mail per commit logic 
different.
+
+
+New branch (0..N):
+
+1 - 2 - A (already on server)
+ \
+  3 - B (pushed)
+
+We get all commits reachable from new branche and not from all other 
branches:
+git rev-list B --not A   -  3-B
+
+
+1 - 2 - A (only local)
+ \
+  3 - B (pushed)
+
+Because A branch not pushed on server before we need mail about all 
commits including 1-2. e.g. 1-B
+
+
+1 - 2 - 3 - 4 - A (already on server)
+ \ /
+  5 - 6 - B (pushed)
+
+We can't know what we need also 5 commit in B, so we mailed only about B 
commit for this branch.
+2-6 commits was mailed in A branch.
+
+
+1 - 2 - 3 - A (already on server)
+ \   \
+  5 - 6 - B (pushed)
+We can't know what we need also 3 commit in B mail...  any ideas?
+Now we send mail with 5-B commits only.
+
+
+
+Deleted branch (O..0):
+
+We don't care about revisions in deleted branch. (or care?)
+
+
+Update branch (O..N):
+
+
+1 - 2 - O - 3 - 4 - N
+
+Maill full log between O and N. (e.g. 3-N)  git rev-list O..N
+
+
+1 - 2 - N1 - 2 - 3 - 4 - N
+\\ or \\
+  3 - 4 - O 5 - 6 - O
+
+It's mean user used --force option for pull and remove previosly revisions.
+(rewind N revision in first case and replace 5-O revisions by 4-N)
+We can check it by command: git rev-list N..O.
+If result of this command not empty - we have such cases.
+If result of git merge-base O N will be equal N  - we have first case.
+We send mail with info about rewind or replace.
+(Realization of this case in progress)
+
+
+
+Tag mail:
+
+Add, delete and update tag:
+If new(updated) tag is annotated - we write full info about it and target.
+If it not annotated - only about commit.
+
+For old(removed) tag - we write only sha of old commit/tag.
+
+
+
+Commit mail:
+(Realization of this part in progress)
\ No newline at end of file
diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php
index 195c8c2..49e5499 100644
--- a/lib/Git/PostReceiveHook.php
+++ b/lib/Git/PostReceiveHook.php
@@ -67,43 +67,6 @@ class PostReceiveHook extends ReceiveHook
 
 }
 
-/*
- * Note:
- *   * - commits in push,
- *   digits - simply commits
- *   chars - branches
- *   + - commits already in server git repository
- *   without +  - commits in local git repository
- *
- * Situation #1.
- *
- *1+ - 2* - A*
- *  \
- *  3* - B*
- *
- *  Problem: we have 0-B for B branch in push input data.
- *  Solution: git rev-list B --not A   -  3-B (--not A C D E F ... 
all branches)
- *
- * Situation #2.
- *1 - 2 - A
- *  \
- *  3* - B*
- *  Problem: we will have 0-B in rev-list.
- *  Solution: ?
- *
- * Situation #3.
- *
- *  1+ - 2+  -   3+ - A+
- *\ /
- *4* - 5* - B*
- * Problem: we will have 5-B in rev-list, but what about 4 commit?
- *
- * Solution: ?
- *
- *
- * ... more problems
- *
- */
 private function sendBranchMail(array $branch)
 {
 

Thank you for your contribution.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/fileinfo/ fileinfo.c tests/bug61173.phpt

2012-03-06 Thread Stanislav Malyshev
stas Wed, 07 Mar 2012 07:38:57 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323985

Log:
MFH: Fixed bug #61173 (Unable to detect error from finfo constructor).

Bug: https://bugs.php.net/61173 (Assigned) Unable to detect error from finfo 
constructor
  
Changed paths:
U   php/php-src/branches/PHP_5_4/ext/fileinfo/fileinfo.c
A   php/php-src/branches/PHP_5_4/ext/fileinfo/tests/bug61173.phpt

Modified: php/php-src/branches/PHP_5_4/ext/fileinfo/fileinfo.c
===
--- php/php-src/branches/PHP_5_4/ext/fileinfo/fileinfo.c2012-03-07 
06:36:46 UTC (rev 323984)
+++ php/php-src/branches/PHP_5_4/ext/fileinfo/fileinfo.c2012-03-07 
07:38:57 UTC (rev 323985)
@@ -76,9 +76,9 @@
} \
 }

-/* {{{ finfo_objects_dtor
+/* {{{ finfo_objects_free
  */
-static void finfo_objects_dtor(void *object, zend_object_handle handle 
TSRMLS_DC)
+static void finfo_objects_free(void *object TSRMLS_DC)
 {
struct finfo_object *intern = (struct finfo_object *) object;

@@ -107,7 +107,8 @@

intern-ptr = NULL;

-   retval.handle = zend_objects_store_put(intern, finfo_objects_dtor, 
NULL, NULL TSRMLS_CC);
+   retval.handle = zend_objects_store_put(intern, NULL,
+   finfo_objects_free, NULL TSRMLS_CC);
retval.handlers = (zend_object_handlers *) finfo_object_handlers;

return retval;
@@ -275,6 +276,15 @@
 }
 /* }}} */

+#define FILEINFO_DESTROY_OBJECT(object)
\
+   do {
\
+   if (object) {   
\
+   zend_object_store_ctor_failed(object TSRMLS_CC);
\
+   zval_dtor(object);  
\
+   ZVAL_NULL(object);  
\
+   }   
\
+   } while (0)
+
 /* {{{ proto resource finfo_open([int options [, string arg]])
Create a new fileinfo resource. */
 PHP_FUNCTION(finfo_open)
@@ -287,12 +297,13 @@
char resolved_path[MAXPATHLEN];

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |lp, options, 
file, file_len) == FAILURE) {
+   FILEINFO_DESTROY_OBJECT(object);
RETURN_FALSE;
}
-
+
if (object) {
struct finfo_object *finfo_obj = (struct 
finfo_object*)zend_object_store_get_object(object TSRMLS_CC);
-
+
if (finfo_obj-ptr) {
magic_close(finfo_obj-ptr-magic);
efree(finfo_obj-ptr);
@@ -309,9 +320,11 @@
 #else
if (php_check_open_basedir(file TSRMLS_CC)) {
 #endif
+   FILEINFO_DESTROY_OBJECT(object);
RETURN_FALSE;
}
if (!expand_filepath_with_mode(file, resolved_path, NULL, 0, 
CWD_EXPAND TSRMLS_CC)) {
+   FILEINFO_DESTROY_OBJECT(object);
RETURN_FALSE;
}
file = resolved_path;
@@ -325,21 +338,23 @@
if (finfo-magic == NULL) {
efree(finfo);
php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid mode 
'%ld'., options);
-   RETURN_FALSE;
+   FILEINFO_DESTROY_OBJECT(object);
+   RETURN_FALSE;
}

if (magic_load(finfo-magic, file) == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed to load 
magic database at '%s'., file);
magic_close(finfo-magic);
efree(finfo);
+   FILEINFO_DESTROY_OBJECT(object);
RETURN_FALSE;
-   }
+   }

if (object) {
FILEINFO_REGISTER_OBJECT(object, finfo);
} else {
ZEND_REGISTER_RESOURCE(return_value, finfo, le_fileinfo);
-   }
+   }
 }
 /* }}} */


Added: php/php-src/branches/PHP_5_4/ext/fileinfo/tests/bug61173.phpt
===
--- php/php-src/branches/PHP_5_4/ext/fileinfo/tests/bug61173.phpt   
(rev 0)
+++ php/php-src/branches/PHP_5_4/ext/fileinfo/tests/bug61173.phpt   
2012-03-07 07:38:57 UTC (rev 323985)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #61173: Unable to detect error from finfo constructor
+--SKIPIF--
+?php
+if (!class_exists('finfo'))
+   die('skip no fileinfo extension');
+--FILE--
+?php
+
+$finfo = new finfo(1, '', false);
+var_dump($finfo);
+--EXPECTF--
+Warning: finfo::finfo() expects at most 2 parameters, 3 given in %s on line %d
+NULL

-- 
PHP CVS 

[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ ext/standard/tests/general_functions/bug60227.phpt ext/standard/tests/general_functions/bug60227_1.phpt ext/standard/tests/general_functions/bug60227_2.ph

2012-03-06 Thread Stanislav Malyshev
stas Wed, 07 Mar 2012 07:49:56 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323986

Log:
MFH: Headers: forbid \r and \n also after \0, allow CRLF followed by HT or SP 
and forbid \0. See bug #60227.

Bug: https://bugs.php.net/60227 (Closed) header() cannot detect the multi-line 
header with CR(0x0D).
  
Changed paths:
D   
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227.phpt
A   
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_1.phpt
A   
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_2.phpt
A   
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_3.phpt
A   
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_4.phpt
U   php/php-src/branches/PHP_5_4/main/SAPI.c

Deleted: 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227.phpt
===
--- 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227.phpt 
2012-03-07 07:38:57 UTC (rev 323985)
+++ 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227.phpt 
2012-03-07 07:49:56 UTC (rev 323986)
@@ -1,20 +0,0 @@
---TEST--
-Bug #60227 (header() cannot detect the multi-line header with CR)
---FILE--
-?php
-header(X-Foo1: a);
-header(X-Foo2: b\n );
-header(X-Foo3: c\r\n );
-header(X-Foo4: d\r );
-header(X-Foo5: e\rSet-Cookie: ID=123);
-echo 'foo';
-?
---EXPECTF--
-Warning: Header may not contain more than a single header, new line detected. 
in %s on line %d
-foo
---EXPECTHEADERS--
-X-Foo1: a
-X-Foo2: b
-X-Foo3: c
-X-Foo4: d
-

Added: 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_1.phpt
===
--- 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_1.phpt
   (rev 0)
+++ 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_1.phpt
   2012-03-07 07:49:56 UTC (rev 323986)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR)
+--FILE--
+?php
+header(X-Foo1: a);
+header(X-Foo2: b\n );
+header(X-Foo3: c\r\n );
+header(X-Foo4: d\r );
+header(X-Foo5: e\rSet-Cookie: ID=123);
+echo 'foo';
+?
+--EXPECTF--
+Warning: Header may not contain more than a single header, new line detected 
in %s on line %d
+foo
+--EXPECTHEADERS--
+X-Foo1: a
+X-Foo2: b
+X-Foo3: c
+X-Foo4: d
+

Added: 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_2.phpt
===
--- 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_2.phpt
   (rev 0)
+++ 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_2.phpt
   2012-03-07 07:49:56 UTC (rev 323986)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR), \r before \n
+--FILE--
+?php
+header(X-foo: e\n foo);
+header(X-Foo6: e\rSet-Cookie: ID=123\n d);
+echo 'foo';
+?
+--EXPECTF--
+Warning: Header may not contain more than a single header, new line detected 
in %s on line %d
+foo
+--EXPECTHEADERS--
+X-foo: e
+foo

Added: 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_3.phpt
===
--- 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_3.phpt
   (rev 0)
+++ 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_3.phpt
   2012-03-07 07:49:56 UTC (rev 323986)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR), \0 before \n
+--FILE--
+?php
+header(X-foo: e\n foo);
+header(X-Foo6: e\0Set-Cookie: ID=\n123\n d);
+echo 'foo';
+?
+--EXPECTF--
+Warning: Header may not contain NUL bytes in %s on line %d
+foo
+--EXPECTHEADERS--
+X-foo: e
+foo

Added: 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_4.phpt
===
--- 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_4.phpt
   (rev 0)
+++ 
php/php-src/branches/PHP_5_4/ext/standard/tests/general_functions/bug60227_4.phpt
   2012-03-07 07:49:56 UTC (rev 323986)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR), CRLF
+--FILE--
+?php
+header(X-foo: e\r\n foo);
+header(X-foo: e\r\nfoo);
+echo 'foo';
+?
+--EXPECTF--
+Warning: Header may not contain more than a single header, new line detected 
in %s on line %d
+foo
+--EXPECTHEADERS--
+X-foo: e
+ foo

Modified: php/php-src/branches/PHP_5_4/main/SAPI.c
===
--- php/php-src/branches/PHP_5_4/main/SAPI.c2012-03-07 

[PHP-CVS] [git] karma.git branch PHP_POST_RECEIVE updated. c7163b2

2012-03-06 Thread irker
The branch, PHP_POST_RECEIVE on karma.git has been updated
   via  c7163b23683f8656f913ff4d22706ca5a5f41380 (commit)
  from  67c322fe22b0cb6f561711a4041325974b9bfc31 (commit)

http://git.php.net/?p=karma.git;a=log;h=c7163b23683f8656f913ff4d22706ca5a5f41380;hp=67c322fe22b0cb6f561711a4041325974b9bfc31

Summary of changes:
 README.POST_RECEIVE |6 ++
 lib/Git/PostReceiveHook.php |   26 --
 2 files changed, 18 insertions(+), 14 deletions(-)

-- Log 
commit c7163b23683f8656f913ff4d22706ca5a5f41380
Author: Alexander Moskaliov ir...@php.net
Date:   Wed Mar 7 11:49:54 2012 +0400

Add info about force push

diff --git a/README.POST_RECEIVE b/README.POST_RECEIVE
index 90a9f59..fe0a666 100644
--- a/README.POST_RECEIVE
+++ b/README.POST_RECEIVE
@@ -63,10 +63,8 @@ This part contains info only about mail per branch. For mail 
per commit logic di
 It's mean user used --force option for pull and remove previosly revisions.
 (rewind N revision in first case and replace 5-O revisions by 4-N)
 We can check it by command: git rev-list N..O.
-If result of this command not empty - we have such cases.
-If result of git merge-base O N will be equal N  - we have first case.
-We send mail with info about rewind or replace.
-(Realization of this case in progress)
+If result of this command not empty - we have such cases, and this
+result is list of discarded revisions.
 
 
 
diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php
index 49e5499..c34a55b 100644
--- a/lib/Git/PostReceiveHook.php
+++ b/lib/Git/PostReceiveHook.php
@@ -49,14 +49,13 @@ class PostReceiveHook extends ReceiveHook
 foreach ($this-refs as $ref) {
 if ($ref['reftype'] == self::REF_TAG) {
 $this-sendTagMail($ref);
-} else {
+} elseif ($ref['reftype'] == self::REF_BRANCH){
 $this-sendBranchMail($ref);
 }
 }
 
 // TODO: For new branches we must check if this branch was
 // cloned from other branch in this push - it's especial case
-// TODO: check old post-receive for other especial cases
 
 foreach ($this-revisions as $revision = $branches) {
 // check if it commit was already in other branches
@@ -82,10 +81,15 @@ class PostReceiveHook extends ReceiveHook
 
 if ($branch['changetype'] != self::TYPE_DELETED) {
 
-// TODO: cache revisions to $this-revisions
 if ($branch['changetype'] == self::TYPE_UPDATED) {
+// check if push was with --forced option
+if ($replacedRevisions = $this-getRevisions($branch['new'] . 
'..' . $branch['old'])) {
+$message .= Discarded revisions: \n . implode(\n, 
$replacedRevisions) . \n;
+}
+
 // git rev-list old..new
 $revisions = $this-getRevisions($branch['old'] . '..' . 
$branch['new']);
+
 } else {
 // for new branch we write log about new commits only
 $revisions = $this-getRevisions($branch['new']. ' --not ' . 
implode(' ', $this-allBranches));
@@ -93,14 +97,16 @@ class PostReceiveHook extends ReceiveHook
 
 $this-cacheRevisions($branch['refname'], $revisions);
 
-$message .= LOG\n;
-foreach ($revisions as $revision) {
-$diff = $this-execute(
-'git diff-tree --stat --pretty=medium -c %s',
-$revision
-);
+if (count($revisions)) {
+$message .= LOG\n;
+foreach ($revisions as $revision) {
+$diff = $this-execute(
+'git diff-tree --stat --pretty=medium -c %s',
+$revision
+);
 
-$message .= $diff.\n\n;
+$message .= $diff.\n\n;
+}
 }
 }
 

Thank you for your contribution.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php