get the last commit for a given treeish, for the actual tree

@param string $ref

@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Commit
327889
public function getLastCommit($ref = 'master')
    {
        if ($this->isRoot()) {
            return $this->getRepository()->getCommit($ref);
        }
        $log = $this->repository->getObjectLog($this->getObject(), $ref);

        return $log[0];
    }
344813
public function ref($ref)
    {
        if (substr($ref, 0, 2) !== '#/') {
            // @todo Add support for external (http) refs?
            throw new Exception('Unsupported $ref "' . $ref . '", it should start with "#/"');
        }
        return $this->resolveRef($ref, '#/', $this, []);
    }
329016
def last_commit(self) -> Tuple:
        """"""
        from libs.repos import git

        return git.get_last_commit(repo_path=self.path)
1310435
protected function getByRef($key, &$value)
    {
        if (!$this->checkRefs ||!is_string($value)) {
            return;
        }

        $this->checkRefs = false;
        $references = [$key];
        $key = $value;
        while ($this->isRef($key)) {
            if (in_array($key, $references)) {
                $this->checkRefs = true;
                $this->key = null;
                $references[] = $key;
                throw new RuntimeException(sprintf(
                    "Cyclic reference detected: %s",
                    implode(" ~~> ", $references)
                ));
            }
            $references[] = $key;
            $previous = $key;
            $key = $this->get($key, null, false);
        };
        $this->checkRefs = true;
        if (isset($previous)) {
            if ($this->exists($previous)) {
                $value = $key;
            } else {
                $this->key = null;
                $references[sizeof($references) - 1] .= " (missing key)";
                throw new RuntimeException(sprintf(
                    "Invalid reference detected: %s",
                    implode(" ~~> ", $references)
                ));
            }
        }
    }
1138006
public function getLastChild()
	{
		if ( ! $this->hasChildren()) {
			return null;
		}
		$right = $this->getRightValue() - 1;

		$searchCondition = $this->repository->createSearchCondition()
				->rightEqualsTo($right);

		$lastChild = $this->repository->search($searchCondition);
		if ( ! isset($lastChild[0])) {
			$dump = static::dump($this);
			throw new Exception\InvalidStructure("Could not find the last child of {$dump} but it must exist");
		}
		$lastChild = $lastChild[0];
		
		return $lastChild;
	}
1103101
public static function getRealCodepoint($ref) {
        if (!isset(self::$realCodepointTable[$ref])) {
            return false;
        } else {
            return self::$realCodepointTable[$ref];
        }
    }
15295
public function getCurrentCommit()
    {
        /** @var $result CallResult */
        $result = $this->getSvn()->{'info'}($this->getRepositoryPath(), array(
            '--xml',
            '--revision' => 'HEAD'
        ));
        $result->assertSuccess(sprintf('Cannot get info for "%s"', $this->getRepositoryPath()));

        $xml    = simplexml_load_string($result->getStdOut());
        if (!$xml) {
            throw new \RuntimeException(sprintf('Cannot read info XML for "%s"', $this->getRepositoryPath()));
        }

        $commit = $xml->xpath('/info/entry/commit[@revision]');
        if (empty($commit)) {
            throw new \RuntimeException(sprintf('Cannot read info XML for "%s"', $this->getRepositoryPath()));
        }

        $commit = reset($commit);
        return (string)($commit['revision']);
    }
419386
protected function last()
    {
        $i = count($this->env->children) - 1;

        if (isset($this->env->children[$i])) {
            return $this->env->children[$i];
        }
    }
654823
public function getLastInsertedId($column = null)
    {
        if (is_string($column)) {
            return $this->getConnection()->lastInsertId($column);
        }

        return $this->getConnection()->lastInsertId();
    }
321185
public static function getRef($reference)
	{
		if (isset(self::$strings[$reference]))
		{
			return self::$strings[$reference];
		}

		return false;
	}
693036
public function listAll($ref = null)
    {
        if (is_null($ref)) {
            $ref = 'HEAD';
        }
        $this->clearAll();

        $this->addCommandName(self::LS_TREE_COMMAND);
        $this->addCommandSubject($ref);

        return $this->getCommand();
    }
948230
public function commit() {
		if (!$this->inTransaction()) {
			throw new Exception('There is no active transaction');
		}

		$res = @oci_commit($this->_dbh);
		$this->checkError($res);

		$this->_inTransaction = false;
		$this->_commitMode = null;

		return $res;
	}
1189694
public function getLastReleasedRevision()
    {
        if ($this->lastReleasedRevision === null) {
            $this->setLastReleasedRevision($this->revisionRepository->getLastReleasedByEnvironment($this));
        }
        return $this->lastReleasedRevision;
    }
1312164
protected function collectCommit() : CommitInfo
    {
        $commitResult = $this->executor->execute("git log -1 --pretty=format:%H%n%aN%n%ae%n%cN%n%ce%n%s%n%at");

        if (count($commitResult) !== 7 || array_keys($commitResult) !== range(0, 6)) {
            throw new \RuntimeException();
        }

        $commit = new CommitInfo();

        return $commit
            ->setId(trim($commitResult[0]))
            ->setAuthorName(trim($commitResult[1]))
            ->setAuthorEmail(trim($commitResult[2]))
            ->setCommitterName(trim($commitResult[3]))
            ->setCommitterEmail(trim($commitResult[4]))
            ->setMessage($commitResult[5])
            ->setDate((int) $commitResult[6]);
    }
738431
public function getRef($nodeVersionId)
    {
        $this->initNodeVersions();

        return isset($this->refs[$nodeVersionId]) ? $this->refs[$nodeVersionId] : null;
    }
1071681
public static function node($ref = null, $strict = true) {
		$db = static::connection();
		$name = static::meta('name');

		extract(static::meta('acl'), EXTR_SKIP);
		extract(static::actsAs('Tree', true), EXTR_SKIP);

		if (is_string($ref)) {
			$w = $with = 'Parent';
			$i = 0;
			$paths = explode('/', $ref);
			$start = $paths[0];
			unset($paths[0]);

			$query = [
				'alias' => $name,
				'fields' => [$name],
				'with' => [
					$with => [
						'alias' => "{$name}0",
						'constraints' => (object) [
							"{$name}0.{$alias}" => (object) $db->value($start, [
								'type' => 'string'
							])
						]
					]],
				'order' => "{$name}.{$left} DESC"
			];

			$conditions = [static::_wrapCond($db, $name, 0, $left, $right)];

			foreach ($paths as $i => $path) {
				$j = $i - 1;
				$w .= ".{$with}";
				$query['with'][$w] = [
					'alias' => "{$name}{$i}",
					'constraints' => (object) [
						"{$name}{$i}.{$left}" => ['>' => "{$name}{$j}.{$left}"],
						"{$name}{$i}.{$right}" => ['<' => "{$name}{$j}.{$right}"],
						"{$name}{$i}.{$alias}" => $db->value($path, ['type' => 'string']),
						"{$name}{$j}." . static::meta('key') => "{$name}{$i}.{$parent}"
					]
				];
				$conditions[] = static::_wrapCond($db, $name, $i, $left, $right);
			}

			$query['conditions'] = ['OR' => $conditions];

			$result = static::find('all', $query + ['return' => 'array']);

			$paths = array_values($paths);

			if (!isset($result[0])) {
				return false;
			}
			if ($strict && (
				($paths && $result[0][$alias] !== $paths[count($paths) - 1]) ||
				(!$paths && $result[0][$alias] !== $start)
			)) {
				return false;
			}
			return $result;
		} elseif (is_object($ref)) {
			$self = static::_object();
			if ($ref instanceof $self->_classes['entity']) {
				$model = $ref->model();
				$id = $model::meta('key');
				$ref = [$class => $model, $id => $ref->$id];
			}
		}

		if ($ref && is_array($ref) && isset($ref[$class])) {
			$conditions = [];
			$model = $ref[$class];
			$id = $model::meta('key');
			if (isset($ref[$id])) {
				$conditions["{$name}0.{$key}"] = $ref[$id];
			} elseif (isset($ref[$key])) {
				$conditions["{$name}0.{$key}"] = $ref[$key];
			} else {
				return false;
			}
			$conditions["{$name}0.{$class}"] = $model;

			$constraints = (object) static::_wrapCond($db, $name, '0', $left, $right, false);

			$query = [
				'conditions' => $conditions,
				'fields' => [$name],
				'with' => [
					'Parent' => [
						'alias' => "{$name}0",
						'constraints' => $constraints
					]
				],
				'order' => "{$name}.{$left} DESC"
			];

			return static::find('all', $query + ['return' => 'array']);
		}
		return false;
	}
1290672
private function getLastOnline($f)
    {
        $last_online = $f->find('strong', 0)->parent()->parent()->next_sibling();

        return trim($last_online->plaintext);
    }