From fb4a2239e9482ef347828be7e775fe8b538de75a Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Sun, 14 Jun 2009 00:39:06 -0400 Subject: [PATCH] use less CVS-ish constant names, and use a constant for modified instead of hardcoding 0 --- chora/patchsets.php | 4 ++-- framework/Vcs/lib/Horde/Vcs.php | 5 +++-- framework/Vcs/lib/Horde/Vcs/Cvs.php | 6 +++--- framework/Vcs/lib/Horde/Vcs/Git.php | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/chora/patchsets.php b/chora/patchsets.php index e880a6146..3dfea65e2 100644 --- a/chora/patchsets.php +++ b/chora/patchsets.php @@ -67,7 +67,7 @@ while (list($id, $patchset) = each($patchsets)) { $file['file'] = Horde::link(Chora::url('patchsets', $member['file'])) . htmlspecialchars($member['file']) . ''; - if ($member['status'] == Horde_Vcs_Patchset::INITIAL) { + if ($member['status'] == Horde_Vcs_Patchset::ADDED) { $file['from'] = '' . _("New File") . ''; $file['diff'] = ''; } else { @@ -75,7 +75,7 @@ while (list($id, $patchset) = each($patchsets)) { $file['diff'] = Horde::link(Chora::url('diff', $member['file'], array('r1' => $member['from'], 'r2' => $member['to']))) . ' ' . $diff_img . ''; } - if ($member['status'] == Horde_Vcs_Patchset::DEAD) { + if ($member['status'] == Horde_Vcs_Patchset::DELETED) { $file['to'] = '' . _("Deleted") . ''; $file['diff'] = ''; } else { diff --git a/framework/Vcs/lib/Horde/Vcs.php b/framework/Vcs/lib/Horde/Vcs.php index 24d3b64c5..c0de842e9 100644 --- a/framework/Vcs/lib/Horde/Vcs.php +++ b/framework/Vcs/lib/Horde/Vcs.php @@ -1164,8 +1164,9 @@ abstract class Horde_Vcs_Log */ abstract class Horde_Vcs_Patchset { - const INITIAL = 1; - const DEAD = 2; + const MODIFIED = 0; + const ADDED = 1; + const DELETED = 2; /** * @var array diff --git a/framework/Vcs/lib/Horde/Vcs/Cvs.php b/framework/Vcs/lib/Horde/Vcs/Cvs.php index 3ead7a116..33ff5a06f 100644 --- a/framework/Vcs/lib/Horde/Vcs/Cvs.php +++ b/framework/Vcs/lib/Horde/Vcs/Cvs.php @@ -797,14 +797,14 @@ class Horde_Vcs_Patchset_Cvs extends Horde_Vcs_Patchset if (!empty($line)) { $parts = explode(':', $line); list($from, $to) = explode('->', $parts[1], 2); - $status = 0; + $status = self::MODIFIED; if ($from == 'INITIAL') { $from = null; - $status = self::INITIAL; + $status = self::ADDED; } elseif (substr($to, -6) == '(DEAD)') { $to = null; - $status = self::DEAD; + $status = self::DELETED; } $this->_patchsets[$id]['members'][] = array( diff --git a/framework/Vcs/lib/Horde/Vcs/Git.php b/framework/Vcs/lib/Horde/Vcs/Git.php index fafccdcfb..3721f26fd 100644 --- a/framework/Vcs/lib/Horde/Vcs/Git.php +++ b/framework/Vcs/lib/Horde/Vcs/Git.php @@ -766,18 +766,18 @@ class Horde_Vcs_Patchset_Git extends Horde_Vcs_Patchset foreach ($log->queryFiles() as $file) { $to = $rev; - $status = 0; + $status = self::MODIFIED; switch ($file['status']) { case 'A': $from = null; - $status = self::INITIAL; + $status = self::ADDED; break; case 'D': $from = $to; $to = null; - $status = self::DEAD; + $status = self::DELETED; break; default: -- 2.11.0