From owner-svn-src-user@freebsd.org Mon Sep 23 20:54:19 2019 Return-Path: Delivered-To: svn-src-user@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77954FFDA8 for ; Mon, 23 Sep 2019 20:54:19 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46cc4q2dZzz4Wr9; Mon, 23 Sep 2019 20:54:19 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DC261C96B; Mon, 23 Sep 2019 20:54:19 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8NKsJFK084087; Mon, 23 Sep 2019 20:54:19 GMT (envelope-from uqs@FreeBSD.org) Received: (from uqs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8NKsJNh084086; Mon, 23 Sep 2019 20:54:19 GMT (envelope-from uqs@FreeBSD.org) Message-Id: <201909232054.x8NKsJNh084086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: uqs set sender to uqs@FreeBSD.org using -f From: Ulrich Spoerlein Date: Mon, 23 Sep 2019 20:54:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r352632 - user/uqs/git_conv X-SVN-Group: user X-SVN-Commit-Author: uqs X-SVN-Commit-Paths: user/uqs/git_conv X-SVN-Commit-Revision: 352632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2019 20:54:19 -0000 Author: uqs Date: Mon Sep 23 20:54:18 2019 New Revision: 352632 URL: https://svnweb.freebsd.org/changeset/base/352632 Log: Handle svn2git and git-svn conversions the same. Handle autocrlf and ignorecase the same in both repos too. Modified: user/uqs/git_conv/git_conv Modified: user/uqs/git_conv/git_conv ============================================================================== --- user/uqs/git_conv/git_conv Mon Sep 23 20:50:04 2019 (r352631) +++ user/uqs/git_conv/git_conv Mon Sep 23 20:54:18 2019 (r352632) @@ -30,7 +30,9 @@ # # 2. svn2git conversion: need to run against local paths, using rules files in ~git/*.rules # - First svn2git run will create the target git repo, then -# - git config --global push.default matching +# - git config push.default matching +# - git config core.autocrlf false +# - git config core.ignorecase false # - git remote add github base.github.com:freebsd/freebsd.git # - git config --add remote.github.push '+refs/heads/master:refs/heads/master' # - git config --add remote.github.push '+refs/heads/stable/*:refs/heads/stable/*' @@ -48,8 +50,9 @@ # - git svn init -Thead --rewrite-root=svn+ssh://svn.freebsd.org/ports file:///home/svn/freebsd-ports.svn ports-head.git # - cd base-head.git # - git svn fetch -r 0:1000 -# - git config --global push.default matching -# - git config --global core.autocrlf false +# - git config push.default matching +# - git config core.autocrlf false +# - git config core.ignorecase false # - git remote add github base.github.com:freebsd/freebsd.git # - git config --add remote.github.push '+refs/remotes/trunk:refs/heads/svn_head' # - git svn rebase @@ -65,7 +68,7 @@ # And similar for ports and doc. : ${BASE=/home/git} : ${RULES_DIR=${BASE}} -: ${SVN2GIT=${BASE}/svn2git/svn-all-fast-export} +: ${SVN2GIT=${BASE}/svn2git/svn-all-fast-export} # Needs to have the merge-hack : ${REPO_base=/home/svn/base} : ${REPO_doc=/home/svn/doc} @@ -134,54 +137,63 @@ svn2git() test -f "$rules" || { echo "$rules do not exist, exiting ..." >&2; exit 1; } cd $BASE + if ! test -f "$BASE/$target/HEAD"; then + echo "$BASE/$target is not a git repo, creating first revisions ..." + + git init --bare $target + ( + cd $target + touch marks-$target + touch git-daemon-export-ok + git config --local push.default matching + git config --local core.autocrlf false + git config --local core.ignorecase false + # We use fake github hosts like ports.github.com, which we fix in our + # .ssh/config *and* apply a per-repo ssh key, which is the whole point + # of this hack. + case "$TYPE" in + base) + git remote add github $TYPE.github.com:freebsd/freebsd.git + git config --add remote.github.push '+refs/heads/master:refs/heads/master' + git config --add remote.github.push '+refs/heads/projects/*:refs/heads/projects/*' + git config --add remote.github.push '+refs/heads/release/*:refs/heads/release/*' + git config --add remote.github.push '+refs/heads/releng/*:refs/heads/releng/*' + git config --add remote.github.push '+refs/heads/stable/*:refs/heads/stable/*' + git config --add remote.github.push '+refs/heads/user/*:refs/heads/user/*' + git config --add remote.github.push '+refs/notes/*:refs/notes/*' + + git remote add bitbucket ssh://git@bitbucket.org/freebsd/freebsd-$TYPE.git + git config --add remote.bitbucket.push '+refs/heads/master:refs/heads/master' + git config --add remote.bitbucket.push '+refs/heads/stable/*:refs/heads/stable/*' + git config --add remote.bitbucket.push '+refs/notes/*:refs/notes/*' + ;; + doc) + git remote add github $TYPE.github.com:freebsd/freebsd-$TYPE.git + git config --add remote.github.push '+refs/heads/master:refs/heads/master' + git config --add remote.github.push '+refs/heads/projects/*:refs/heads/projects/*' + git config --add remote.github.push '+refs/heads/release/*:refs/heads/release/*' + git config --add remote.github.push '+refs/notes/*:refs/notes/*' + ;; + ports) + git remote add github $TYPE.github.com:freebsd/freebsd-$TYPE.git + git config --add remote.github.push '+refs/heads/branches/*:refs/heads/branches/*' + git config --add remote.github.push '+refs/heads/master:refs/heads/master' + git config --add remote.github.push '+refs/heads/projects/*:refs/heads/projects/*' + git config --add remote.github.push '+refs/notes/*:refs/notes/*' + ;; + esac + ) + + # Initial small run + $SVN2GIT --max-rev 100 --fast-import-timeout 3600 --add-metadata-notes --identity-domain FreeBSD.org --rules $rules $source + fi + echo "Converting $source to $target using svn2git" $SVN2GIT --fast-import-timeout 3600 --add-metadata-notes --identity-domain FreeBSD.org --rules $rules $source if [ $? != 0 ]; then echo "Error in svn2git conversion of $source" >&2 exit 1 fi - touch $target/git-daemon-export-ok - cd $target - if ! git config --local --get push.default >/dev/null; then - git config --local push.default matching - fi - if ! git config --local --get remote.github.url >/dev/null; then - # We use fake github hosts like ports.github.com, which we fix in our - # .ssh/config *and* apply a per-repo ssh key, which is the whole point - # of this hack. - case "$TYPE" in - base) - git remote add github $TYPE.github.com:freebsd/freebsd.git - git config --add remote.github.push '+refs/heads/master:refs/heads/master' - git config --add remote.github.push '+refs/heads/projects/*:refs/heads/projects/*' - git config --add remote.github.push '+refs/heads/release/*:refs/heads/release/*' - git config --add remote.github.push '+refs/heads/releng/*:refs/heads/releng/*' - git config --add remote.github.push '+refs/heads/stable/*:refs/heads/stable/*' - git config --add remote.github.push '+refs/heads/user/*:refs/heads/user/*' - git config --add remote.github.push '+refs/notes/*:refs/notes/*' - - git remote add bitbucket ssh://git@bitbucket.org/freebsd/freebsd-$TYPE.git - git config --add remote.bitbucket.push '+refs/heads/master:refs/heads/master' - git config --add remote.bitbucket.push '+refs/heads/stable/*:refs/heads/stable/*' - git config --add remote.bitbucket.push '+refs/notes/*:refs/notes/*' - ;; - doc) - git remote add github $TYPE.github.com:freebsd/freebsd-$TYPE.git - git config --add remote.github.push '+refs/heads/master:refs/heads/master' - git config --add remote.github.push '+refs/heads/projects/*:refs/heads/projects/*' - git config --add remote.github.push '+refs/heads/release/*:refs/heads/release/*' - git config --add remote.github.push '+refs/notes/*:refs/notes/*' - ;; - ports) - git remote add github $TYPE.github.com:freebsd/freebsd-$TYPE.git - git config --add remote.github.push '+refs/heads/branches/*:refs/heads/branches/*' - git config --add remote.github.push '+refs/heads/master:refs/heads/master' - git config --add remote.github.push '+refs/heads/projects/*:refs/heads/projects/*' - git config --add remote.github.push '+refs/notes/*:refs/notes/*' - ;; - esac - fi - if [ -z "$dest" -o -n "$run_local" ]; then return fi @@ -202,13 +214,18 @@ gitsvn() if ! test -d "$BASE/$target/.git"; then echo "$BASE/$target is not a git repo, creating first revisions ..." git svn init -Thead --rewrite-root=svn+ssh://svn.freebsd.org/$TYPE file://`eval echo \\\${REPO_${TYPE}}` $BASE/$target - cd $BASE/$target && git svn fetch -r 0:100 + cd $BASE/$target git config --local push.default matching + git config --local core.autocrlf false + git config --local core.ignorecase false case "$TYPE" in base) git remote add github $TYPE.github.com:freebsd/freebsd.git ;; *) git remote add github $TYPE.github.com:freebsd/freebsd-$TYPE.git ;; esac git config --add remote.github.push '+refs/remotes/trunk:refs/heads/svn_head' + + # Initial small run + git svn fetch -r 0:100 fi cd $BASE/$target echo "Converting $target using git-svn"