Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mongodb
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
mongodb
Commits
30592df1
Commit
30592df1
authored
6 months ago
by
daffie
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3503067
by daffie: Create script to create Drupal core patch
parent
29a313fa
Branches
Branches containing commit
Tags
3.0.0
Tags containing commit
1 merge request
!36
Added script to generate a Drupal core patch from the PR from the Drupal core issue
Pipeline
#409272
failed
6 months ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/generate-core-patch.sh
+86
-0
86 additions, 0 deletions
scripts/generate-core-patch.sh
with
86 additions
and
0 deletions
scripts/generate-core-patch.sh
0 → 100755
+
86
−
0
View file @
30592df1
#!/bin/bash
# This script is to generate a Drupal core patch from the PR for the full support issue.
# The expected first parameter is the file name of the downloaded PR.
# The expected second parameter is the version for which to create the patch file.
if
[[
-z
$1
]]
;
then
echo
"The patch file to generate the Drupal core patch file for must be given as the first parameter"
exit
1
;
fi
if
[[
!
-f
$1
]]
;
then
echo
"The patch file to generate the Drupal core patch file for does not exist."
exit
1
;
fi
if
[[
-z
$2
]]
;
then
echo
"The patch file to generate the Drupal core patch file for must be given a version as the second parameter"
exit
1
;
fi
echo
'Start generating Drupal core patch file...'
# Get the current directory to copy the created patch file to.
currentdir
=
$(
pwd
)
# Create a temporary directory.
tempdir
=
$(
mktemp
-d
)
# Copy the base PR file to the temporary directory.
cp
$1
$tempdir
# Make the temporary directory the current working directory
cd
$tempdir
if
[[
!
-f
$1
]]
;
then
echo
"The patch file to generate the Drupal core patch file for does not exist in the temporary directory: '
$tempdir
'."
exit
1
;
fi
# Split the base PR file into single file with one for every file change.
splitdiff
-ad
$1
>
/dev/null 2>&1
# Remove all the test files.
find
.
-name
'*Test.php.patch'
| xargs
rm
-f
find
.
-name
'*tests*'
| xargs
rm
-f
find
.
-name
'*Test*'
| xargs
rm
-f
# Remove all the mongodb module files.
find
.
-name
'*core_modules_mongodb*'
| xargs
rm
-f
# Remove the composer changes.
find
.
-name
'*composer*'
| xargs
rm
-f
# Remove the GitLab pipeline file changes.
find
.
-name
'*gitlab*'
| xargs
rm
-f
# Remove the PHPStan baseline file changes.
find
.
-name
'*phpstan-baseline*'
| xargs
rm
-f
# Remove the CSpell file changes.
find
.
-name
'*cspell*'
| xargs
rm
-f
#find . -name '*migrate_source*' | xargs rm -f
# Get the number of file changes.
count
=
$(
ls
-1
|
wc
-l
)
printf
"%s
\n
"
'The Drupal core patch has '
$count
' file changes'
combined
=
'drupal-core-'
$2
touch
$combined
'.diff'
# Create the Drupal core patch file.
cat
*
.patch
>>
$combined
'.diff'
# Copy the created Drupal core patch file to the current directory.
cp
$combined
'.diff'
$currentdir
/
$combined
'.patch'
echo
"Finished! The Drupal core patch file is: '
$combined
.patch'"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment