Christine Ye
commited on
Commit
Β·
e7898c2
1
Parent(s):
3c74b88
Merge with main - auto-resolved
Browse files- resolve.sh +35 -40
resolve.sh
CHANGED
|
@@ -39,51 +39,46 @@ resolve_gitattributes() {
|
|
| 39 |
|
| 40 |
git checkout pr/$pr_num 2>/dev/null
|
| 41 |
|
| 42 |
-
#
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
fi
|
| 47 |
-
|
| 48 |
-
# Check if .gitattributes has conflicts
|
| 49 |
-
if ! git status --porcelain | grep -q "^UU .gitattributes"; then
|
| 50 |
-
echo " βΉοΈ No .gitattributes conflicts in PR #$pr_num"
|
| 51 |
-
return 0
|
| 52 |
-
fi
|
| 53 |
-
|
| 54 |
-
echo " π§ Resolving .gitattributes conflict..."
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
grep -v "^<<<<<<<" .gitattributes | \
|
| 61 |
-
grep -v "^=======" | \
|
| 62 |
-
grep -v "^>>>>>>>" | \
|
| 63 |
-
sort -u > .gitattributes.tmp
|
| 64 |
-
|
| 65 |
-
mv .gitattributes.tmp .gitattributes
|
| 66 |
-
|
| 67 |
-
# Stage the resolved file
|
| 68 |
-
git add .gitattributes
|
| 69 |
|
| 70 |
-
#
|
| 71 |
-
if
|
| 72 |
-
echo "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
| 75 |
-
if git push origin pr/$pr_num:refs/pr/$pr_num 2>/dev/null; then
|
| 76 |
-
echo " β
Successfully pushed to HuggingFace PR #$pr_num"
|
| 77 |
-
else
|
| 78 |
-
echo " β Failed to push to HuggingFace PR #$pr_num"
|
| 79 |
-
return 1
|
| 80 |
-
fi
|
| 81 |
-
else
|
| 82 |
-
echo " β Failed to commit resolution for PR #$pr_num"
|
| 83 |
-
return 1
|
| 84 |
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
else
|
| 86 |
-
echo " β
|
| 87 |
return 1
|
| 88 |
fi
|
| 89 |
|
|
|
|
| 39 |
|
| 40 |
git checkout pr/$pr_num 2>/dev/null
|
| 41 |
|
| 42 |
+
# Try to merge with main to trigger any conflicts
|
| 43 |
+
echo " π Attempting merge with main..."
|
| 44 |
+
merge_output=$(git merge main 2>&1)
|
| 45 |
+
merge_status=$?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
if [ $merge_status -eq 0 ]; then
|
| 48 |
+
echo " βΉοΈ No conflicts found in PR #$pr_num (merge successful)"
|
| 49 |
+
else
|
| 50 |
+
echo " π§ Merge conflicts detected, resolving..."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
+
# Check if .gitattributes has conflicts and resolve them
|
| 53 |
+
if [ -f .gitattributes ] && grep -q "^<<<<<<<" .gitattributes; then
|
| 54 |
+
echo " π§ Resolving .gitattributes conflict..."
|
| 55 |
+
# Remove conflict markers and duplicate lines
|
| 56 |
+
grep -v "^<<<<<<<" .gitattributes | \
|
| 57 |
+
grep -v "^=======" | \
|
| 58 |
+
grep -v "^>>>>>>>" | \
|
| 59 |
+
sort -u > .gitattributes.tmp
|
| 60 |
|
| 61 |
+
mv .gitattributes.tmp .gitattributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
fi
|
| 63 |
+
fi
|
| 64 |
+
|
| 65 |
+
# Always stage all files and commit/push regardless of merge status
|
| 66 |
+
echo " π¦ Staging all files..."
|
| 67 |
+
git add .
|
| 68 |
+
|
| 69 |
+
# Commit (this will work whether there were conflicts or not)
|
| 70 |
+
if git commit -m "Merge with main - auto-resolved" 2>/dev/null; then
|
| 71 |
+
echo " β
Changes committed"
|
| 72 |
+
else
|
| 73 |
+
echo " βΉοΈ No changes to commit (already up to date)"
|
| 74 |
+
fi
|
| 75 |
+
|
| 76 |
+
# Always try to push
|
| 77 |
+
echo " π Pushing to HuggingFace..."
|
| 78 |
+
if git push origin pr/$pr_num:refs/pr/$pr_num 2>/dev/null; then
|
| 79 |
+
echo " β
Successfully pushed to HuggingFace PR #$pr_num"
|
| 80 |
else
|
| 81 |
+
echo " β Failed to push to HuggingFace PR #$pr_num"
|
| 82 |
return 1
|
| 83 |
fi
|
| 84 |
|