pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
cvs2hg: add -a for hg authormap support using hg convert
Module Name: pkgsrc-wip
Committed By: Thomas Klausner <wiz%gatalith.at@localhost>
Pushed By: wiz
Date: Mon Jul 10 21:42:59 2023 +0200
Changeset: 47950dc12ad79d5c46e5a48a32981939a7eda5e2
Modified Files:
cvs2hg/files/cvs2hg
cvs2hg/files/cvs2hg.1
Log Message:
cvs2hg: add -a for hg authormap support using hg convert
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=47950dc12ad79d5c46e5a48a32981939a7eda5e2
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
cvs2hg/files/cvs2hg | 41 +++++++++++++++++++++++++---------
cvs2hg/files/cvs2hg.1 | 61 ++++++++++++++++++++++++++++++++-------------------
2 files changed, 70 insertions(+), 32 deletions(-)
diffs:
diff --git a/cvs2hg/files/cvs2hg b/cvs2hg/files/cvs2hg
index fffb3f1a33..caf623f26c 100644
--- a/cvs2hg/files/cvs2hg
+++ b/cvs2hg/files/cvs2hg
@@ -31,21 +31,27 @@
#
set -e
-USAGE="usage: $0 [-f fixup-sql-script] [-m mailmap] source-cvs-rsync-path target-path"
+USAGE="usage: $0 [-a authormap | -m mailmap] [-f fixup-sql-script] source-cvs-rsync-path target-path"
+authormap=""
fixup=""
mailmap=""
merge_limit_seconds=""
-while getopts f:m:s: f
+while getopts a:f:m:s: f
do
case $f in
- f) fixup="-f$OPTARG";;
- m) mailmap=$OPTARG
- case "$mailmap" in
- /*);;
- *) mailmap="../$OPTARG";;
- esac;;
- s) merge_limit_seconds="-s$OPTARG";;
- \?) echo "$USAGE" >&2; exit 1;;
+ a) authormap="$OPTARG"
+ case "$authormap" in
+ /*);;
+ *) 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
done
shift $((OPTIND - 1))
@@ -55,6 +61,12 @@ 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"
@@ -72,3 +84,12 @@ then
fi
# convert to hg
hg --config extensions.hggit= clone "$BASE".git "$BASE".hg
+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"
+ 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 e25dd8c9b4..1af70e1e9c 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 June 28, 2023
+.Dd July 10, 2023
.Dt CVS2HG 1
.Os
.Sh NAME
@@ -35,8 +35,8 @@
.Nd convert CVS repository to Mercurial
.Sh SYNOPSIS
.Nm
+.Op Fl a Ar mailmap | Fl m Ar mailmap
.Op Fl f Ar fixup-sql-script
-.Op Fl m Ar mailmap
.Op Fl s Ar merge-limit-seconds
.Ar source
.Ar destination
@@ -70,41 +70,58 @@ and finally
the Mercurial repository created from the git one by
.Xr hg 1 .
.Pp
-You can pass an SQL fixup script for
+.Nm
+supports the following flags:
+.Bl -tag -width 10n
+.It Fl a Ar mailmap
+Pass a
+.Xr hg 1
+authormap file for creating proper author information using
+.Xr hg 1 Cm convert .
+The file should consist of lines of the format:
+.Dl login=Full Name <email@address>
+.It Fl f Ar fixup-sql-script
+Pass an SQL fixup script for
.Xr cvs2fossil 1
-using the
+for its
.Fl f
flag.
-You can pass a
+.It Fl m Ar mailmap
+Pass a
.Xr gitmailmap 5
-file for creating proper author information using the
-.Fl m
-flag.
-You can pass a merge time limit in seconds to
-.Xr cvs2fossil 1
-using the
-.Fl s
-flag.
+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 .
+.El
.Sh EXAMPLES
-To convert the NetBSD src repository, if you have developer access, do:
+To convert the
+.Nx
+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 -m .mailmap "$REPO"-rsync/"$REPO" "$REPO"
-.Ed
-where
-.Pa .mailmap
-consists of lines like this:
-.Bd -literal
-Thomas Klausner <wiz%NetBSD.org@localhost> <wiz>
+cvs2hg -a authormap "$REPO"-rsync/"$REPO" "$REPO"
.Ed
.Pp
-The conversion is in
+The conversion output is in
.Pa src.hg .
The intermediate fossil and git directories are
.Pa src.fossil
and
.Pa src.git ,
respectively.
+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