Skip to content

Commit

Permalink
Script to prepare first upstreaming PR
Browse files Browse the repository at this point in the history
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
  • Loading branch information
ydirson committed Aug 22, 2023
1 parent df36a32 commit cfa47a5
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions devscripts/extract-pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh
set -e

TARGETBRANCH="$1"

CRATES="
plugins/xcp-metrics-plugin-squeezed
plugins/xcp-metrics-plugin-common
xcp-metrics-common
"

CRATES_RE=$(echo $CRATES | tr ' ' '|')

CONTENTS="
$CRATES
Cargo.toml
.gitignore
.github
LICENSE
"

# new branch for initial commit
git switch --orphan "$TARGETBRANCH"
# with specified contents
git restore -WS --source="main" $CONTENTS

# and only specified crates in workspace
sed -E -i Cargo.toml -e '/^[^ ]/ p
\,"('$CRATES_RE')", p
d'
git add Cargo.toml

# commit
<<EOF cat |
WIP Introduce xcp-metrics-plugin-squeezed plugin for xcp-rrdd
xcp-metrics-plugin-squeezed is meant as a drop-in replacecement for
rrdp-squeezed, as a first Rust-written brick for XAPI.
EOF
git commit -F - --author=Teddy

0 comments on commit cfa47a5

Please sign in to comment.