From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vsmx012.vodafonemail.xion.oxcs.net (vsmx012.vodafonemail.xion.oxcs.net [153.92.174.90]) by sourceware.org (Postfix) with ESMTPS id 0FD9D3857C44 for ; Sat, 18 Jul 2020 08:13:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0FD9D3857C44 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nexgo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Stromeko@nexgo.de Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id E2F89F34F67 for ; Sat, 18 Jul 2020 08:13:34 +0000 (UTC) Received: from Gertrud (unknown [87.185.208.218]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id BAD6F19AF54 for ; Sat, 18 Jul 2020 08:13:32 +0000 (UTC) From: Achim Gratz To: cygwin-apps@cygwin.com Subject: Re: [ITA] cmake-3.18.0-1 and related packages References: <20200718051428.2298.50F79699@gmail.com> <7c101cc2-7e2b-38dd-fe36-b06023efe08b@gmail.com> <87a6zx4ahj.fsf@Rainer.invalid> <63c93722-d155-0e82-ce04-2dcdddedb861@gmail.com> <871rl9488v.fsf@Rainer.invalid> Date: Sat, 18 Jul 2020 10:13:29 +0200 In-Reply-To: <871rl9488v.fsf@Rainer.invalid> (Achim Gratz's message of "Sat, 18 Jul 2020 09:01:20 +0200") Message-ID: <87sgdp2qc6.fsf@Rainer.invalid> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-VADE-STATUS: LEGIT X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-apps@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin package maintainer discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jul 2020 08:13:38 -0000 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