| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* | 
					
						
							| 
									
										
										
										
											2012-01-09 11:42:37 -08:00
										 |  |  |  * Copyright 2012 Facebook, Inc. | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
					
						
							|  |  |  |  * you may not use this file except in compliance with the License. | 
					
						
							|  |  |  |  * You may obtain a copy of the License at | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *   http://www.apache.org/licenses/LICENSE-2.0 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  |  * distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  |  * See the License for the specific language governing permissions and | 
					
						
							|  |  |  |  * limitations under the License. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-13 11:18:11 -07:00
										 |  |  | final class DifferentialDiff extends DifferentialDAO { | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   protected $revisionID; | 
					
						
							| 
									
										
										
										
											2011-01-30 10:37:36 -08:00
										 |  |  |   protected $authorPHID; | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   protected $sourceMachine; | 
					
						
							|  |  |  |   protected $sourcePath; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   protected $sourceControlSystem; | 
					
						
							|  |  |  |   protected $sourceControlBaseRevision; | 
					
						
							|  |  |  |   protected $sourceControlPath; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   protected $lintStatus; | 
					
						
							|  |  |  |   protected $unitStatus; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   protected $lineCount; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   protected $branch; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   protected $parentRevisionID; | 
					
						
							| 
									
										
										
										
											2011-04-05 20:49:31 -07:00
										 |  |  |   protected $arcanistProjectPHID; | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |   protected $creationMethod; | 
					
						
							| 
									
										
										
										
											2011-04-05 20:49:31 -07:00
										 |  |  |   protected $repositoryUUID; | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-04 17:53:14 -08:00
										 |  |  |   protected $description; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-24 11:36:53 -08:00
										 |  |  |   private $unsavedChangesets = array(); | 
					
						
							| 
									
										
										
										
											2011-01-24 15:52:35 -08:00
										 |  |  |   private $changesets; | 
					
						
							| 
									
										
										
										
											2011-01-24 11:36:53 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   public function addUnsavedChangeset(DifferentialChangeset $changeset) { | 
					
						
							| 
									
										
										
										
											2011-01-24 15:52:35 -08:00
										 |  |  |     if ($this->changesets === null) { | 
					
						
							|  |  |  |       $this->changesets = array(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-01-24 11:36:53 -08:00
										 |  |  |     $this->unsavedChangesets[] = $changeset; | 
					
						
							| 
									
										
										
										
											2011-01-24 15:52:35 -08:00
										 |  |  |     $this->changesets[] = $changeset; | 
					
						
							|  |  |  |     return $this; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   public function attachChangesets(array $changesets) { | 
					
						
							| 
									
										
										
										
											2012-04-04 13:13:08 -07:00
										 |  |  |     assert_instances_of($changesets, 'DifferentialChangeset'); | 
					
						
							| 
									
										
										
										
											2011-01-24 15:52:35 -08:00
										 |  |  |     $this->changesets = $changesets; | 
					
						
							| 
									
										
										
										
											2011-01-24 11:36:53 -08:00
										 |  |  |     return $this; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-24 15:52:35 -08:00
										 |  |  |   public function getChangesets() { | 
					
						
							|  |  |  |     if ($this->changesets === null) { | 
					
						
							|  |  |  |       throw new Exception("Must load and attach changesets first!"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return $this->changesets; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |   public function loadChangesets() { | 
					
						
							|  |  |  |     if (!$this->getID()) { | 
					
						
							|  |  |  |       return array(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return id(new DifferentialChangeset())->loadAllWhere( | 
					
						
							|  |  |  |       'diffID = %d', | 
					
						
							|  |  |  |       $this->getID()); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-14 10:59:52 -07:00
										 |  |  |   public function loadArcanistProject() { | 
					
						
							|  |  |  |     if (!$this->getArcanistProjectPHID()) { | 
					
						
							|  |  |  |       return null; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return id(new PhabricatorRepositoryArcanistProject())->loadOneWhere( | 
					
						
							|  |  |  |       'phid = %s', | 
					
						
							|  |  |  |       $this->getArcanistProjectPHID()); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-01 11:30:02 -07:00
										 |  |  |   public function getBackingVersionControlSystem() { | 
					
						
							| 
									
										
										
										
											2012-05-02 17:18:42 -07:00
										 |  |  |     $arcanist_project = $this->loadArcanistProject(); | 
					
						
							|  |  |  |     if (!$arcanist_project) { | 
					
						
							|  |  |  |       return null; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     $repository = $arcanist_project->loadRepository(); | 
					
						
							| 
									
										
										
										
											2012-05-02 17:26:09 -07:00
										 |  |  |     if (!$repository) { | 
					
						
							|  |  |  |       return null; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-05-01 11:30:02 -07:00
										 |  |  |     return $repository->getVersionControlSystem(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-24 11:36:53 -08:00
										 |  |  |   public function save() { | 
					
						
							|  |  |  | // TODO: sort out transactions
 | 
					
						
							|  |  |  | //    $this->openTransaction();
 | 
					
						
							|  |  |  |       $ret = parent::save(); | 
					
						
							|  |  |  |       foreach ($this->unsavedChangesets as $changeset) { | 
					
						
							| 
									
										
										
										
											2011-01-24 12:07:34 -08:00
										 |  |  |         $changeset->setDiffID($this->getID()); | 
					
						
							|  |  |  |         $changeset->save(); | 
					
						
							| 
									
										
										
										
											2011-01-24 11:36:53 -08:00
										 |  |  |       } | 
					
						
							|  |  |  | //    $this->saveTransaction();
 | 
					
						
							|  |  |  |     return $ret; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |   public function delete() { | 
					
						
							| 
									
										
										
										
											2011-01-24 11:36:53 -08:00
										 |  |  | //    $this->openTransaction();
 | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |       foreach ($this->loadChangesets() as $changeset) { | 
					
						
							|  |  |  |         $changeset->delete(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       $ret = parent::delete(); | 
					
						
							| 
									
										
										
										
											2011-01-24 11:36:53 -08:00
										 |  |  | //    $this->saveTransaction();
 | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |     return $ret; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   public static function newFromRawChanges(array $changes) { | 
					
						
							| 
									
										
										
										
											2012-04-04 13:13:08 -07:00
										 |  |  |     assert_instances_of($changes, 'ArcanistDiffChange'); | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |     $diff = new DifferentialDiff(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $lines = 0; | 
					
						
							|  |  |  |     foreach ($changes as $change) { | 
					
						
							|  |  |  |       $changeset = new DifferentialChangeset(); | 
					
						
							|  |  |  |       $add_lines = 0; | 
					
						
							|  |  |  |       $del_lines = 0; | 
					
						
							| 
									
										
										
											
												Allow DifferentialDiff to construct proper DifferentialChangeset objects from
diffs which add empty files
Summary:
See T507 and some others. We now parse empty git diffs correctly, but the logic
to build DifferentialDiffs out of them leaves the objects with 'null' for
$changesets, when it should be array().
Further layers later throw, believing we have not loaded the changesets, when we
actually have, there just aren't any.
Test Plan: Viewed rJX05d493e17fbbb29f29e4880be6834d1d7415374e in Diffusion,
which adds an empty README file. No exception thrown.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: nh
CC: aran, nh
Differential Revision: 1038
											
										 
											2011-10-23 14:33:53 -07:00
										 |  |  |       $hunks = $change->getHunks(); | 
					
						
							|  |  |  |       if ($hunks) { | 
					
						
							|  |  |  |         foreach ($hunks as $hunk) { | 
					
						
							|  |  |  |           $dhunk = new DifferentialHunk(); | 
					
						
							|  |  |  |           $dhunk->setOldOffset($hunk->getOldOffset()); | 
					
						
							|  |  |  |           $dhunk->setOldLen($hunk->getOldLength()); | 
					
						
							|  |  |  |           $dhunk->setNewOffset($hunk->getNewOffset()); | 
					
						
							|  |  |  |           $dhunk->setNewLen($hunk->getNewLength()); | 
					
						
							|  |  |  |           $dhunk->setChanges($hunk->getCorpus()); | 
					
						
							|  |  |  |           $changeset->addUnsavedHunk($dhunk); | 
					
						
							|  |  |  |           $add_lines += $hunk->getAddLines(); | 
					
						
							|  |  |  |           $del_lines += $hunk->getDelLines(); | 
					
						
							|  |  |  |           $lines += $add_lines + $del_lines; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         // This happens when you add empty files.
 | 
					
						
							|  |  |  |         $changeset->attachHunks(array()); | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       $changeset->setOldFile($change->getOldPath()); | 
					
						
							|  |  |  |       $changeset->setFilename($change->getCurrentPath()); | 
					
						
							|  |  |  |       $changeset->setChangeType($change->getType()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       $changeset->setFileType($change->getFileType()); | 
					
						
							|  |  |  |       $changeset->setMetadata($change->getAllMetadata()); | 
					
						
							|  |  |  |       $changeset->setOldProperties($change->getOldProperties()); | 
					
						
							|  |  |  |       $changeset->setNewProperties($change->getNewProperties()); | 
					
						
							|  |  |  |       $changeset->setAwayPaths($change->getAwayPaths()); | 
					
						
							|  |  |  |       $changeset->setAddLines($add_lines); | 
					
						
							|  |  |  |       $changeset->setDelLines($del_lines); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-24 11:36:53 -08:00
										 |  |  |       $diff->addUnsavedChangeset($changeset); | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |     } | 
					
						
							|  |  |  |     $diff->setLineCount($lines); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |     $diff->detectCopiedCode(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  |     return $diff; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-30 16:40:57 -07:00
										 |  |  |   public function detectCopiedCode($min_width = 30, $min_lines = 3) { | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |     $map = array(); | 
					
						
							|  |  |  |     $files = array(); | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |     $types = array(); | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |     foreach ($this->changesets as $changeset) { | 
					
						
							|  |  |  |       $file = $changeset->getFilename(); | 
					
						
							|  |  |  |       foreach ($changeset->getHunks() as $hunk) { | 
					
						
							|  |  |  |         $line = $hunk->getOldOffset(); | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |         foreach (explode("\n", $hunk->getChanges()) as $code) { | 
					
						
							|  |  |  |           $type = (isset($code[0]) ? $code[0] : ''); | 
					
						
							|  |  |  |           if ($type == '-' || $type == ' ') { | 
					
						
							| 
									
										
										
										
											2012-04-30 16:40:57 -07:00
										 |  |  |             $code = trim(substr($code, 1)); | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |             $files[$file][$line] = $code; | 
					
						
							|  |  |  |             $types[$file][$line] = $type; | 
					
						
							|  |  |  |             if (strlen($code) >= $min_width) { | 
					
						
							|  |  |  |               $map[$code][] = array($file, $line); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             $line++; | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     foreach ($this->changesets as $changeset) { | 
					
						
							|  |  |  |       $copies = array(); | 
					
						
							|  |  |  |       foreach ($changeset->getHunks() as $hunk) { | 
					
						
							| 
									
										
										
										
											2012-04-30 16:40:57 -07:00
										 |  |  |         $added = array_map('trim', $hunk->getAddedLines()); | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |         for (reset($added); list($line, $code) = each($added); next($added)) { | 
					
						
							|  |  |  |           if (isset($map[$code])) { // We found a long matching line.
 | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |             $best_length = 0; | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |             foreach ($map[$code] as $val) { // Explore all candidates.
 | 
					
						
							|  |  |  |               list($file, $orig_line) = $val; | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |               $length = 1; | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |               // Search also backwards for short lines.
 | 
					
						
							|  |  |  |               foreach (array(-1, 1) as $direction) { | 
					
						
							|  |  |  |                 $offset = $direction; | 
					
						
							|  |  |  |                 while (!isset($copies[$line + $offset]) && | 
					
						
							|  |  |  |                     isset($added[$line + $offset]) && | 
					
						
							| 
									
										
										
										
											2012-04-28 22:55:14 -07:00
										 |  |  |                     idx($files[$file], $orig_line + $offset) === | 
					
						
							|  |  |  |                       $added[$line + $offset]) { | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |                   $length++; | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |                   $offset += $direction; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |               } | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |               if ($length > $best_length || | 
					
						
							|  |  |  |                   ($length == $best_length && // Prefer moves.
 | 
					
						
							|  |  |  |                    idx($types[$file], $orig_line) == '-')) { | 
					
						
							|  |  |  |                 $best_length = $length; | 
					
						
							|  |  |  |                 // ($offset - 1) contains number of forward matching lines.
 | 
					
						
							|  |  |  |                 $best_offset = $offset - 1; | 
					
						
							|  |  |  |                 $best_file = $file; | 
					
						
							|  |  |  |                 $best_line = $orig_line; | 
					
						
							|  |  |  |               } | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |             $file = ($best_file == $changeset->getFilename() ? '' : $best_file); | 
					
						
							|  |  |  |             for ($i = $best_length; $i--; ) { | 
					
						
							|  |  |  |               $type = idx($types[$best_file], $best_line + $best_offset - $i); | 
					
						
							|  |  |  |               $copies[$line + $best_offset - $i] = ($best_length < $min_lines | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |                 ? array() // Ignore short blocks.
 | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |                 : array($file, $best_line + $best_offset - $i, $type)); | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2012-04-29 21:35:43 -07:00
										 |  |  |             for ($i = 0; $i < $best_offset; $i++) { | 
					
						
							| 
									
										
										
										
											2012-04-27 23:00:30 -07:00
										 |  |  |               next($added); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       $metadata = $changeset->getMetadata(); | 
					
						
							|  |  |  |       $metadata['copy:lines'] = array_filter($copies); | 
					
						
							|  |  |  |       $changeset->setMetadata($metadata); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-14 12:08:31 -07:00
										 |  |  |   public function getDiffDict() { | 
					
						
							|  |  |  |     $dict = array( | 
					
						
							|  |  |  |       'id' => $this->getID(), | 
					
						
							|  |  |  |       'parent' => $this->getParentRevisionID(), | 
					
						
							|  |  |  |       'revisionID' => $this->getRevisionID(), | 
					
						
							|  |  |  |       'sourceControlBaseRevision' => $this->getSourceControlBaseRevision(), | 
					
						
							|  |  |  |       'sourceControlPath' => $this->getSourceControlPath(), | 
					
						
							| 
									
										
										
										
											2012-01-09 11:42:37 -08:00
										 |  |  |       'sourceControlSystem' => $this->getSourceControlSystem(), | 
					
						
							|  |  |  |       'branch' => $this->getBranch(), | 
					
						
							| 
									
										
										
										
											2012-06-15 15:09:42 -07:00
										 |  |  |       'creationMethod' => $this->getCreationMethod(), | 
					
						
							| 
									
										
										
										
											2011-10-14 12:08:31 -07:00
										 |  |  |       'unitStatus' => $this->getUnitStatus(), | 
					
						
							|  |  |  |       'lintStatus' => $this->getLintStatus(), | 
					
						
							|  |  |  |       'changes' => array(), | 
					
						
							|  |  |  |       'properties' => array(), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     foreach ($this->getChangesets() as $changeset) { | 
					
						
							|  |  |  |       $hunks = array(); | 
					
						
							|  |  |  |       foreach ($changeset->getHunks() as $hunk) { | 
					
						
							|  |  |  |         $hunks[] = array( | 
					
						
							|  |  |  |           'oldOffset' => $hunk->getOldOffset(), | 
					
						
							|  |  |  |           'newOffset' => $hunk->getNewOffset(), | 
					
						
							|  |  |  |           'oldLength' => $hunk->getOldLen(), | 
					
						
							|  |  |  |           'newLength' => $hunk->getNewLen(), | 
					
						
							|  |  |  |           'addLines'  => null, | 
					
						
							|  |  |  |           'delLines'  => null, | 
					
						
							|  |  |  |           'isMissingOldNewline' => null, | 
					
						
							|  |  |  |           'isMissingNewNewline' => null, | 
					
						
							|  |  |  |           'corpus'    => $hunk->getChanges(), | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       $change = array( | 
					
						
							|  |  |  |         'metadata'      => $changeset->getMetadata(), | 
					
						
							|  |  |  |         'oldPath'       => $changeset->getOldFile(), | 
					
						
							| 
									
										
										
										
											2012-01-16 23:05:44 -08:00
										 |  |  |         'currentPath'   => $changeset->getFilename(), | 
					
						
							| 
									
										
										
										
											2011-10-14 12:08:31 -07:00
										 |  |  |         'awayPaths'     => $changeset->getAwayPaths(), | 
					
						
							|  |  |  |         'oldProperties' => $changeset->getOldProperties(), | 
					
						
							|  |  |  |         'newProperties' => $changeset->getNewProperties(), | 
					
						
							|  |  |  |         'type'          => $changeset->getChangeType(), | 
					
						
							|  |  |  |         'fileType'      => $changeset->getFileType(), | 
					
						
							|  |  |  |         'commitHash'    => null, | 
					
						
							| 
									
										
										
										
											2011-12-14 11:52:28 -08:00
										 |  |  |         'addLines'      => $changeset->getAddLines(), | 
					
						
							|  |  |  |         'delLines'      => $changeset->getDelLines(), | 
					
						
							| 
									
										
										
										
											2011-10-14 12:08:31 -07:00
										 |  |  |         'hunks'         => $hunks, | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       $dict['changes'][] = $change; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $properties = id(new DifferentialDiffProperty())->loadAllWhere( | 
					
						
							|  |  |  |       'diffID = %d', | 
					
						
							|  |  |  |       $this->getID()); | 
					
						
							|  |  |  |     foreach ($properties as $property) { | 
					
						
							|  |  |  |       $dict['properties'][$property->getName()] = $property->getData(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return $dict; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-01-24 11:01:53 -08:00
										 |  |  | } |