Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15282520
D20596.id49129.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D20596.id49129.diff
View Options
diff --git a/src/applications/owners/storage/PhabricatorOwnersPath.php b/src/applications/owners/storage/PhabricatorOwnersPath.php
--- a/src/applications/owners/storage/PhabricatorOwnersPath.php
+++ b/src/applications/owners/storage/PhabricatorOwnersPath.php
@@ -79,15 +79,27 @@
public static function getSetFromTransactionValue(array $v) {
$set = array();
foreach ($v as $ref) {
- $set[$ref['repositoryPHID']][$ref['path']][$ref['excluded']] = true;
+ $key = self::getScalarKeyForRef($ref);
+ $set[$key] = true;
}
return $set;
}
public static function isRefInSet(array $ref, array $set) {
- return isset($set[$ref['repositoryPHID']][$ref['path']][$ref['excluded']]);
+ $key = self::getScalarKeyForRef($ref);
+ return isset($set[$key]);
}
+ private static function getScalarKeyForRef(array $ref) {
+ return sprintf(
+ 'repository=%s path=%s display=%s excluded=%d',
+ $ref['repositoryPHID'],
+ $ref['path'],
+ $ref['display'],
+ $ref['excluded']);
+ }
+
+
/**
* Get the number of directory matches between this path specification and
* some real path.
diff --git a/src/applications/owners/xaction/PhabricatorOwnersPackagePathsTransaction.php b/src/applications/owners/xaction/PhabricatorOwnersPackagePathsTransaction.php
--- a/src/applications/owners/xaction/PhabricatorOwnersPackagePathsTransaction.php
+++ b/src/applications/owners/xaction/PhabricatorOwnersPackagePathsTransaction.php
@@ -12,12 +12,33 @@
public function generateNewValue($object, $value) {
$new = $value;
+
foreach ($new as $key => $info) {
- $new[$key]['excluded'] = (int)idx($info, 'excluded');
+ $info['excluded'] = (int)idx($info, 'excluded');
+
+ // The input has one "path" key with the display path.
+ // Move it to "display", then normalize the value in "path".
+
+ $display_path = $info['path'];
+ $raw_path = rtrim($display_path, '/').'/';
+
+ $info['path'] = $raw_path;
+ $info['display'] = $display_path;
+
+ $new[$key] = $info;
}
+
return $new;
}
+ public function getTransactionHasEffect($object, $old, $new) {
+ list($add, $rem) = PhabricatorOwnersPath::getTransactionValueChanges(
+ $old,
+ $new);
+
+ return ($add || $rem);
+ }
+
public function validateTransactions($object, array $xactions) {
$errors = array();
@@ -110,8 +131,8 @@
$display_map = array();
$seen_map = array();
foreach ($new as $key => $spec) {
- $display_path = $spec['path'];
- $raw_path = rtrim($display_path, '/').'/';
+ $raw_path = $spec['path'];
+ $display_path = $spec['display'];
// If the user entered two paths in the same repository which normalize
// to the same value (like "src/main.c" and "src/main.c/"), discard the
@@ -193,11 +214,18 @@
$rowc = array();
foreach ($rows as $key => $row) {
$rowc[] = $row['class'];
+
+ if (array_key_exists('display', $row)) {
+ $display_path = $row['display'];
+ } else {
+ $display_path = $row['path'];
+ }
+
$rows[$key] = array(
$row['change'],
$row['excluded'] ? pht('Exclude') : pht('Include'),
$this->renderHandle($row['repositoryPHID']),
- $row['path'],
+ $display_path,
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 5, 12:18 AM (19 h, 21 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223163
Default Alt Text
D20596.id49129.diff (3 KB)
Attached To
Mode
D20596: Fix an issue in Owners where a transaction change could show too many effects
Attached
Detach File
Event Timeline
Log In to Comment