Example #1
0
 /**
  * Loads the object
  * @param  string   $sha1 The hash of the object to load
  * @return Internal
  */
 public function load($sha1)
 {
     return $this->io->readObject($sha1);
 }
Example #2
0
 /**
  * Writes the annotated tag to IO
  * @param IOInterface $io The IO to write to
  * @internal
  */
 public function write(IOInterface $io)
 {
     $io->addObject($this);
     $this->object->write($io);
 }
Example #3
0
 /**
  * Removes a branch
  * @param Branch $branch The branch to remove
  */
 public function removeBranch(Branch $branch)
 {
     $this->io->removeRef($branch->getHead());
 }
Example #4
0
 /**
  * Writes the tree and all its linked objects to IO
  * @internal
  */
 public function write(IOInterface $io)
 {
     $io->addObject($this);
     foreach ($this->objects as $object) {
         $object[0]->write($io);
     }
 }
Example #5
0
 /**
  * Writes the reference and the object it refers to to disk
  * @param \gihp\IO\IOInterface $io
  */
 public function write(IOInterface $io)
 {
     $io->addRef($this);
     $this->commit->write($io);
 }
Example #6
0
 /**
  * Writes the branch to IO
  * @param IOInterface $io An IOInterface to write to
  */
 public function write(IOInterface $io)
 {
     if (!$this->ref) {
         throw new \LogicException('Branch cannot be written if no head reference exists');
     }
     try {
         $io->removeRef($this->ref);
     } catch (\RuntimeException $e) {
         //Nothing to worry about, the ref just does not exist.
     }
     $this->ref->write($io);
 }
Example #7
0
 /**
  * Writes the commit and its dependencies to IO
  * @internal
  */
 public function write(IOInterface $io)
 {
     $io->addObject($this);
     foreach ($this->parents as $parent) {
         $parent->write($io);
     }
     $this->tree->write($io);
 }
Example #8
0
 /**
  * Loads the reference
  * @param  string    $path The path to the reference
  * @return Reference
  */
 public function load($path)
 {
     return $this->io->readRef($path);
 }
 /**
  * Writes the symbolic reference and the object it points to to disk
  * @param \gihp\IO\IOInterface $io
  */
 public function write(\gihp\IO\IOInterface $io)
 {
     $io->moveHead($this);
     $this->head->write($io);
 }