Setup Drush aliases.

@param bool $exclude_remote
Exclude the remote drush aliases from being generated.

@return self
177454
public function setupDrushAlias($exclude_remote = false)
    {
        $project_root = ProjectX::projectRoot();

        if (!file_exists("$project_root/drush/site-aliases")) {
            $continue = $this->askConfirmQuestion(
                "Drush aliases haven't been setup for this project.\n"
                . "\nDo you want run the Drush alias setup?",
                true
            );

            if (!$continue) {
                return $this;
            }
            $this->setupDrush($exclude_remote);
        } else {
            $this->setupDrushLocalAlias();

            if (!$exclude_remote) {
                $this->setupDrushRemoteAliases();
            }
        }

        return $this;
    }
443536
protected function excludes($excludes)
    {
        $excludes = \is_array($excludes) ? $excludes : \func_get_args();

        $this->excludes = $excludes;

        return $this;
    }
741230
public function excludeFilesFrom($excludeFilesAndDirectories): self
    {
        $this->excludeFilesAndDirectories = $this->excludeFilesAndDirectories->merge($this->sanitize($excludeFilesAndDirectories));

        return $this;
    }
751044
public function checkoutAllRemoteBranches($remote = 'origin')
    {
        $actualBranch = $this->getMainBranch();
        $actualBranches = $this->getBranches(true, false);
        $allBranches = $this->getBranches(true, true);
        $realBranches = array_filter(
            $allBranches,
            function (string $branch) use ($actualBranches) {
                return !in_array($branch, $actualBranches)
                && preg_match('/^remotes(.+)$/', $branch)
                && !preg_match('/^(.+)(HEAD)(.*?)$/', $branch);
            }
        );

        foreach ($realBranches as $realBranch) {
            $this->checkout(str_replace(sprintf('remotes/%s/', $remote), '', $realBranch));
        }

        $this->checkout($actualBranch);

        return $this;
    }
1093776
public function hydrate($include_extra = false)
    {
        // If including extra YAML config vars, neither use the cache NOR allow
        // the cache to be saved with it
        if ($include_extra && !$this->has_extra) {
            $this->has_extra = true;
            $this->items = $this->mergeSources();
            return $this;
        }

        // If already hydrated, do nothing
        if (!$this->isEmpty()) {
            return $this;
        }

        // If running locally, don't use or store the cache
        if (App::isLocal()) {
            $this->items = $this->mergeSources();
            return $this;
        }

        // Else, use the cache if it exists or generate the cache
        if ($data = Cache::get($this->cacheKey())) {
            $this->items = $data;
        } else {
            $this->items = $this->mergeSources();
            Cache::forever($this->cacheKey(), $this->items);
        }

        // Allow chain
        return $this;
    }
1342222
protected function prepareRemoteDirectory($remote_host, $remote_dir)
	{
		$this->log('Initialize remote directory: '. $remote_host .':'. $remote_dir, LOG_INFO, true);

		$output = array();
		$return = null;
		$this->sshExec($remote_host, "mkdir -p $remote_dir", $output, $return, '', '', LOG_DEBUG);

		if (empty($this->data_dirs))
            return;

        $data_dirs = count($this->data_dirs) > 1 ? '{'. implode(',', $this->data_dirs) .'}' : implode(',', $this->data_dirs);

        $cmd = "mkdir -v -m 0775 -p $remote_dir/{$this->data_dir_prefix}/$data_dirs";

        $output = array();
        $return = null;
        $this->sshExec($remote_host, $cmd, $output, $return, '', '', LOG_DEBUG);
	}
301013
public function exclude(array $excluded_columns, bool $excluded = true): self
    {
        // trim column names automatically
        $excluded_columns = array_map('trim', $excluded_columns);

        $this->search()->in($excluded_columns)->setExcluded($excluded);

        return $this;
    }
124270
public function all_fields($exclude_hidden = true){
		$fields = $this->api->readListMeta($this->list_name, $exclude_hidden);
		foreach ($fields as $field) {
			$this->fields[] = $field['name'];
		}
		return $this;
	}
31341
def setup(app):
    
    app.info('adding remote-include directive...', nonl=True)
    app.add_directive('remote-include', RemoteInclude)
    app.info(' done')
    return {
        'version': __version__,
        'parallel_read_safe': True,
        'parallel_write_safe': True,
        }
257006
public static Set<Exclusion> setupExcludedArtifacts(List<String> excludedArtifacts) throws MojoExecutionException {
        Set<Exclusion> exclusionSet = new HashSet<>();
        for (String artifact : Optional.ofNullable(excludedArtifacts).orElse(Collections.emptyList())) {
            exclusionSet.add(convertExclusionPatternIntoExclusion(artifact));
        }
        for (String artifact : BLACKLISTED_ARTIFACTS) {
            exclusionSet.add(convertExclusionPatternIntoExclusion(artifact));
        }

        return exclusionSet;
    }
774031
public function remoteBranchExists($remote, $branchName, $dir = null, $mustRun = false)
    {
        $args = ['ls-remote', $remote, $branchName];
        $result = $this->execute($args, $dir, $mustRun);

        return is_string($result) && strlen(trim($result));
    }
230782
private function execute($remote, $url)
    {
        /** @var ConfigurationDataResponse $configurationData */
        $configurationData = $this->queryBus->handle(new ConfigurationDataFinder());
        $prePushResponse = $configurationData->getPrePush();

        if (true === $prePushResponse->isPrePush()) {
            $this->output->writeln(self::PRE_PUSH_HOOK);
            $this->executeOriginalHook($remote, $url, $prePushResponse->getErrorMessage());

            $phpunitResponse = $prePushResponse->getPhpUnit();

            if (true === $phpunitResponse->isPhpunit()) {
                $this->commandBus->handle(
                    new PhpUnitTool(
                        $phpunitResponse->isPhpunitRandomMode(),
                        $phpunitResponse->getPhpunitOptions(),
                        $prePushResponse->getErrorMessage()
                    )
                );

                $phpunitStrictCoverageResponse = $prePushResponse->getPhpUnitStrictCoverage();

                if (true === $phpunitStrictCoverageResponse->isPhpunitStrictCoverage()) {
                    $this->commandBus->handle(
                        new StrictCoverage(
                            $phpunitStrictCoverageResponse->getMinimum(),
                            $prePushResponse->getErrorMessage()
                        )
                    );
                }

                $phpunitGuardCoverageResponse = $prePushResponse->getPhpUnitGuardCoverage();

                if (true === $phpunitGuardCoverageResponse->isEnabled()) {
                    $this->commandBus->handle(
                        new GuardCoverage($phpunitGuardCoverageResponse->getWarningMessage())
                    );
                }
            }

            $this->output->writeln(GoodJobLogoResponse::paint($prePushResponse->getRightMessage()));
        }
    }
1038580
protected function prepareExcludes()
	{
		$this->log('prepareExcludes', LOG_DEBUG);

		chdir($this->basedir);

		$exclude_param = '';

		if (count($this->rsync_excludes) > 0)
		{
			foreach ($this->rsync_excludes as $exclude)
			{
				if (!file_exists($exclude))
				{
					throw new DeployException('Rsync exclude file not found: '. $exclude);
				}

				$exclude_param .= '--exclude-from='. escapeshellarg($exclude) .' ';
			}
		}

		if (!empty($this->data_dirs))
		{
			foreach ($this->data_dirs as $data_dir)
			{
				$exclude_param .= '--exclude '. escapeshellarg("/$data_dir") .' ';
			}
		}

		return $exclude_param;
	}
117809
def init_remote(self):
        '''
        
        '''
        new = False
        if not os.listdir(self.cachedir):
            # Repo cachedir is empty, initialize a new repo there
            self.repo = git.Repo.init(self.cachedir)
            new = True
        else:
            # Repo cachedir exists, try to attach
            try:
                self.repo = git.Repo(self.cachedir)
            except git.exc.InvalidGitRepositoryError:
                log.error(_INVALID_REPO, self.cachedir, self.url, self.role)
                return new

        self.gitdir = salt.utils.path.join(self.repo.working_dir, '.git')
        self.enforce_git_config()

        return new
595401
def remote
      remote = []

      @branches.each do |branch|
        remote << branch if branch.remote?
      end

      BranchCollection.new(@repo, remote)
    end
97463
public function setExcluded($excluded = true)
    {
        foreach ($this->results as $name) {
            $this->columns->offsetGet($name)->setExcluded($excluded);
        }

        return $this;
    }
682469
public function drupalRemotePush()
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $this
            ->io()
            ->warning("This command will push the local database to the remote " .
                "origin. Remote data will be destroyed. This is a dangerous " .
                "action which should be thought about for a good minute prior to " .
                "continuing. You've been warned!");

        $continue = $this->askConfirmQuestion('Shall we continue?');

        if (!$continue) {
            return $this;
        }
        $local_alias = $this->determineDrushLocalAlias();
        $remote_alias = $this->determineDrushRemoteAlias();

        if (isset($local_alias) && isset($remote_alias)) {
            $drush = new DrushCommand();

            /** @var DrupalProjectType $instance */
            $instance = $this->getProjectInstance();

            if ($instance->getProjectVersion() >= 8) {
                $drush
                    ->command("sql-sync '@$local_alias' '@$remote_alias'", true)
                    ->command('cr');
            }
            $instance->runDrushCommand($drush);
        }
        $this->executeCommandHook(__FUNCTION__, 'after');

        return $this;
    }