pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
cvs2hg: script to convert a CVS repository to hg
Module Name: pkgsrc-wip
Committed By: Thomas Klausner <wiz%gatalith.at@localhost>
Pushed By: wiz
Date: Sun Jun 25 00:41:02 2023 +0200
Changeset: 1e064c9fdb1b13e95caeebfdd1f2a11f8220073d
Modified Files:
Makefile
Added Files:
cvs2hg/DESCR
cvs2hg/Makefile
cvs2hg/PLIST
cvs2hg/files/cvs2hg
cvs2hg/files/cvs2hg.1
Log Message:
cvs2hg: script to convert a CVS repository to hg
Uses cvs2fossil, git, and hg (with the hg-git extension).
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=1e064c9fdb1b13e95caeebfdd1f2a11f8220073d
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
Makefile | 1 +
cvs2hg/DESCR | 1 +
cvs2hg/Makefile | 35 ++++++++++++++++++++
cvs2hg/PLIST | 3 ++
cvs2hg/files/cvs2hg | 48 +++++++++++++++++++++++++++
cvs2hg/files/cvs2hg.1 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 177 insertions(+)
diffs:
diff --git a/Makefile b/Makefile
index bc21129471..d16672d3d1 100644
--- a/Makefile
+++ b/Makefile
@@ -583,6 +583,7 @@ SUBDIR+= cvc3
SUBDIR+= cvs-syncmail
SUBDIR+= cvs2darcs
SUBDIR+= cvs2fossil
+SUBDIR+= cvs2hg
SUBDIR+= cvsanaly
SUBDIR+= cvsnt
SUBDIR+= cvstrac
diff --git a/cvs2hg/DESCR b/cvs2hg/DESCR
new file mode 100644
index 0000000000..f9ed6bd43c
--- /dev/null
+++ b/cvs2hg/DESCR
@@ -0,0 +1 @@
+Convert a CVS repository to Mercurial (hg) via fossil and git.
diff --git a/cvs2hg/Makefile b/cvs2hg/Makefile
new file mode 100644
index 0000000000..a9addd5505
--- /dev/null
+++ b/cvs2hg/Makefile
@@ -0,0 +1,35 @@
+# $NetBSD$
+
+PKGNAME= cvs2hg-1.0
+CATEGORIES= devel scm
+
+MAINTAINER= wiz%NetBSD.org@localhost
+#HOMEPAGE= https://www.pkgsrc.org/
+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+= ${PYPKGPREFIX}-mercurial-[0-9]*:../../devel/py-mercurial
+DEPENDS+= ${PYPKGPREFIX}-hg-git-[0-9]*:../../devel/py-hg-git
+
+WRKSRC= ${WRKDIR}
+USE_LANGUAGES= # empty
+INSTALLATION_DIRS= bin ${PKGMANDIR}/man1
+
+PYTHON_VERSIONS_INCOMPATIBLE= 27
+
+post-extract:
+ ${CP} ${FILESDIR}/cvs2hg ${WRKSRC}
+ ${CP} ${FILESDIR}/cvs2hg.1 ${WRKSRC}
+
+do-configure:
+
+do-build:
+
+do-install:
+ ${INSTALL_SCRIPT} ${WRKDIR}/cvs2hg ${DESTDIR}${PREFIX}/bin
+ ${INSTALL_MAN} ${FILESDIR}/cvs2hg.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+
+.include "../../lang/python/pyversion.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/cvs2hg/PLIST b/cvs2hg/PLIST
new file mode 100644
index 0000000000..e57ab98609
--- /dev/null
+++ b/cvs2hg/PLIST
@@ -0,0 +1,3 @@
+@comment $NetBSD$
+bin/cvs2hg
+man/man1/cvs2hg.1
diff --git a/cvs2hg/files/cvs2hg b/cvs2hg/files/cvs2hg
new file mode 100644
index 0000000000..77c49b9094
--- /dev/null
+++ b/cvs2hg/files/cvs2hg
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# $NetBSD$
+#
+# Copyright (c) 2023 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Thomas Klausner.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+set -e
+
+if [ "$#" != 2 ]
+then
+ usage: "$0 source-cvs-rsync-path target-path" >&2
+ exit 1
+fi
+SRC="$1"
+BASE="$2"
+cvs2fossil -m "$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)
+# convert to hg
+hg --config extensions.hggit= clone "$BASE".git "$BASE".hg
diff --git a/cvs2hg/files/cvs2hg.1 b/cvs2hg/files/cvs2hg.1
new file mode 100644
index 0000000000..e1c3a63394
--- /dev/null
+++ b/cvs2hg/files/cvs2hg.1
@@ -0,0 +1,89 @@
+.\" $NetBSD$
+.\"
+.\" Copyright (c) 2023 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Thomas Klausner.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd June 24, 2023
+.Dt CVS2HG 1
+.Os
+.Sh NAME
+.Nm cvs2hg
+.Nd convert CVS repository to Mercurial
+.Sh SYNOPSIS
+.Nm
+.Ar source
+.Ar destination
+.Sh DESCRIPTION
+.Nm
+is a script to convert a
+.Xr cvs 1
+repository to
+.Xr hg 1
+using
+.Xr cvs2fossil 1 ,
+.Xr git 1 ,
+and
+.Xr hg 1 .
+.Pp
+.Ar source
+must be a CVS repository (the server side, i.e. the RCS files, not a
+checkout).
+.Nm
+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 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 .
+.Sh EXAMPLES
+To convert the NetBSD src repository, if you have developer access, do:
+.Bd -literal -offset indent
+export REPO=src
+export LOGIN=username
+rsync -aS --delete -e ssh "$USERNAME"@cvs.NetBSD.org::cvsroot/"$REPO" "$REPO"-rsync
+cvs2hg "$REPO"-rsync/"$REPO" "$REPO"
+.Ed
+.Pp
+The conversion is in
+.Pa src.hg .
+The intermediate fossil and git directories are
+.Pa src.fossil
+and
+.Pa src.git ,
+respectively.
+You can delete them after the conversion.
+.Sh BUGS
+There is no way to provide an
+.Pa authormap
+file to convert Unix user names to email addresses.
Home |
Main Index |
Thread Index |
Old Index