fix: cherry-pick conflict
This commit is contained in:
@@ -128,40 +128,29 @@ git add app.py
|
|||||||
git commit -m "Add beta features framework" | Out-Null
|
git commit -m "Add beta features framework" | Out-Null
|
||||||
|
|
||||||
# Commit 4: Performance bug fix (SHOULD be cherry-picked)
|
# Commit 4: Performance bug fix (SHOULD be cherry-picked)
|
||||||
$appWithPerformance = @"
|
# This commit adds caching to the existing file to fix performance
|
||||||
class App:
|
# It should apply cleanly to main since it doesn't depend on experimental features
|
||||||
|
$performanceCode = @"
|
||||||
|
|
||||||
|
class DataCache:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.version = '1.0.0'
|
|
||||||
self.experimental_mode = False
|
|
||||||
self.beta_features = []
|
|
||||||
self.cache = {}
|
self.cache = {}
|
||||||
|
|
||||||
def start(self):
|
def get(self, key):
|
||||||
print('App started')
|
|
||||||
if self.experimental_mode:
|
|
||||||
self.enable_experimental_features()
|
|
||||||
|
|
||||||
def enable_experimental_features(self):
|
|
||||||
print('Experimental features enabled')
|
|
||||||
|
|
||||||
def add_beta_feature(self, feature):
|
|
||||||
self.beta_features.append(feature)
|
|
||||||
|
|
||||||
def get_data(self, key):
|
|
||||||
# Use cache to improve performance
|
# Use cache to improve performance
|
||||||
if key in self.cache:
|
if key in self.cache:
|
||||||
return self.cache[key]
|
return self.cache[key]
|
||||||
data = self.fetch_data(key)
|
return None
|
||||||
self.cache[key] = data
|
|
||||||
return data
|
|
||||||
|
|
||||||
def fetch_data(self, key):
|
def set(self, key, value):
|
||||||
# Simulate data fetching
|
self.cache[key] = value
|
||||||
return {'key': key, 'value': 'data'}
|
|
||||||
|
def clear(self):
|
||||||
|
self.cache.clear()
|
||||||
"@
|
"@
|
||||||
|
|
||||||
Set-Content -Path "app.py" -Value $appWithPerformance
|
Set-Content -Path "cache.py" -Value $performanceCode
|
||||||
git add app.py
|
git add cache.py
|
||||||
git commit -m "Fix performance issue with data caching" | Out-Null
|
git commit -m "Fix performance issue with data caching" | Out-Null
|
||||||
|
|
||||||
# Return to module directory
|
# Return to module directory
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ if ($mainCommitCount -ne 4) {
|
|||||||
} else {
|
} else {
|
||||||
Write-Host "Hint: You should cherry-pick ONLY the 2 bug fix commits, not all commits" -ForegroundColor Yellow
|
Write-Host "Hint: You should cherry-pick ONLY the 2 bug fix commits, not all commits" -ForegroundColor Yellow
|
||||||
}
|
}
|
||||||
Write-Host "`nExpected commits on $mainBranch:" -ForegroundColor Yellow
|
Write-Host "`nExpected commits on ${mainBranch}:" -ForegroundColor Yellow
|
||||||
Write-Host " 1. Initial app implementation" -ForegroundColor White
|
Write-Host " 1. Initial app implementation" -ForegroundColor White
|
||||||
Write-Host " 2. Add README" -ForegroundColor White
|
Write-Host " 2. Add README" -ForegroundColor White
|
||||||
Write-Host " 3. Fix security vulnerability in input validation (cherry-picked)" -ForegroundColor White
|
Write-Host " 3. Fix security vulnerability in input validation (cherry-picked)" -ForegroundColor White
|
||||||
@@ -125,23 +125,32 @@ if (-not (Test-Path "app.py")) {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that app.py has the performance fix (cache) but NOT experimental features
|
# Check that cache.py exists (from performance fix)
|
||||||
$appContent = Get-Content "app.py" -Raw
|
if (-not (Test-Path "cache.py")) {
|
||||||
|
Write-Host "[FAIL] cache.py not found on $mainBranch branch." -ForegroundColor Red
|
||||||
# Should have cache (from performance fix)
|
|
||||||
if ($appContent -notmatch "cache") {
|
|
||||||
Write-Host "[FAIL] app.py is missing the performance fix (cache)." -ForegroundColor Red
|
|
||||||
Write-Host "Hint: You need to cherry-pick the 'Fix performance issue' commit" -ForegroundColor Yellow
|
Write-Host "Hint: You need to cherry-pick the 'Fix performance issue' commit" -ForegroundColor Yellow
|
||||||
Set-Location ..
|
Set-Location ..
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($appContent -notmatch "get_data") {
|
# Check that cache.py has the DataCache class
|
||||||
Write-Host "[FAIL] app.py is missing the get_data method from performance fix." -ForegroundColor Red
|
$cacheContent = Get-Content "cache.py" -Raw
|
||||||
|
|
||||||
|
if ($cacheContent -notmatch "DataCache") {
|
||||||
|
Write-Host "[FAIL] cache.py is missing the DataCache class." -ForegroundColor Red
|
||||||
Set-Location ..
|
Set-Location ..
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($cacheContent -notmatch "def get\(") {
|
||||||
|
Write-Host "[FAIL] cache.py is missing the get method." -ForegroundColor Red
|
||||||
|
Set-Location ..
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check that app.py does NOT have experimental features
|
||||||
|
$appContent = Get-Content "app.py" -Raw
|
||||||
|
|
||||||
# Should NOT have experimental features
|
# Should NOT have experimental features
|
||||||
if ($appContent -match "experimental_mode") {
|
if ($appContent -match "experimental_mode") {
|
||||||
Write-Host "[FAIL] app.py contains experimental features (experimental_mode)." -ForegroundColor Red
|
Write-Host "[FAIL] app.py contains experimental features (experimental_mode)." -ForegroundColor Red
|
||||||
|
|||||||
Reference in New Issue
Block a user