début d'implémentation
This commit is contained in:
		
							parent
							
								
									5d828c4894
								
							
						
					
					
						commit
						1ec281d746
					
				@ -40,5 +40,8 @@
 | 
			
		||||
# Activer le mode offline pour git (pas de push automatique)
 | 
			
		||||
#export UTOOLS_VCS_OFFLINE=1
 | 
			
		||||
 | 
			
		||||
# Activer automatiquement l'option --clean pour 'uproject update'
 | 
			
		||||
#export UTOOLS_VCS_CLEANUPDATE=1
 | 
			
		||||
 | 
			
		||||
# Faire un alias ssh pour ussh
 | 
			
		||||
#export UTOOLS_USSH_ALIAS=1
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										26
									
								
								lib/ulib/vcs
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								lib/ulib/vcs
									
									
									
									
									
								
							@ -441,16 +441,28 @@ function git_commit() {
 | 
			
		||||
function git_status() {
 | 
			
		||||
    git status "$@"
 | 
			
		||||
}
 | 
			
		||||
function __git_update_lbranches() {
 | 
			
		||||
    git for-each-ref refs/heads/ --format='%(refname:short)' |
 | 
			
		||||
        grep -vF master |
 | 
			
		||||
        grep -vF develop |
 | 
			
		||||
        grep -v '^release-' |
 | 
			
		||||
        grep -v '^hotfix-'
 | 
			
		||||
}
 | 
			
		||||
function git_update() {
 | 
			
		||||
    local args autoff=1
 | 
			
		||||
    local args autoff=1 clean=auto
 | 
			
		||||
    parse_opts + "${PRETTYOPTS[@]}" \
 | 
			
		||||
        -x '$_vcs_unsupported -x' \
 | 
			
		||||
        -c,--clean-before clean=1 \
 | 
			
		||||
        --no-clean-before clean= \
 | 
			
		||||
        -n,--no-autoff autoff= \
 | 
			
		||||
        @ args -- "$@" && set -- "${args[@]}" || {
 | 
			
		||||
        eerror "$args"
 | 
			
		||||
        return 1
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if [ "$clean" == auto ]; then
 | 
			
		||||
        [ -n "$UTOOLS_VCS_CLEANUPDATE" ] && clean=1 || clean=
 | 
			
		||||
    fi
 | 
			
		||||
    if [ -z "$autoff" ]; then
 | 
			
		||||
        git pull "$@"
 | 
			
		||||
        return $?
 | 
			
		||||
@ -459,6 +471,18 @@ function git_update() {
 | 
			
		||||
    local branch orig_branch restore_branch remote rbranch pbranch
 | 
			
		||||
    local -a branches prbranches crbranches dbranches
 | 
			
		||||
 | 
			
		||||
    if [ -n "$clean" ]; then
 | 
			
		||||
        git_ensure_cleancheckout
 | 
			
		||||
        array_from_lines prbranches "$(git_list_rbranches)"
 | 
			
		||||
        if git_have_branch develop; then
 | 
			
		||||
            git checkout -q develop
 | 
			
		||||
            array_from_lines branches "$(__git_update_lbranches)"
 | 
			
		||||
            for branch in "${branches[@]}"; do
 | 
			
		||||
                #XXX pour chaque branche, vérifier l'origine
 | 
			
		||||
            done
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    array_from_lines prbranches "$(git_list_rbranches)"
 | 
			
		||||
    git fetch -p "$@" || return
 | 
			
		||||
    array_from_lines crbranches "$(git_list_rbranches)"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								uproject
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								uproject
									
									
									
									
									
								
							@ -44,6 +44,14 @@ COMMANDS
 | 
			
		||||
    update [-x]
 | 
			
		||||
        Mettre à jour la copie locale avec la copie sur le serveur.
 | 
			
		||||
        -x  Ne pas mettre à jour les références externes (si appliquable)
 | 
			
		||||
        -c, --clean-before
 | 
			
		||||
            Avant de faire git pull, supprimer toutes les branches locales qui
 | 
			
		||||
            sont à jour par rapport à l'origine. La copie de travail doit être
 | 
			
		||||
            propre. Basculer sur la branche develop avant de supprimer les
 | 
			
		||||
            branches. S'il n'y a pas de branche develop, c'est un NOP.
 | 
			
		||||
        --no-clean-before
 | 
			
		||||
            Neutraliser l'activation de l'option --clean-before par la variable
 | 
			
		||||
            UTOOLS_VCS_CLEANUPDATE si elle est renseignée.
 | 
			
		||||
        -n, --no-autoff
 | 
			
		||||
            Ne pas faire de fast-forward automatique pour toutes les branches
 | 
			
		||||
            traquées. Par défaut, s'il n'y a pas de modifications locales,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user