From 89ad130dc38eac87e5da87eed37778665035a374 Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Tue, 19 May 2015 10:27:15 +0400 Subject: [PATCH] support de git-annex pour pp et pdev --- lib/ulib/ptools | 17 ++++++++++++++++- lib/ulib/vcs | 15 +++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/ulib/ptools b/lib/ulib/ptools index d1f62fb..09b348a 100644 --- a/lib/ulib/ptools +++ b/lib/ulib/ptools @@ -11,6 +11,7 @@ function is_any_branch() { if [ -z "$branch" ]; then branch="$(git_get_branch)" || return 2 fi + local annex; git_have_annex && annex=1 local spec r for spec in "$@"; do case "$spec" in @@ -36,6 +37,10 @@ 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 return 0 ;; -m|-master) @@ -56,6 +61,10 @@ 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 return 1 ;; esac @@ -82,7 +91,13 @@ function list_feature_branches() { grep -vF master | grep -vF develop | grep -v '^release-' | - grep -v '^hotfix-' + grep -v '^hotfix-' | + if git_have_annex; then + grep -vF git-annex | + grep -v '^synced/' + else + cat + fi } ################################################################################ diff --git a/lib/ulib/vcs b/lib/ulib/vcs index a2b196f..61483c1 100644 --- a/lib/ulib/vcs +++ b/lib/ulib/vcs @@ -369,6 +369,9 @@ function git_getrepos() { function git_geturl() { git config --get remote.origin.url } +function git_have_annex() { + [ -n "$(git config --get annex.uuid)" ] +} function git_add() { git add "$@" } @@ -450,13 +453,14 @@ function git_update() { git pull "$@" } function git_push() { - local all all_branches all_tags auto force args + local all all_branches all_tags auto force args no_annex parse_opts + "${PRETTYOPTS[@]}" \ -a,--all all=1 \ -b,--branches,--all-branches all_branches=1 \ -t,--tags,--all-tags all_tags=1 \ --auto auto=1 \ -f,--force force=1 \ + -n,--no-annex no_annex=1 \ @ args -- "$@" && set -- "${args[@]}" || { eerror "$args" return 1 @@ -479,6 +483,13 @@ function git_push() { # On a demandé à pusher tous les tags git push --tags return $? + elif git_have_annex; then + # Si une annexe existe dans le dépôt, demander à git-annex de faire la + # synchronisation, sauf si --no-annex est spécifié + if [ -z "$no_annex" ]; then + git annex sync + return $? + fi fi # sinon on push vers origin. vérifier la présence du remote @@ -690,7 +701,7 @@ function git_annex_initial() { local GIT_DIR GIT_WORK_TREE [ "$(cd "$repodir"; git rev-parse --is-bare-repository)" == false ] || return 0 - [ -n "$(GIT_DIR="$repodir/.git" git config annex.uuid)" ] && return 0 + [ -n "$(GIT_DIR="$repodir/.git" git config --get annex.uuid)" ] && return 0 # ici, on sait que git annex n'a pas encore été configuré # vérifier s'il existe des fichiers annexés