/** * Find a build in this set by hash. */ public function byName($hash) { if ($this->loaded == false) { $this->items = $this->getReferences(); $this->loaded = true; } // The item might not be in the list because of the limit, try to find // in an older version and add it to the list. if (!isset($this->items[$hash])) { $repository = new Gitonomy\Git\Repository($this->project->LocalCVSPath); $commit = new Gitonomy\Git\Commit($repository, $hash); $this->items[$hash] = DNCommit::create($commit, $this->project, $this->data); } return $this->items[$hash]; }
/** * Find a build in this set by hash. * * @param string $hash * @return DNCommit */ public function byName($hash) { if ($this->loaded === false) { $this->items = $this->getReferences(); $this->loaded = true; } // The item might not be in the list because of the limit, try to find // in an older version and add it to the list. $found = null; foreach ($this->items as $item) { if ($item->SHA() == $hash) { $found = $item; break; } } if ($found === null) { $repository = new Gitonomy\Git\Repository($this->project->getLocalCVSPath()); $commit = new Gitonomy\Git\Commit($repository, $hash); $found = DNCommit::create($commit, $this->project, $this->data); } return $found; }