#!/bin/bash

# 简洁的代码对比脚本
echo "🔍 代码对比报告"
echo "==========================================="
echo ""

# 检查old远程仓库是否存在
if ! git remote | grep -q "old"; then
    echo "❌ 请先添加old远程仓库: git remote add old https://github.com/perfect-panel/server.git && git fetch old"
    exit 1
fi

echo "📋 文件变更对比:"
echo "-------------------------------------------"
echo "我们修改的文件:"
git diff --name-status old/master main | grep -E '^[AM]' | sed 's/^A/🆕 新增: /' | sed 's/^M/✏️  修改: /'
echo ""
echo "他们修改的文件:"
git diff --name-status main old/master | grep -E '^[AM]' | sed 's/^A/🆕 新增: /' | sed 's/^M/✏️  修改: /'
echo ""

echo "📊 变更统计:"
echo "-------------------------------------------"
echo "我们的变更:"
git diff --stat --color=always old/master main | tail -1
echo "他们的变更:"
git diff --stat --color=always main old/master | tail -1
echo ""

echo "✅ 对比完成！"