Exemplo n.º 1
0
 /**
  * Commit the file (needs write access to repository)
  *
  * @param   string comment
  */
 public function commit($comment)
 {
     $f = new TempFile();
     $f->open(FILE_MODE_WRITE);
     $f->writeLine($comment);
     $f->close();
     $return = $this->_execute(sprintf('commit -F %s %s', $f->getURI(), $this->filename));
     $f->unlink();
     return $return;
 }
 /**
  * Produce diff between the contents
  *
  * @param   string left
  * @param   string right
  */
 protected function diff($left, $right)
 {
     with($templ = new TempFile(), $tempr = new TempFile(), $templ->open(FILE_MODE_WRITE), $tempr->open(FILE_MODE_WRITE));
     $templ->write($left);
     $tempr->write($right);
     $templ->close();
     $tempr->close();
     // TODO: Implement "diff" in userland
     try {
         $p = new Process(sprintf('diff -u %s %s', $templ->getURI(), $tempr->getURI()));
         $p->in->close();
         while (!$p->out->eof()) {
             $this->out->writeLine($p->out->readLine());
         }
         $p->close();
     } catch (IOException $e) {
         $this->err->writeLine('!=> Invocation of `diff` program failed.');
         $templ->unlink();
         $tempr->unlink();
         return;
     }
     $templ->unlink();
     $tempr->unlink();
 }
Exemplo n.º 3
0
 /**
  * Commit the file (needs write access to repository)
  *
  * @param   string comment
  * @see     http://www.cvshome.org/docs/manual/cvs_16.html#SEC124
  */
 public function commit($comment)
 {
     $f = new TempFile();
     $f->open(FILE_MODE_WRITE);
     $f->writeLine($comment);
     $f->close();
     $return = $this->_execute(sprintf('commit -F %s', $f->getURI()));
     // It seems CVS automatically removes the tmp-file after
     // reading it, so we don't need to do so (gives error).
     return $return;
 }