Youen
2 years ago
4 changed files with 47 additions and 21 deletions
@ -0,0 +1,14 @@
|
||||
from subprocess import Popen, PIPE, STDOUT |
||||
|
||||
def run(cmd): |
||||
p = Popen(cmd, stdout = PIPE, stderr = STDOUT, shell = True) |
||||
outputStr = "" |
||||
for line in p.stdout: |
||||
outputStr += line.decode() |
||||
|
||||
p.wait() |
||||
|
||||
if p.returncode != 0: |
||||
raise Exception("Command failed ("+str(p.returncode)+")\n"+cmd+"\n"+outputStr) |
||||
|
||||
return outputStr |
@ -0,0 +1,16 @@
|
||||
TARGET_DIR=data/doc/test/master/repo |
||||
REPO_ORIGIN=https://git.vhelio.org/vhelio/vheliotech-guide-de-montage.git |
||||
REPO_BRANCH=main |
||||
REPO_SOURCE_DIR=source |
||||
|
||||
[ -e $TARGET_DIR ] && rm -rf $TARGET_DIR |
||||
|
||||
mkdir -p $TARGET_DIR |
||||
cd $TARGET_DIR |
||||
|
||||
git init --initial-branch=$REPO_BRANCH |
||||
git remote add -f origin $REPO_ORIGIN |
||||
git sparse-checkout init |
||||
git sparse-checkout set "$REPO_SOURCE_DIR" |
||||
git pull origin $REPO_BRANCH |
||||
git branch --set-upstream-to=origin/$REPO_BRANCH $REPO_BRANCH |
Loading…
Reference in new issue