Page MenuHomePhabricator

D20596.id49129.diff
No OneTemporary

D20596.id49129.diff

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

Mime Type
text/plain
Expires
Sat, May 18, 9:57 AM (4 w, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6277666
Default Alt Text
D20596.id49129.diff (3 KB)

Event Timeline