#! /bin/bash
set -e
[ ! -d $1 ] && echo "should specify source path" exit 1;
cd $1
# Switch to the package branch
git checkout openkylin/yangtze
git checkout -b packaging/openkylin/yangtze
# Create a temporary integration patch branch, which will automatically be named patch-queue/openkylin/yangtze
gbp pq import
# fix patches date format
gbp pq export
git add debian
git commit -m "format patches" || true
git checkout openkylin/yangtze
# Integrate patch in the package branch
git merge patch-queue/packaging/openkylin/yangtze -m "apply patches"
# Delete temporary branches
git branch -D patch-queue/packaging/openkylin/yangtze
# Delete the debian/patches directory
rm -rf debian/patches
# Change the format of the format
echo "3.0 (native)" > debian/source/format
# Commit the changes
git add debian
git commit -m "changed debian/source/format to native"