From b8d372c4bc3e600777756b497815aef87a4fb92b Mon Sep 17 00:00:00 2001 From: Nick Harper Date: Wed, 19 Dec 2012 10:53:04 -0800 Subject: [PATCH] Fix bugs when saving package changes due to commit changes Summary: Because of the way PhabricatorOwnersPackage works, the code to save package changes when parsing commit changes was raising a few undefined index errors, and was throwing an exception trying to call a method on null (because not all of the phids related to the package had their handles loaded). This fix doesn't load the missing handles, it just avoids trying to use them. Test Plan: ./scripts/repository/reparse.php on a commit with path changes that triggered a package change Reviewers: epriestley, vrana Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4236 --- src/applications/owners/storage/PhabricatorOwnersPackage.php | 2 +- .../PhabricatorOwnersPackagePathValidator.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/applications/owners/storage/PhabricatorOwnersPackage.php b/src/applications/owners/storage/PhabricatorOwnersPackage.php index e5577ace7f..24b21b68f8 100644 --- a/src/applications/owners/storage/PhabricatorOwnersPackage.php +++ b/src/applications/owners/storage/PhabricatorOwnersPackage.php @@ -268,7 +268,7 @@ final class PhabricatorOwnersPackage extends PhabricatorOwnersDAO $path->getPath(), array())); $excluded = $path->getExcluded(); - if (!$new_path || $new_path['excluded'] != $excluded) { + if (!$new_path || idx($new_path, 'excluded') != $excluded) { $touched_repos[$repository_phid] = true; $remove_paths[$repository_phid][$path->getPath()] = $excluded; $path->delete(); diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php b/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php index 8e36a075db..80a8a33396 100644 --- a/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php +++ b/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php @@ -91,6 +91,7 @@ final class PhabricatorOwnersPackagePathValidator { } if ($new_paths) { + $package->attachOldPrimaryOwnerPHID($package->getPrimaryOwnerPHID()); $package->attachUnsavedPaths($new_paths); $package->save(); // save the changes and notify the owners. }