/*!
\param $repositoryID The id (string) of the repository to create the package in.
If \c false it will use the \c local repository.
514958
static function create( $name, $parameters = array(), $repositoryPath = false, $repositoryID = false )
    {
        $parameters['name'] = $name;
        $handler = new eZPackage( $parameters, $repositoryPath );

        // New packages always use local repository
        if ( $repositoryID === false )
            $repositoryID = 'local';
        $repositoryInformation = $handler->repositoryInformation( $repositoryID );
        if ( $repositoryPath !== false )
            $repositoryInformation['path'] = $repositoryPath;
        $handler->setCurrentRepositoryInformation( $repositoryInformation );
        return $handler;
    }
661616
public function git($projectId)
    {
        $project = $this->fetchProject($projectId, array('local', 'remote'));
        $branch = $this->getParam('branch', $project->getBranch());
        $commit = $this->getParam('commit');
        $commitMessage = $this->getParam('message');
        $committer = $this->getParam('committer');
        $rebuild = $this->getParam('rebuild') ?? false;

        return $this->createBuild($project, $commit, $branch, $committer, $commitMessage, $rebuild);
    }
52698
public function installGitRepositoryOnSite($serverId, $siteId, array $data, $wait = true)
    {
        $this->post("servers/$serverId/sites/$siteId/git", $data);

        if ($wait) {
            $this->retry($this->getTimeout(), function () use ($serverId, $siteId) {
                return $this->site($serverId, $siteId)->repositoryStatus === 'installed';
            });
        }
    }
1241876
public void addRepository(String id, URL url) {
        for (UpdateRepository ur : repositories) {
            if (ur.getId().equals(id)) {
                throw new RuntimeException("Repository with id " + id + " already exists");
            }
        }
        repositories.add(new DefaultUpdateRepository(id, url));
    }
118365
public static function createUOID($gid = NULL, $id = NULL)
	{
		if($gid == NULL)
			$gid = Sonic::getContextGlobalID();
		
		if($id == NULL)
			$id = Random::getUniqueRandom();
		
		$uoid = $gid . UOID::SEPARATOR . $id;
		
		return $uoid;
	}
95208
public function create($campaignId = 0)
    {
        $entity = $this->createEntity($campaignId);
        if ($entity) {
            $this->getRepository()->saveEntity($entity);
        }
    }
1087132
public function create($username, $repository, array $params)
    {
        if (!isset($params['tree']) || !is_array($params['tree'])) {
            throw new MissingArgumentException('tree');
        }

        if (!isset($params['tree'][0])) {
            $params['tree'] = [$params['tree']];
        }

        foreach ($params['tree'] as $key => $tree) {
            if (!isset($tree['path'], $tree['mode'], $tree['type'])) {
                throw new MissingArgumentException(["tree.$key.path", "tree.$key.mode", "tree.$key.type"]);
            }

            // If `sha` is not set, `content` is required
            if (!isset($tree['sha']) && !isset($tree['content'])) {
                throw new MissingArgumentException("tree.$key.content");
            }
        }

        return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params);
    }
559294
protected function createMigrationRepository(): void
    {
        $repository = $this->migrator->getRepository();

        if (! $repository->repositoryExists()) {
            $repository->createRepository();
        }
    }
33898
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        parent::install($repo, $package);
        $this->generateVendorMetaData();
    }
219223
public function createPushPackageForUser($userId)
    {
        $packageDir = sprintf('/%s/pushPackage%s.%s', sys_get_temp_dir(), time(), $userId);
        $package = $this->createPackage($packageDir, $userId);

        $this->generatePackage($package);

        return $package;
    }
517599
public function addRepository($repository)
    {
        $class = $repository->getModelClass();
        if ($this->getByClass($class)) {
            throw new RepositoryException("The manager already contains a repository for the model class '$class'");
        }
        
        $repository->setManager($this);
        $this->repositories[$class] = $repository;
    }
387876
private function createAppRepositories(
        ContainerBuilder $container,
        string $name,
        array $repositoryConfiguration
    ) {
        $this->createRepositoryReferenceServiceReference(
            $container,
            $name,
            $repositoryConfiguration,
            '',
            ''
        );

        $this->createClientRetryMap(
            $container,
            $name,
            $repositoryConfiguration
        );

        $this->createClient(
            $container,
            $name,
            $repositoryConfiguration
        );

        $this->createStandardRepository(
            $container,
            $name,
            $repositoryConfiguration,
            '',
            'app',
            InMemoryAppRepository::class,
            DiskAppRepository::class,
            HttpAppRepository::class
        );

        $this->createStandardRepository(
            $container,
            $name,
            $repositoryConfiguration,
            '',
            'user',
            InMemoryUserRepository::class,
            DiskUserRepository::class,
            HttpUserRepository::class
        );
    }
311659
public static function init($directory, array $params = null) {
		if(is_dir("$directory/.git")) {
			throw new ShellException("Repo already exists in $directory.");
		}
		if(!is_dir($directory) && !@mkdir($directory, 0777, true)) // intentionally @; not atomic; from Nette FW
		{
			throw new ShellException("Unable to create directory '$directory'.");
		}
		$cwd = getcwd();
		chdir($directory);
		exec(self::processCommand([
			'git init',
			$params,
			$directory,
		]), $output, $returnCode);
		if($returnCode !== 0) {
			throw new ShellException("Git init failed (directory $directory).");
		}
		$repo = getcwd();
		chdir($cwd);
		return new static($repo);
	}
1195824
function _createRepository() {
        return co(function*(){
            try {
                debug("Creating a new one");
                let repo = yield nodegit.Repository.init(repositoryPath, 0);
                debug("Connection established");
                debug("Creating main files");
                yield _createManifest(repo);
                yield _createConfig(repo);
                fs.mkdirSync(machinesDirPath);
                yield _commit(repo, ["manifest.json", "config.json"]);
                debug("Repository was successfully created");
                return repo;
            } catch (err) {
                debug(err);
                debug("Nuking the repository");
                yield new Promise(function(resolve, reject) {
                    rimraf(repositoryPath, function () {
                        resolve();
                    });
                }).then();
                throw new Error(err);
            }
        });
    }
1265263
public void removeRepository(String id) {
      for (UpdateRepository repo : getRepositories()) {
        if (id.equals(repo.getId())) {
          repositories.remove(repo);
          break;
        }
      }
      log.warn("Repository with id " + id + " not found, doing nothing");
    }
209894
public static function init($directory, array $params = NULL){
		if(is_dir("$directory/.git")){
			throw new GitException("Repo already exists in $directory.");
		}
		
		if(!is_dir($directory) && !@mkdir($directory, 0777, TRUE)){
			throw new GitException("Unable to create directory '$directory'.");
		}
		
		$cwd = getcwd();
		chdir($directory);
		exec(self::processCommand(array(
				'git init',
				$params,
				$directory,
		)), $output, $returnCode);
		
		if($returnCode !== 0){
			throw new GitException(implode("<br>", $output));
		}
		
		$repo = getcwd();
		chdir($cwd);
		return new static($repo);
	}
1013358
public function loadById($productId)
    {
        return $this->productRepository->getById($productId, false, $this->storeManager->getStore()->getId(), true);
    }