Gets the default branch name for the deployment artifact.
492779
protected function getDefaultBranchName() {
    chdir($this->getConfigValue('repo.root'));
    $git_current_branch = trim(shell_exec("git rev-parse --abbrev-ref HEAD"));
    $default_branch = $git_current_branch . '-build';

    return $default_branch;
  }
950402
def installName(self):
        
        opts = {'name': self.name(), 'version': self.version()}
        if self.revision():
            opts['revision'] = '.{0}'.format(self.revision())
        else:
            opts['revision'] = ''

        if self._installName:
            return self._installName.format(**opts)
        else:
            return '{name}-{version}{revision}'.format(**opts)
489278
def current_branch(self):
        """"""
        output = self.context.capture('git', 'rev-parse', '--abbrev-ref', 'HEAD', check=False, silent=True)
        return output if output != 'HEAD' else None
485749
protected function collectBranch() : string
    {
        $branchesResult = $this->executor->execute('git branch');

        foreach ($branchesResult as $result) {
            if (strpos($result, '* ') === 0) {
                $exploded = explode('* ', $result, 2);

                return $exploded[1];
            }
        }

        throw new \RuntimeException();
    }
630435
def get_current_branch(self) -> str:
        
        current_branch: str = self.repo.active_branch.name
        LOGGER.debug('current branch: %s', current_branch)
        return current_branch
463236
def _get_base():
        
        try:
            name, _aliaslist, _addresslist = socket.gethostbyname_ex('deploy')
        except socket.gaierror:
            name = 'deploy'
        fallback = 'https://{name}/'.format(name=name)
        return os.environ.get('VELOCIRAPTOR_URL', fallback)
139044
async function getBranchPr(branchName) {
  logger.debug(`getBranchPr(${branchName})`);
  if (!(await branchExists(branchName))) {
    return null;
  }
  const urlString = `projects/${
    config.repository
  }/merge_requests?state=opened&per_page=100`;
  const res = await get(urlString, { paginate: true });
  logger.debug(`Got res with ${res.body.length} results`);
  let pr = null;
  res.body.forEach(result => {
    if (result.source_branch === branchName) {
      pr = result;
    }
  });
  if (!pr) {
    return null;
  }
  return getPr(pr.iid);
}
340366
private List<Deployment> defaultDeployments(List<Deployment> deployments) {
        List<Deployment> defaults = new ArrayList<Deployment>();
        for (Deployment deployment : deployments) {
            if (deployment.getDescription().getName().equals(DeploymentTargetDescription.DEFAULT.getName())) {
                defaults.add(deployment);
            }
        }
        return defaults;
    }
202545
def get_default_name(self):
        '''
        
        '''
        long_names = [name for name in self.name if name.startswith("--")]
        short_names = [name for name in self.name if not name.startswith("--")]

        if long_names:
            return to_snake_case(long_names[0].lstrip("-"))

        return to_snake_case(short_names[0].lstrip("-"))
779878
private static String initializeBaseDir() {
        LOGGER.entering();
        String repoFolderName = System.getProperty(ARTIFACT_BASE_CONFIG_PROPERTY,
                ConfigParser.parse().getString(ARTIFACT_BASE_CONFIG_PROPERTY, "repository"));
        repoFolderName = StringUtils.defaultIfEmpty(repoFolderName, "repository");
        LOGGER.exiting(repoFolderName);
        return repoFolderName;
    }
1314104
function getProjectName(configXml) {
    let output = null;
    if (configXml.widget.hasOwnProperty("name")) {
      const name = configXml.widget.name[0];
      if (typeof name === "string") {
        // handle <name>Branch Cordova</name>
        output = configXml.widget.name[0];
      } else {
        // handle <name short="Branch">Branch Cordova</name>
        output = configXml.widget.name[0]._;
      }
    }

    return output;
  }
223951
def base_sha
      default_branch = client.repo(repo)[:default_branch]
      branches.find { |branch| branch[:name] == default_branch }[:commit][:sha]
    end
946828
function _initBranch(branchToken) {
  const [, keyword, name, remainder] = branchToken.match(BRANCH_REGEX);

  return {
    name: name.toLowerCase(),
    keyword,
    params: _parseParams(remainder),
    fields: {},
  };
}
810072
@JsonIgnore
    public String getCuredBranchPath() {
        String trim = StringUtils.trim(branchPath);
        if ("/".equals(trim)) {
            return trim;
        } else {
            return StringUtils.stripEnd(trim, "/");
        }
    }
563398
public function getTargetBranch(string $component) : string {
        return array_key_exists($component, $this->branches)
                ? $this->branches[$component]
                : self::$defaultBranch;
    }
715834
public static String getPropertyNameForBranch(String key, int numBranches, int branchId) {
    Preconditions.checkArgument(numBranches >= 0, "The number of branches is expected to be non-negative");
    Preconditions.checkArgument(branchId >= 0, "The branchId is expected to be non-negative");
    return numBranches > 1 ? key + "." + branchId : key;
  }
584457
def get_git_version(path):
    """"""
    branch_name = get_git_cleaned_branch_name(path)
    # Determine whether working copy is dirty (i.e. contains modified files)
    mods = run_cmd(path, 'git', 'status', '--porcelain', '--untracked-files=no')
    dirty = '.dirty' if mods else ''
    # Get a list of all commits on branch, with corresponding branch/tag refs
    # Each line looks something like: "d3e4d42 (HEAD, master, tag: v0.1)"
    git_output = run_cmd(path, 'git', 'log', '--pretty="%h%d"')
    commits = git_output.strip().replace('"', '').split('\n')
    num_commits_since_branch = len(commits)
    # Short hash of the latest commit
    short_commit_name = commits[0].partition(' ')[0]
    # A valid version is sequence of dotted numbers optionally prefixed by 'v'
    valid_version = re.compile(r'^v?([\.\d]+)$')

    def tagged_version(commit):
        """First tag on commit that is valid version, as a list of numbers."""
        refs = commit.partition(' ')[2]
        for ref in refs.lstrip('(').rstrip(')').split(', '):
            if ref.startswith('tag: '):
                tag = ref[5:].lower()
                found = valid_version.match(tag)
                if found:
                    return [int(v) for v in found.group(1).split('.') if v]
        return []
    # Walk back along branch and find first valid tagged version (or use 0.0)
    for commit in commits:
        version_numbers = tagged_version(commit)
        if version_numbers:
            break
    else:
        version_numbers = [0, 0]
    # It is a release if current commit has a version tag (and dir is clean)
    release = (commit == commits[0]) and not dirty
    if not release:
        # We are working towards the next (minor) release according to PEP 440
        version_numbers[-1] += 1
    version = '.'.join([str(v) for v in version_numbers])
    if not release:
        # Development version contains extra embellishments
        version = ("%s.dev%d+%s.%s%s" % (version, num_commits_since_branch,
                                         branch_name, short_commit_name, dirty))
    return version