feat: add more commits to the merging challenges
This commit is contained in:
@@ -57,11 +57,45 @@ Set-Content -Path "app.py" -Value $appContent
|
|||||||
git add .
|
git add .
|
||||||
git commit -m "Initial project structure" | Out-Null
|
git commit -m "Initial project structure" | Out-Null
|
||||||
|
|
||||||
|
# Commit 2: Add configuration file on main
|
||||||
|
Write-Host "Adding configuration..." -ForegroundColor Green
|
||||||
|
$configContent = @"
|
||||||
|
# config.py - Configuration settings
|
||||||
|
|
||||||
|
APP_NAME = "My Project"
|
||||||
|
VERSION = "1.0.0"
|
||||||
|
DEBUG = False
|
||||||
|
"@
|
||||||
|
Set-Content -Path "config.py" -Value $configContent
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "Add basic configuration" | Out-Null
|
||||||
|
|
||||||
|
# Commit 3: Add database utilities on main
|
||||||
|
Write-Host "Adding database utilities..." -ForegroundColor Green
|
||||||
|
$dbContent = @"
|
||||||
|
# database.py - Database utilities
|
||||||
|
|
||||||
|
def connect():
|
||||||
|
"""Connect to database."""
|
||||||
|
print("Connecting to database...")
|
||||||
|
return True
|
||||||
|
|
||||||
|
def disconnect():
|
||||||
|
"""Disconnect from database."""
|
||||||
|
print("Disconnecting...")
|
||||||
|
return True
|
||||||
|
"@
|
||||||
|
Set-Content -Path "database.py" -Value $dbContent
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "Add database utilities" | Out-Null
|
||||||
|
|
||||||
# Create feature-login branch
|
# Create feature-login branch
|
||||||
Write-Host "Creating feature-login branch..." -ForegroundColor Green
|
Write-Host "Creating feature-login branch..." -ForegroundColor Green
|
||||||
git switch -c feature-login | Out-Null
|
git switch -c feature-login | Out-Null
|
||||||
|
|
||||||
# Commit on feature-login: Add login module
|
# Commit 4: Add login module on feature-login
|
||||||
Write-Host "Adding login functionality on feature-login..." -ForegroundColor Green
|
Write-Host "Adding login functionality on feature-login..." -ForegroundColor Green
|
||||||
$loginContent = @"
|
$loginContent = @"
|
||||||
# login.py - User login module
|
# login.py - User login module
|
||||||
@@ -82,7 +116,36 @@ Set-Content -Path "login.py" -Value $loginContent
|
|||||||
git add .
|
git add .
|
||||||
git commit -m "Add login module" | Out-Null
|
git commit -m "Add login module" | Out-Null
|
||||||
|
|
||||||
# Second commit on feature-login: Integrate login with app
|
# Commit 5: Add password validation on feature-login
|
||||||
|
$loginContent = @"
|
||||||
|
# login.py - User login module
|
||||||
|
|
||||||
|
def validate_password(password):
|
||||||
|
"""Validate password strength."""
|
||||||
|
if len(password) < 8:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
def login(username, password):
|
||||||
|
"""Authenticate a user."""
|
||||||
|
if not validate_password(password):
|
||||||
|
print("Password too weak!")
|
||||||
|
return False
|
||||||
|
print(f"Authenticating user: {username}")
|
||||||
|
# TODO: Add actual authentication logic
|
||||||
|
return True
|
||||||
|
|
||||||
|
def logout(username):
|
||||||
|
"""Log out a user."""
|
||||||
|
print(f"Logging out user: {username}")
|
||||||
|
return True
|
||||||
|
"@
|
||||||
|
Set-Content -Path "login.py" -Value $loginContent
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "Add password validation" | Out-Null
|
||||||
|
|
||||||
|
# Commit 6: Integrate login with app on feature-login
|
||||||
$appContent = @"
|
$appContent = @"
|
||||||
# app.py - Main application file
|
# app.py - Main application file
|
||||||
from login import login, logout
|
from login import login, logout
|
||||||
@@ -90,7 +153,7 @@ from login import login, logout
|
|||||||
def main():
|
def main():
|
||||||
print("Welcome to My App!")
|
print("Welcome to My App!")
|
||||||
# Add login integration
|
# Add login integration
|
||||||
if login("testuser", "password"):
|
if login("testuser", "password123"):
|
||||||
print("Login successful!")
|
print("Login successful!")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -102,11 +165,30 @@ Set-Content -Path "app.py" -Value $appContent
|
|||||||
git add .
|
git add .
|
||||||
git commit -m "Integrate login with main app" | Out-Null
|
git commit -m "Integrate login with main app" | Out-Null
|
||||||
|
|
||||||
|
# Commit 7: Add session management on feature-login
|
||||||
|
$sessionContent = @"
|
||||||
|
# session.py - Session management
|
||||||
|
|
||||||
|
class Session:
|
||||||
|
def __init__(self, username):
|
||||||
|
self.username = username
|
||||||
|
self.active = True
|
||||||
|
|
||||||
|
def end(self):
|
||||||
|
"""End the session."""
|
||||||
|
self.active = False
|
||||||
|
print(f"Session ended for {self.username}")
|
||||||
|
"@
|
||||||
|
Set-Content -Path "session.py" -Value $sessionContent
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "Add session management" | Out-Null
|
||||||
|
|
||||||
# Switch back to main branch
|
# Switch back to main branch
|
||||||
Write-Host "Switching back to main branch..." -ForegroundColor Green
|
Write-Host "Switching back to main branch..." -ForegroundColor Green
|
||||||
git switch main | Out-Null
|
git switch main | Out-Null
|
||||||
|
|
||||||
# Make a commit on main (creates divergence)
|
# Commit 8: Update README on main (creates divergence)
|
||||||
Write-Host "Adding documentation on main (creates divergence)..." -ForegroundColor Green
|
Write-Host "Adding documentation on main (creates divergence)..." -ForegroundColor Green
|
||||||
$readmeContent = @"
|
$readmeContent = @"
|
||||||
# My Project
|
# My Project
|
||||||
@@ -132,14 +214,29 @@ Set-Content -Path "README.md" -Value $readmeContent
|
|||||||
git add .
|
git add .
|
||||||
git commit -m "Update README with setup instructions" | Out-Null
|
git commit -m "Update README with setup instructions" | Out-Null
|
||||||
|
|
||||||
|
# Commit 9: Update configuration on main
|
||||||
|
$configContent = @"
|
||||||
|
# config.py - Configuration settings
|
||||||
|
|
||||||
|
APP_NAME = "My Project"
|
||||||
|
VERSION = "1.0.0"
|
||||||
|
DEBUG = False
|
||||||
|
DATABASE_PATH = "./data/app.db"
|
||||||
|
LOG_LEVEL = "INFO"
|
||||||
|
"@
|
||||||
|
Set-Content -Path "config.py" -Value $configContent
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "Add database path to config" | Out-Null
|
||||||
|
|
||||||
# Return to module directory
|
# Return to module directory
|
||||||
Set-Location ..
|
Set-Location ..
|
||||||
|
|
||||||
Write-Host "`n=== Setup Complete! ===" -ForegroundColor Green
|
Write-Host "`n=== Setup Complete! ===" -ForegroundColor Green
|
||||||
Write-Host "`nYour challenge environment is ready in the 'challenge/' directory." -ForegroundColor Cyan
|
Write-Host "`nYour challenge environment is ready in the 'challenge/' directory." -ForegroundColor Cyan
|
||||||
Write-Host "`nScenario: You have two divergent branches!" -ForegroundColor Yellow
|
Write-Host "`nScenario: You have two divergent branches!" -ForegroundColor Yellow
|
||||||
Write-Host " - main: Has updated documentation" -ForegroundColor White
|
Write-Host " - main: Has 5 commits (config, database utils, README updates)" -ForegroundColor White
|
||||||
Write-Host " - feature-login: Has new login functionality" -ForegroundColor White
|
Write-Host " - feature-login: Has 4 commits (login, validation, session)" -ForegroundColor White
|
||||||
Write-Host "`nNext steps:" -ForegroundColor Cyan
|
Write-Host "`nNext steps:" -ForegroundColor Cyan
|
||||||
Write-Host " 1. cd challenge" -ForegroundColor White
|
Write-Host " 1. cd challenge" -ForegroundColor White
|
||||||
Write-Host " 2. View the branch structure: git log --oneline --graph --all" -ForegroundColor White
|
Write-Host " 2. View the branch structure: git log --oneline --graph --all" -ForegroundColor White
|
||||||
|
|||||||
Reference in New Issue
Block a user