Helper methods for getting the number of added and deleted lines on a patchset withou...
authorChuck Hagenbuch <chuck@horde.org>
Wed, 24 Nov 2010 15:32:49 +0000 (10:32 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Wed, 24 Nov 2010 15:32:49 +0000 (10:32 -0500)
framework/Vcs/lib/Horde/Vcs/Log.php

index 6645db7..1390701 100644 (file)
@@ -152,4 +152,28 @@ abstract class Horde_Vcs_Log
             ? $this->_files
             : (isset($this->_files[$file]) ? $this->_files[$file] : array());
     }
+
+    public function getAddedLines()
+    {
+        $this->_ensureInitialized();
+        $lines = 0;
+        foreach ($this->_files as $file) {
+            if (isset($file['added'])) {
+                $lines += $file['added'];
+            }
+        }
+        return $lines;
+    }
+
+    public function getDeletedLines()
+    {
+        $this->_ensureInitialized();
+        $lines = 0;
+        foreach ($this->_files as $file) {
+            if (isset($file['deleted'])) {
+                $lines += $file['deleted'];
+            }
+        }
+        return $lines;
+    }
 }