From 5ff5b7d4e5775762cad79006da158d8b481bfe0c Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Wed, 20 May 2015 09:48:26 +0400 Subject: [PATCH 1/4] =?UTF-8?q?d=C3=A9terminer=20les=20branches=20de=20top?= =?UTF-8?q?ic:=20ignorer=20les=20branches=20avec=20un=20slash=20dans=20le?= =?UTF-8?q?=20nom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ulib/ptools | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/ulib/ptools b/lib/ulib/ptools index 09b348a..57ef41a 100644 --- a/lib/ulib/ptools +++ b/lib/ulib/ptools @@ -37,10 +37,8 @@ function is_any_branch() { [ "$branch" == "develop" ] && continue [[ "$branch" == release-* ]] && continue [[ "$branch" == hotfix-* ]] && continue - if [ -n "$annex" ]; then - [ "$branch" == "git-annex" ] && continue - [[ "$branch" == synced/* ]] && continue - fi + [ -n "$annex" -a "$branch" == "git-annex" ] && continue + [[ "$branch" == */* ]] && continue return 0 ;; -m|-master) @@ -61,10 +59,8 @@ function is_any_branch() { [ "$branch" == "develop" ] && continue [[ "$branch" == release-* ]] && continue [[ "$branch" == hotfix-* ]] && continue - if [ -n "$annex" ]; then - [ "$branch" == "git-annex" ] && continue - [[ "$branch" == synced/* ]] && continue - fi + [ -n "$annex" -a "$branch" == "git-annex" ] && continue + [[ "$branch" == */* ]] && continue return 1 ;; esac @@ -92,9 +88,9 @@ function list_feature_branches() { grep -vF develop | grep -v '^release-' | grep -v '^hotfix-' | + grep -v '/' | if git_have_annex; then - grep -vF git-annex | - grep -v '^synced/' + grep -vF git-annex else cat fi From 8bf81644b5f1426e08c6c6630e61726f58b728ae Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Wed, 20 May 2015 12:07:18 +0400 Subject: [PATCH 2/4] fast-forwarder automatiquement les branches locales par rapport aux branches distantes --- lib/ulib/vcs | 59 +++++++++++++++++++++++++++++++++++++++++++++------- uproject | 4 ++++ 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/lib/ulib/vcs b/lib/ulib/vcs index bf168ac..79cbad9 100644 --- a/lib/ulib/vcs +++ b/lib/ulib/vcs @@ -442,15 +442,36 @@ function git_status() { git status "$@" } function git_update() { - local args + local args autoff=1 parse_opts + "${PRETTYOPTS[@]}" \ -x '$_vcs_unsupported -x' \ + -n,--no-autoff autoff= \ @ args -- "$@" && set -- "${args[@]}" || { eerror "$args" return 1 } - git pull "$@" + git pull "$@" || return + if [ -n "$autoff" ]; then + local orig_branch restore_branch rbranch + local -a branches + git_check_cleancheckout || return 0 + orig_branch="$(git_get_branch)" + array_from_lines branches "$(git_list_branches)" + for branch in "${branches[@]}"; do + remote="$(git_get_branch_remote "$branch")" + rbranch="$(git_get_branch_rbranch "$branch" "$remote")" + [ -n "$remote" -a -n "$rbranch" ] || continue + if git_should_ff "$branch" "$rbranch"; then + echo "Fast-forwarding $branch..." + git checkout -q "$branch" + git merge -q --ff-only "$rbranch" + restore_branch=1 + fi + done + [ -n "$restore_branch" ] && git checkout -q "$orig_branch" + fi + return 0 } function git_push() { local all all_branches all_tags auto force args no_annex @@ -593,6 +614,28 @@ function git_have_rbranch() { function git_get_branch() { git rev-parse --abbrev-ref HEAD 2>/dev/null } +function git_get_branch_remote() { + local branch="$1" + [ -n "$branch" ] || branch="$(git_get_branch)" + [ -n "$branch" ] || return + git config --get "branch.$branch.remote" +} +function git_get_branch_merge() { + local branch="$1" + [ -n "$branch" ] || branch="$(git_get_branch)" + [ -n "$branch" ] || return + git config --get "branch.$branch.merge" +} +function git_get_branch_rbranch() { + local branch="$1" remote="$2" merge + [ -n "$branch" ] || branch="$(git_get_branch)" + [ -n "$branch" ] || return + [ -n "$remote" ] || remote="$(git_get_branch_remote "$branch")" + [ -n "$remote" ] || return + merge="$(git_get_branch_merge "$branch")" + [ -n "$merge" ] || return + echo "refs/remotes/$remote/${merge#refs/heads/}" +} function git_is_branch() { [ "$(git_get_branch)" == "${1:-master}" ] } @@ -638,7 +681,7 @@ function git_ensure_cleancheckout() { function __git_init_ff() { o="${3:-origin}" - b="$1" s="${2:-remotes/$o/$1}" + b="$1" s="${2:-refs/remotes/$o/$1}" b="$(git rev-parse --verify --quiet "$b")" || return 1 s="$(git rev-parse --verify --quiet "$s")" || return 1 return 0 @@ -648,30 +691,30 @@ function __git_can_ff() { } function git_is_ancestor() { # vérifier que la branche $1 est un ancêtre direct de la branche $2, qui - # vaut par défaut remotes/${3:-origin}/$1 + # vaut par défaut refs/remotes/${3:-origin}/$1 # note: cette fonction retourne vrai si $1 et $2 identifient le même commit local o b s; __git_init_ff "$@" || return __git_can_ff "$b" "$s" } function git_should_ff() { # vérifier si la branche $1 devrait être fast-forwardée à partir de la - # branche d'origine $2, qui vaut par défaut remotes/${3:-origin}/$1 + # branche d'origine $2, qui vaut par défaut refs/remotes/${3:-origin}/$1 # note: cette fonction est similaire à git_is_ancestor(), mais retourne # false si $1 et $2 identifient le même commit local o b s; __git_init_ff "$@" || return [ "$b" != "$s" ] || return 1 - __git_can_ff "$b" "$o" + __git_can_ff "$b" "$s" } function git_should_push() { # vérifier si la branche $1 devrait être poussée vers la branche de même nom # dans l'origine $2(=origin), parce que l'origin peut-être fast-forwardée à # partir de cette branche. - git_should_ff "remotes/${2:-origin}/$1" "$1" + git_should_ff "refs/remotes/${2:-origin}/$1" "$1" } function git_fast_forward() { # vérifier que la branche courante est bien $1, puis tester s'il faut la # fast-forwarder à partir de la branche d'origine $2, puis le faire si c'est - # nécessaire. la branche d'origine $2 vaut par défaut remotes/origin/$1 + # nécessaire. la branche d'origine $2 vaut par défaut refs/remotes/origin/$1 local o b s; __git_init_ff "$@" || return [ "$b" != "$s" ] || return 1 local head="$(git rev-parse HEAD)" diff --git a/uproject b/uproject index 6b22edf..eaf77fb 100755 --- a/uproject +++ b/uproject @@ -44,6 +44,10 @@ 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) + -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, + essayer de fast-fowarder toutes les branches locales traquées. diff [options] Afficher les différences. -l Afficher les différences non commitées (par défaut) From abc2ff36832e5e49fac8e132f4bab925b93e3b59 Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Wed, 20 May 2015 12:08:44 +0400 Subject: [PATCH 3/4] Init changelog & version 1.10.0 --- CHANGES.txt | 7 +++++++ VERSION.txt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index ac1bd5d..cba4985 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,10 @@ +## Version 1.10.0 du 20/05/2015-12:08 + +bf1d86a Intégration de la branche pu-auto-forward +8bf8164 fast-forwarder automatiquement les branches locales par rapport aux branches distantes +8baabea Intégration de la branche ptools-maj-topic +5ff5b7d déterminer les branches de topic: ignorer les branches avec un slash dans le nom + ## Version 1.9.0 du 19/05/2015-18:25 5933089 Intégration de la branche awkfsv diff --git a/VERSION.txt b/VERSION.txt index f8e233b..81c871d 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -1.9.0 +1.10.0 From 1ef4f19296db253fe07b24bc4afc8b2468f4c852 Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Wed, 20 May 2015 12:09:24 +0400 Subject: [PATCH 4/4] maj de ulib --- lib/ulib/.ulibver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ulib/.ulibver b/lib/ulib/.ulibver index c0cd064..35f7945 100644 --- a/lib/ulib/.ulibver +++ b/lib/ulib/.ulibver @@ -1 +1 @@ -009001000 +009002000