pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
cvs2hg: add mailmap (author rewrite) support
Module Name: pkgsrc-wip
Committed By: Thomas Klausner <wiz%gatalith.at@localhost>
Pushed By: wiz
Date: Tue Jun 27 19:56:05 2023 +0200
Changeset: d1ee87b767095ee7c4a57f3a423ae0837c799938
Modified Files:
cvs2hg/Makefile
cvs2hg/files/cvs2hg
cvs2hg/files/cvs2hg.1
Log Message:
cvs2hg: add mailmap (author rewrite) support
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=d1ee87b767095ee7c4a57f3a423ae0837c799938
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
cvs2hg/Makefile | 1 +
cvs2hg/files/cvs2hg | 24 +++++++++++++++++++++++-
cvs2hg/files/cvs2hg.1 | 15 ++++++++++++++-
3 files changed, 38 insertions(+), 2 deletions(-)
diffs:
diff --git a/cvs2hg/Makefile b/cvs2hg/Makefile
index a9addd5505..1b68c3e963 100644
--- a/cvs2hg/Makefile
+++ b/cvs2hg/Makefile
@@ -10,6 +10,7 @@ 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
diff --git a/cvs2hg/files/cvs2hg b/cvs2hg/files/cvs2hg
index 77c49b9094..fa59b0e4af 100644
--- a/cvs2hg/files/cvs2hg
+++ b/cvs2hg/files/cvs2hg
@@ -31,9 +31,24 @@
#
set -e
+USAGE="usage: $0 [-m mailmap] source-cvs-rsync-path target-path"
+mailmap=""
+while getopts m: f
+do
+ case $f in
+ m) mailmap=$OPTARG
+ case "$mailmap" in
+ /*);;
+ *) mailmap="../$OPTARG";;
+ esac;;
+ \?) echo "$USAGE" >&2; exit 1;;
+ esac
+done
+shift $((OPTIND - 1))
+
if [ "$#" != 2 ]
then
- usage: "$0 source-cvs-rsync-path target-path" >&2
+ echo "$USAGE" >&2
exit 1
fi
SRC="$1"
@@ -44,5 +59,12 @@ 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
diff --git a/cvs2hg/files/cvs2hg.1 b/cvs2hg/files/cvs2hg.1
index 506bf65cae..29b091c589 100644
--- a/cvs2hg/files/cvs2hg.1
+++ b/cvs2hg/files/cvs2hg.1
@@ -35,6 +35,7 @@
.Nd convert CVS repository to Mercurial
.Sh SYNOPSIS
.Nm
+.Op Fl m Ar mailmap
.Ar source
.Ar destination
.Sh DESCRIPTION
@@ -66,13 +67,25 @@ and finally
.Ar destination Ns Pa .hg ,
the Mercurial repository created from the git one by
.Xr hg 1 .
+.Pp
+You can pass a
+.Xr gitmailmap 5
+file for creating proper author information using the
+.Fl m
+flag.
.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 "$LOGIN"@cvs.NetBSD.org::cvsroot/"$REPO" "$REPO"-rsync
-cvs2hg "$REPO"-rsync/"$REPO" "$REPO"
+cvs2hg -m .mailmap "$REPO"-rsync/"$REPO" "$REPO"
+.Ed
+where
+.Pa .mailmap
+consists of lines like this:
+.Bd -literal
+Thomas Klausner <wiz%NetBSD.org@localhost> <wiz>
.Ed
.Pp
The conversion is in
Home |
Main Index |
Thread Index |
Old Index