[ITA] cmake-3.18.0-1 and related packages

Achim Gratz Stromeko@nexgo.de
Sat Jul 18 08:13:29 GMT 2020


Achim Gratz writes:
> Marco Atzeri via Cygwin-apps writes:
>> I know, but it take times, specially as I will hate to lose
>> the history if I port only last version
>
> You can rewrite the git repo with filter-branch to keep the history.  I
> did that with my packages since I also had them in a single repo.  I now
> have them as submodules in a new repo, although the submodules wouldn't
> strictly be necessary.

Here are a the scripts that I created for this conversion.  The first
one filters each subdirectory into its own branch.  The second one
imports one such branch into a new repo.  You need to define a cygpack:
alias in your gitconfig (global or local) to use it directly.  Obviously
you'll want to loop across all your packages, I did that directly in the
shell.  It goes without saying that you should do all operations on
fresh clones of your repositories so you can easily start over if
necessary.

The third script was for packages that I took over from Yaakov that he
had put earlier history on the Cygwin server (from Cygport, mostly) and
I had already local history fro my releases; it will fetch what's on
Cygwin and then append any local history.  If the relation is more
complicated than that you will either need to rewrite the history
manually or drop / branch off some of the intertwined history.

--8<- .gitconfig -cut here----------------start------------->8---
[url "git://cygwin.com/git/cygwin-packages"]
        InsteadOf = cygpack:
[url "ssh://cygwin@cygwin.com/git/cygwin-packages"]
        pushInsteadOf = cygpack:
--8<- .gitconfig -cut here----------------end--------------->8---

--8<- splitgit.dash -cut here--------------start------------->8---
#!/bin/dash
pkgs=""
spkg=""
if [ $# -gt 2 ] ; then
    orepo=$1; shift
    nrepo=$1; shift
    pkgs=$1; shift
    spkg=$pkgs
else
    echo "Not enough arguments!\n$@"
    exit 1
fi
while [ $# -gt 0 ] ; do
    pkgs="$pkgs $1"
    spkg="$spkg|$1"
    shift
done
echo "$spkg"
# clone repo and keep reference to original
git clone $orepo $nrepo
cd $nrepo
git branch unsplit master
# stuff packages into separate subdirectories
git filter-branch --index-filter ' \
      git ls-files -s | \
      perl -pE '"'"'s:\t('$spkg'):\t$1/$1:'"'"' | \
      env GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && \
      mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE" \
    ' HEAD
git branch subdirs
# split each subdir into a new branch
for pkg in $pkgs ; do
    git filter-branch -f --subdirectory-filter $pkg -- --all
    git branch $pkg
    git reset --hard  original/refs/heads/master
done
--8<- splitgit.dash -cut here-------------end--------------->8---

--8<- gitimport.dash -cut here------------start------------->8---
#!/usr/bin/dash
if [ $# -gt 1 ] ; then
    srepo=$(realpath $1); shift
    pkg=$1; shift
else
    echo "Not enough arguments!\n$@"
    exit 1
fi
echo "$pkg"
# create new git repo
git init $pkg
cd $pkg
# import history
git fetch -fu $srepo master:master
git reset --hard
git remote add origin cygpack:/$pkg
#
cd ..
--8<- gitimport.dash -cut here------------end--------------->8---

--8<- grafthist.dash -cut here------------start------------->8---
#!/bin/dash
if [ $# -gt 1 ] ; then
    srepo=$(realpath $1); shift
    pkg=$1; shift
else
    echo "Not enough arguments!\n$@"
    exit 1
fi
echo "$pkg"
# create new git repo
git clone git://cygwin.com/git/cygwin-packages/${pkg}.git || git init $pkg
cd $pkg
# import history
git fetch $srepo refs/heads/${pkg}:import
git checkout import
if [ "origin" = "$( git remote )" ] ; then
    # append imported history
    sha1=$( git show-ref refs/heads/master | cut -d\  -f 1 )
    echo $sha1
    git filter-branch -f \
      --commit-filter ' \
        if [ $# -eq 1 ] ; then \
          git commit-tree -p $( git show-ref refs/heads/master | cut -d" "  -f 1 ) $1 ; \
        else \
          git commit-tree "$@" ; \
        fi ' \
      --msg-filter ' \
        sed -e "s/initial commit/Take over maintenance/;s/^\* //" \
        ' \
      HEAD
fi
git branch -f master import
git reset --hard
cd ..
--8<- grafthist.dash -cut here------------end--------------->8---


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra


More information about the Cygwin-apps mailing list