Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9313672
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
View Options
diff --git a/jobs/templates/includes/stage-apply-phabricator-diff.groovy.j2 b/jobs/templates/includes/stage-apply-phabricator-diff.groovy.j2
index 406f0ba..c7070f1 100644
--- a/jobs/templates/includes/stage-apply-phabricator-diff.groovy.j2
+++ b/jobs/templates/includes/stage-apply-phabricator-diff.groovy.j2
@@ -1,68 +1,69 @@
stage('Apply phabricator diff') {
steps {
script {
comment = sh(
script: '''
#!/bin/bash
set -e
ORIGINAL_TAG=base-revision-${BUILD_NUMBER}-D${REV_ID}
ORIGINAL_COMMIT=$(git rev-parse --short=10 HEAD)
echo "==== Patch application report for D${REV_ID} (id=${DIFF_ID}) ===="
echo
git tag -f ${ORIGINAL_TAG} >/dev/null
git fetch -n ${STAGING_URI} +refs/tags/phabricator/diff/${DIFF_ID}:diff-target +refs/tags/phabricator/base/${DIFF_ID}:diff-base >/dev/null
rebased=0
if git merge-base --is-ancestor diff-base HEAD; then
echo "**Rebasing** onto ${ORIGINAL_COMMIT}..."
echo
echo '```'
git rebase --onto ${ORIGINAL_TAG} diff-base diff-target && rebased=1 || rebase_exit=$?
echo '```'
if [ $rebased -eq 0 ]; then
echo
echo "Rebase failed (ret=${rebase_exit})!"
echo
echo '```'
git rebase --abort || true
echo '```'
fi
fi
merged=0
if [ $rebased -eq 0 ]; then
echo "Could not rebase; Attempt **merge** onto ${ORIGINAL_COMMIT}..."
echo
echo '```'
git merge --no-edit diff-target && merged=1 || merge_exit=$?
echo '```'
if [ $merged -eq 0 ]; then
echo
echo "Merge failed (ret=${merge_exit})!"
echo
fi
fi
if [ $merged -eq 1 -o $rebased -eq 1 ]; then
echo
echo "===== Changes applied before test ====="
echo
echo '```'
git log ${ORIGINAL_TAG}..
echo '```'
else
echo '**Attempts to apply the diff failed!**'
exit 1
fi
+ git tag -d ${ORIGINAL_TAG}
''',
label: 'Apply patch',
returnStdout: true,
)
writeFile(
file: '.phabricator-comment',
text: comment,
)
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Jul 3, 11:50 AM (4 d, 18 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3273542
Attached To
rCJSWH Jenkins jobs
Event Timeline
Log In to Comment