Spaces:
Runtime error
Runtime error
LPX55
commited on
Commit
·
38c0d61
1
Parent(s):
a5723a0
Update .gitignore to exclude .pyc files, modify app.py to use demo.queue().launch for improved functionality, and add rebase.sh script for automated git rebase operations with branch detection.
Browse files- .gitignore +1 -0
- app.py +1 -1
- rebase.sh +62 -0
.gitignore
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
env/
|
2 |
__pycache__
|
3 |
__pycache__/*
|
|
|
|
1 |
env/
|
2 |
__pycache__
|
3 |
__pycache__/*
|
4 |
+
.pyc
|
app.py
CHANGED
@@ -177,4 +177,4 @@ print(client.predict("Alex", 5, False, api_name="/greet"))
|
|
177 |
|
178 |
shared_state.change(pretty_json, shared_state, shared_state_box)
|
179 |
|
180 |
-
demo.launch(mcp_server=True)
|
|
|
177 |
|
178 |
shared_state.change(pretty_json, shared_state, shared_state_box)
|
179 |
|
180 |
+
demo.queue().launch(mcp_server=True)
|
rebase.sh
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Script to handle git rebase with branch name detection
|
4 |
+
|
5 |
+
# Confirmation prompt to ensure user understands the script's impact
|
6 |
+
echo "WARNING: This script performs destructive operations on your git repository."
|
7 |
+
echo "It will delete and rename branches, and force push changes."
|
8 |
+
read -p "Are you sure you want to proceed? (y/N): " CONFIRM
|
9 |
+
if [[ ! "$CONFIRM" =~ ^[Yy]$ ]]; then
|
10 |
+
echo "Operation cancelled by user."
|
11 |
+
exit 1
|
12 |
+
fi
|
13 |
+
echo "Proceeding with the script..."
|
14 |
+
|
15 |
+
# Function to check if a branch exists
|
16 |
+
branch_exists() {
|
17 |
+
git rev-parse --verify "$1" >/dev/null 2>&1
|
18 |
+
}
|
19 |
+
|
20 |
+
# Check for 'main' branch
|
21 |
+
if branch_exists "main"; then
|
22 |
+
TARGET_BRANCH="main"
|
23 |
+
echo "Found 'main' branch. Using it as the target."
|
24 |
+
# Check for 'master' branch if 'main' is not found
|
25 |
+
elif branch_exists "master"; then
|
26 |
+
TARGET_BRANCH="master"
|
27 |
+
echo "Found 'master' branch. Using it as the target."
|
28 |
+
else
|
29 |
+
# Neither 'main' nor 'master' found, prompt user for branch name
|
30 |
+
echo "Neither 'main' nor 'master' branch found."
|
31 |
+
read -p "Please enter the target branch name (or press Enter to exit): " TARGET_BRANCH
|
32 |
+
if [ -z "$TARGET_BRANCH" ]; then
|
33 |
+
echo "No branch name provided. Exiting."
|
34 |
+
exit 1
|
35 |
+
fi
|
36 |
+
if ! branch_exists "$TARGET_BRANCH"; then
|
37 |
+
echo "Branch '$TARGET_BRANCH' does not exist. Exiting."
|
38 |
+
exit 1
|
39 |
+
fi
|
40 |
+
echo "Using '$TARGET_BRANCH' as the target branch."
|
41 |
+
fi
|
42 |
+
|
43 |
+
# Execute the git commands with the determined branch
|
44 |
+
echo "Creating orphan branch 'latest_branch'..."
|
45 |
+
git checkout --orphan latest_branch
|
46 |
+
|
47 |
+
echo "Adding all changes..."
|
48 |
+
git add -A
|
49 |
+
|
50 |
+
echo "Committing changes..."
|
51 |
+
git commit -am "commit message"
|
52 |
+
|
53 |
+
echo "Deleting the target branch '$TARGET_BRANCH'..."
|
54 |
+
git branch -D "$TARGET_BRANCH"
|
55 |
+
|
56 |
+
echo "Renaming current branch to '$TARGET_BRANCH'..."
|
57 |
+
git branch -m "$TARGET_BRANCH"
|
58 |
+
|
59 |
+
echo "Force pushing to origin '$TARGET_BRANCH'..."
|
60 |
+
git push -f origin "$TARGET_BRANCH"
|
61 |
+
|
62 |
+
echo "Script completed successfully."
|