Page MenuHomePhabricator

D8724.diff
No OneTemporary

D8724.diff

diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php
--- a/src/applications/herald/adapter/HeraldAdapter.php
+++ b/src/applications/herald/adapter/HeraldAdapter.php
@@ -544,9 +544,9 @@
}
return $result;
case self::CONDITION_HAS_BIT:
- return (($condition_value & $field_value) === $condition_value);
+ return (($condition_value & $field_value) === (int) $condition_value);
case self::CONDITION_NOT_BIT:
- return (($condition_value & $field_value) !== $condition_value);
+ return (($condition_value & $field_value) !== (int) $condition_value);
default:
throw new HeraldInvalidConditionException(
"Unknown condition '{$condition_type}'.");
@@ -1039,6 +1039,16 @@
}
}
break;
+ case HeraldPreCommitRefAdapter::FIELD_REF_CHANGE:
+ $change_map =
+ PhabricatorRepositoryPushLog::getHeraldChangeflagConditionOptions();
+ foreach ($value as $index => $val) {
+ $name = idx($change_map, $val);
+ if ($name) {
+ $value[$index] = $name;
+ }
+ }
+ break;
default:
foreach ($value as $index => $val) {
$handle = idx($handles, $val);
diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php
--- a/src/applications/herald/controller/HeraldRuleController.php
+++ b/src/applications/herald/controller/HeraldRuleController.php
@@ -463,6 +463,8 @@
$rule->getRuleType());
}
+ $changeflag_options =
+ PhabricatorRepositoryPushLog::getHeraldChangeflagConditionOptions();
Javelin::initBehavior(
'herald-rule-editor',
array(
@@ -490,16 +492,7 @@
'default' => PhabricatorRepositoryPushLog::REFTYPE_BRANCH,
),
HeraldPreCommitRefAdapter::VALUE_REF_CHANGE => array(
- 'options' => array(
- PhabricatorRepositoryPushLog::CHANGEFLAG_ADD =>
- pht('change creates ref'),
- PhabricatorRepositoryPushLog::CHANGEFLAG_DELETE =>
- pht('change deletes ref'),
- PhabricatorRepositoryPushLog::CHANGEFLAG_REWRITE =>
- pht('change rewrites ref'),
- PhabricatorRepositoryPushLog::CHANGEFLAG_DANGEROUS =>
- pht('dangerous change'),
- ),
+ 'options' => $changeflag_options,
'default' => PhabricatorRepositoryPushLog::CHANGEFLAG_ADD,
),
),
diff --git a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php
--- a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php
@@ -52,6 +52,18 @@
->setPusherPHID($viewer->getPHID());
}
+ public static function getHeraldChangeflagConditionOptions() {
+ return array(
+ PhabricatorRepositoryPushLog::CHANGEFLAG_ADD =>
+ pht('change creates ref'),
+ PhabricatorRepositoryPushLog::CHANGEFLAG_DELETE =>
+ pht('change deletes ref'),
+ PhabricatorRepositoryPushLog::CHANGEFLAG_REWRITE =>
+ pht('change rewrites ref'),
+ PhabricatorRepositoryPushLog::CHANGEFLAG_DANGEROUS =>
+ pht('dangerous change'));
+ }
+
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 9:42 AM (20 h, 27 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6910095
Default Alt Text
D8724.diff (3 KB)

Event Timeline