pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

cvs2hg: update to 2.0



Module Name:	pkgsrc-wip
Committed By:	Thomas Klausner <wiz%gatalith.at@localhost>
Pushed By:	wiz
Date:		Wed Jul 12 21:06:35 2023 +0200
Changeset:	52379a1e76690a9d118d7cd3f2db69524f2139ba

Modified Files:
	cvs2hg/Makefile
	cvs2hg/files/cvs2hg
	cvs2hg/files/cvs2hg.1

Log Message:
cvs2hg: update to 2.0

This version directly converts from fossil to hg using py-hg-fastimport;
no intermediate git repository is needed.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=52379a1e76690a9d118d7cd3f2db69524f2139ba

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 cvs2hg/Makefile       |  6 ++----
 cvs2hg/files/cvs2hg   | 38 +++++++++-----------------------------
 cvs2hg/files/cvs2hg.1 | 46 ++++++++++++++++++----------------------------
 3 files changed, 29 insertions(+), 61 deletions(-)

diffs:
diff --git a/cvs2hg/Makefile b/cvs2hg/Makefile
index 1b68c3e963..1330784fb0 100644
--- a/cvs2hg/Makefile
+++ b/cvs2hg/Makefile
@@ -1,6 +1,6 @@
 # $NetBSD$
 
-PKGNAME=		cvs2hg-1.0
+PKGNAME=		cvs2hg-2.0
 CATEGORIES=		devel scm
 
 MAINTAINER=		wiz%NetBSD.org@localhost
@@ -9,10 +9,8 @@ COMMENT=		Convert CVS repository to Mercurial
 LICENSE=		2-clause-bsd
 
 DEPENDS+=		cvs2fossil-[0-9]*:../../wip/cvs2fossil
-DEPENDS+=		git-base-[0-9]*:../../devel/git-base
-DEPENDS+=		git-filter-repo-[0-9]*:../../devel/git-filter-repo
 DEPENDS+=		${PYPKGPREFIX}-mercurial-[0-9]*:../../devel/py-mercurial
-DEPENDS+=		${PYPKGPREFIX}-hg-git-[0-9]*:../../devel/py-hg-git
+DEPENDS+=		${PYPKGPREFIX}-hg-fastimport-[0-9]*:../../devel/py-hg-fastimport
 
 WRKSRC=			${WRKDIR}
 USE_LANGUAGES=		# empty
diff --git a/cvs2hg/files/cvs2hg b/cvs2hg/files/cvs2hg
index caf623f26c..b131b56fc2 100644
--- a/cvs2hg/files/cvs2hg
+++ b/cvs2hg/files/cvs2hg
@@ -31,12 +31,11 @@
 #
 set -e
 
-USAGE="usage: $0 [-a authormap | -m mailmap] [-f fixup-sql-script] source-cvs-rsync-path target-path"
+USAGE="usage: $0 [-a authormap] [-f fixup-sql-script] source-cvs-rsync-path target-path"
 authormap=""
 fixup=""
-mailmap=""
 merge_limit_seconds=""
-while getopts a:f:m:s: f
+while getopts a:f:s: f
 do
     case $f in
 	a) authormap="$OPTARG"
@@ -45,11 +44,6 @@ do
 	       *) authormap="../$OPTARG";;
 	   esac;;
 	f) fixup="-f$OPTARG";;
-        m) mailmap=$OPTARG
-	   case "$mailmap" in
-	       /*);;
-	       *) mailmap="../$OPTARG";;
-	   esac;;
 	s) merge_limit_seconds="-s$OPTARG";;
         \?) echo "$USAGE" >&2; exit 1;;
     esac
@@ -61,35 +55,21 @@ then
 	echo "$USAGE" >&2
 	exit 1
 fi
-if [ -n "$authormap" ] && [ -n "$mailmap" ]
-then
-	echo "Please use only one of -a and -m" >&2
-	exit 1
-fi
 
 SRC="$1"
 BASE="$2"
 cvs2fossil -m $fixup $merge_limit_seconds "$SRC" "$BASE"
 # creates "$BASE" and "$BASE".fossil, but we don't need "$BASE"
 rm -f "$BASE"
-# convert to git
-git init "$BASE".git
-fossil1 export --git -R "$BASE".fossil | (cd "$BASE".git && git fast-import)
-if [ -n "$mailmap" ]
-then
-	git clone -b trunk "$BASE.git" "$BASE.rewrite.git"
-	(cd "$BASE.rewrite.git" && git filter-repo --force --mailmap "$mailmap")
-	mv "$BASE.git" "$BASE.git.old"
-	mv "$BASE.rewrite.git" "$BASE.git"
-fi
-# convert to hg
-hg --config extensions.hggit= clone "$BASE".git "$BASE".hg
+# export from fossil
+fossil1 export -R "$BASE".fossil > "$BASE".fossil.export
+# import to hg
+hg init "$BASE".hg
+hg -R "$BASE".hg --config extensions.fastimport= fastimport "$BASE".fossil.export
+# fix author names
 if [ -f "$authormap" ]
 then
-	AUTHORMAP="/tmp/authormap.$$"
-	sed -E "s/(.*)=/\1 <\1>=/" "$authormap" > "$AUTHORMAP"
-	hg convert --authormap="$AUTHORMAP" "$BASE.hg" "$BASE.rewrite.hg"
-	#rm "$AUTHORMAP"
+	hg convert --authormap="$authormap" "$BASE.hg" "$BASE.rewrite.hg"
 	mv "$BASE.hg" "$BASE.hg.old"
 	mv "$BASE.rewrite.hg" "$BASE.hg"
 fi
diff --git a/cvs2hg/files/cvs2hg.1 b/cvs2hg/files/cvs2hg.1
index 1af70e1e9c..ccc77c8598 100644
--- a/cvs2hg/files/cvs2hg.1
+++ b/cvs2hg/files/cvs2hg.1
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 10, 2023
+.Dd July 12, 2023
 .Dt CVS2HG 1
 .Os
 .Sh NAME
@@ -35,7 +35,7 @@
 .Nd convert CVS repository to Mercurial
 .Sh SYNOPSIS
 .Nm
-.Op Fl a Ar mailmap | Fl m Ar mailmap
+.Op Fl a Ar mailmap
 .Op Fl f Ar fixup-sql-script
 .Op Fl s Ar merge-limit-seconds
 .Ar source
@@ -47,8 +47,7 @@ is a script to convert a
 repository to
 .Xr hg 1
 using
-.Xr cvs2fossil 1 ,
-.Xr git 1 ,
+.Xr cvs2fossil 1
 and
 .Xr hg 1 .
 .Pp
@@ -59,16 +58,19 @@ checkout).
 will create
 .Ar destination Ns Pa .fossil
 (the fossil conversion created by
-.Xr cvs2fossil 1 ) ,
-.Ar destination Ns Pa .git
-(the git conversion created via the
+.Xr cvs2fossil 1 ) .
+.Xr fossil 1
+will create a
 .Xr git 1
-fast-import file exported by
-.Xr fossil 1 ) ,
-and finally
-.Ar destination Ns Pa .hg ,
-the Mercurial repository created from the git one by
-.Xr hg 1 .
+fast-import file
+.Ar destination Ns Pa .fossil.export
+which will be converted into the Mercurial repository
+.Ar destination Ns Pa .hg
+by
+.Xr hg 1.
+.Xr hg 1
+will also be used to update the author information using an authormap
+file, if provided.
 .Pp
 .Nm
 supports the following flags:
@@ -86,13 +88,6 @@ Pass an SQL fixup script for
 for its
 .Fl f
 flag.
-.It Fl m Ar mailmap
-Pass a
-.Xr gitmailmap 5
-file for creating proper author information using
-.Xr git-filter-repo 1 .
-The file chould consist of lines of the format:
-.Dl Full Name <email@address> <login>
 .It Fl s Ar merge-limit-seconds
 Pass a merge time limit in seconds to
 .Xr cvs2fossil 1 .
@@ -110,18 +105,13 @@ cvs2hg -a authormap "$REPO"-rsync/"$REPO" "$REPO"
 .Pp
 The conversion output is in
 .Pa src.hg .
-The intermediate fossil and git directories are
+The intermediate fossil directory is
 .Pa src.fossil
-and
-.Pa src.git ,
-respectively.
+and the corresponsing fast-import file
+.Pa src.fossil.export .
 If you use
 .Fl a
-or
-.Fl m
 there will be another
 .Pa src.hg.old
-or
-.Pa src.git.old
 directory, respectively.
 You can delete them after the conversion.


Home | Main Index | Thread Index | Old Index