2015-02-19 16:25:06 +04:00
|
|
|
##@cooked comments # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
|
|
|
## Fonctions pour la gestion des projets
|
|
|
|
##@cooked nocomments
|
|
|
|
##@include vcs
|
|
|
|
##@include semver
|
|
|
|
uprovide ptools
|
|
|
|
urequire vcs semver
|
|
|
|
|
|
|
|
function __get_branch() {
|
|
|
|
local branch="$1"
|
|
|
|
[ -n "$branch" ] || branch="$(git_get_branch)"
|
|
|
|
echo "$branch"
|
|
|
|
}
|
|
|
|
|
|
|
|
function is_master_branch() {
|
|
|
|
local branch; branch="$(__get_branch "$1")" || return 2
|
|
|
|
[ "$branch" == "master" ]
|
|
|
|
}
|
|
|
|
function is_develop_branch() {
|
|
|
|
local branch; branch="$(__get_branch "$1")" || return 2
|
|
|
|
[ "$branch" == "develop" ]
|
|
|
|
}
|
|
|
|
function is_release_branch() {
|
|
|
|
local branch; branch="$(__get_branch "$1")" || return 2
|
|
|
|
[[ "$branch" == release-* ]]
|
|
|
|
}
|
|
|
|
function is_hotfix_branch() {
|
|
|
|
local branch; branch="$(__get_branch "$1")" || return 2
|
|
|
|
[[ "$branch" == hotfix-* ]]
|
|
|
|
}
|
2015-02-20 00:11:49 +04:00
|
|
|
function is_feature_branch() {
|
2015-02-19 16:25:06 +04:00
|
|
|
local branch; branch="$(__get_branch "$1")" || return 2
|
|
|
|
[ "$branch" == "master" ] && return 1
|
|
|
|
[ "$branch" == "develop" ] && return 1
|
|
|
|
[[ "$branch" == release-* ]] && return 1
|
|
|
|
[[ "$branch" == hotfix-* ]] && return 1
|
|
|
|
return 0
|
|
|
|
}
|
2015-02-20 00:11:49 +04:00
|
|
|
|
|
|
|
function list_release_branches() {
|
|
|
|
git_list_branches | grep '^release-'
|
|
|
|
}
|
|
|
|
function list_hotfix_branches() {
|
|
|
|
git_list_branches | grep '^hotfix-'
|
|
|
|
}
|
|
|
|
function list_feature_branches() {
|
|
|
|
git_list_branches |
|
|
|
|
grep -vF master |
|
|
|
|
grep -vF develop |
|
|
|
|
grep -v '^release-' |
|
|
|
|
grep -v '^hotfix-'
|
|
|
|
}
|