48 lines
1.4 KiB
Bash
Executable File
48 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Mundo Telecom - Verificar atualizações upstream
|
|
#
|
|
# Uso: ./check-upstream.sh [repo-dir]
|
|
# Verifica se há commits novos no GitHub e reporta o que mudou.
|
|
#
|
|
# Exemplo:
|
|
# ./check-upstream.sh /usr/src/fusionpbx
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_DIR="${1:-.}"
|
|
cd "$REPO_DIR"
|
|
|
|
echo "============================================"
|
|
echo " 📡 Verificando atualizações..."
|
|
echo " Repositório: $(basename $(git rev-parse --show-toplevel))"
|
|
echo "============================================"
|
|
|
|
# Buscar mudanças do upstream
|
|
git fetch upstream 2>&1
|
|
|
|
# Verificar se está atrás
|
|
BEHIND=$(git rev-list --count HEAD..upstream/master 2>/dev/null || echo 0)
|
|
AHEAD=$(git rev-list --count upstream/master..HEAD 2>/dev/null || echo 0)
|
|
|
|
echo ""
|
|
echo " 📊 Status:"
|
|
echo " Atrás do upstream: $BEHIND commits"
|
|
echo " À frente do upstream: $AHEAD commits (nossas alterações)"
|
|
echo ""
|
|
|
|
if [ "$BEHIND" -gt 0 ]; then
|
|
echo " 📋 Últimos commits do upstream:"
|
|
git log HEAD..upstream/master --oneline --no-decorate -10 2>/dev/null || true
|
|
echo ""
|
|
echo " ⚠️ Há $BEHIND novos commits para revisar!"
|
|
echo " Para atualizar:"
|
|
echo " git checkout -b update-$(date +%Y%m%d)"
|
|
echo " git merge upstream/master"
|
|
echo " # Testar e depois fazer merge na master"
|
|
echo ""
|
|
echo " Para ver o diff completo:"
|
|
echo " git diff HEAD..upstream/master --stat"
|
|
else
|
|
echo " ✅ Repositório atualizado com o upstream!"
|
|
fi
|