pkgsrc-WIP-changes archive

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

cvs2fossil: add -s flag to specify time limit for merges



Module Name:	pkgsrc-wip
Committed By:	Thomas Klausner <wiz%gatalith.at@localhost>
Pushed By:	wiz
Date:		Sat Jul 8 09:18:34 2023 +0200
Changeset:	054ec56adbd01cc3e644a2f99bdbe87be4eadbec

Modified Files:
	cvs2fossil/distinfo
	cvs2fossil/files/cvs2fossil
	cvs2fossil/files/cvs2fossil.1
	cvs2fossil/patches/patch-04-commit_main.c

Log Message:
cvs2fossil: add -s flag to specify time limit for merges

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

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

diffstat:
 cvs2fossil/distinfo                       |  2 +-
 cvs2fossil/files/cvs2fossil               |  8 +++---
 cvs2fossil/files/cvs2fossil.1             | 18 ++++++++++++-
 cvs2fossil/patches/patch-04-commit_main.c | 45 +++++++++++++++++++++++++++++++
 4 files changed, 68 insertions(+), 5 deletions(-)

diffs:
diff --git a/cvs2fossil/distinfo b/cvs2fossil/distinfo
index b2fbbb88f9..bc3d40fe4d 100644
--- a/cvs2fossil/distinfo
+++ b/cvs2fossil/distinfo
@@ -4,6 +4,6 @@ BLAKE2s (cvs2fossil-20140502.tar.gz) = 275555dc446eedb1c50bbb446391e72dac23fea5b
 SHA512 (cvs2fossil-20140502.tar.gz) = dc5f64c5af0fe6a35143244c2858dcccd4ad2131fb5e375132ffc9071dfcff8984fdbb9664f774238ddd2c14c5155686e2c99962753131a3f5cd2f58f0d19a3d
 Size (cvs2fossil-20140502.tar.gz) = 1258545 bytes
 SHA1 (patch-01-import_main.c) = 6177f632e9a7213e9aff911e28ac04378102fae5
-SHA1 (patch-04-commit_main.c) = a7afef765fca714dfe672ab7207789d91cd839c8
+SHA1 (patch-04-commit_main.c) = 01eee277568a00178969c279ba46e89189fecb76
 SHA1 (patch-common_common.h) = 625959ee61513df52696987c9fba2abb83c91262
 SHA1 (patch-convert.sh) = 2cb7abefb9888c5b99e85d18e135be7e53557bbb
diff --git a/cvs2fossil/files/cvs2fossil b/cvs2fossil/files/cvs2fossil
index da2c112ade..de75d61c23 100755
--- a/cvs2fossil/files/cvs2fossil
+++ b/cvs2fossil/files/cvs2fossil
@@ -2,14 +2,16 @@
 
 set -e
 
-USAGE="usage: $0 [-f fixup-sql-script] [-m] source-cvs-rsync-path target-path"
+USAGE="usage: $0 [-m] [-f fixup-sql-script] [-s merge_limit_seconds] source-cvs-rsync-path target-path"
 fixup=""
+merge_limit_seconds=""
 strip=""
-while getopts f:m f
+while getopts f:ms: f
 do
     case $f in
 	f)      fixup="$OPTARG";;
         m)      strip=-m;;
+	s)      merge_limit_seconds="-s$OPTARG";;
         \?)     echo "$USAGE" >&2; exit 1;;
     esac
 done
@@ -74,7 +76,7 @@ fossil1 new -A root --date-override "$oldest" "$fossil"
 # project=eeb7e06236b08dc4b57b6ab3b957fe5756c64f5b
 # sqlite3 $fossil 'UPDATE config SET value="'$project'" WHERE name="project-code"'
 initial=$(sqlite3 "$fossil" 'SELECT uuid FROM blob WHERE rid=1')
-TMPDIR=. time 04-commit -b "$initial" "$db" "$fossil"
+TMPDIR=. time 04-commit -b "$initial" "$merge_limit_seconds"  "$db" "$fossil"
 du -h "$fossil"
 time fossil1 rebuild --noverify "$fossil"
 #TMPDIR=. time sqlite3 $fossil 'pragma synchronous=off; pragma journal_mode=off; vacuum'
diff --git a/cvs2fossil/files/cvs2fossil.1 b/cvs2fossil/files/cvs2fossil.1
index f28d9f3b9c..8e82f8d313 100644
--- a/cvs2fossil/files/cvs2fossil.1
+++ b/cvs2fossil/files/cvs2fossil.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 8, 2023
 .Dt CVS2FOSSIL 1
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@
 .Nm
 .Op Fl m
 .Op Fl f Ar fixup-sql-script
+.Op Fl s Ar merge-limit-seconds
 .Ar source
 .Ar destination
 .Sh DESCRIPTION
@@ -76,6 +77,21 @@ i.e. when converting
 .Pa foo/bar/*
 the path names in the result will start with
 .Pa bar .
+.It Fl s Ar merge-limit-seconds
+Some CVS operations take longer because of network speed or number and
+size of files involved.
+Thus, RCS dates of files belonging to one commit may have different
+time stamps.
+For this reason,
+.Nm
+merges changes to files that have the same commit message but slightly
+varying time stamps into one commit.
+The
+.Ar merge-limit-seconds
+argument specifies the maximum number of seconds two commits may be
+apart (using the RCS date of the change) before they are seen as two
+separate commits.
+The default is 600 seconds (10 minutes).
 .El
 .Sh WARNINGS
 These warnings usually indicate that some manual changes were done
diff --git a/cvs2fossil/patches/patch-04-commit_main.c b/cvs2fossil/patches/patch-04-commit_main.c
index fe56e2d888..0a47ff457a 100644
--- a/cvs2fossil/patches/patch-04-commit_main.c
+++ b/cvs2fossil/patches/patch-04-commit_main.c
@@ -12,3 +12,48 @@ Add missing header.
  #include <zlib.h>
  
  #include <openssl/md5.h>
+@@ -672,6 +673,7 @@ add_time(const char *input, char *output
+ 	strftime(output, output_len, "%Y-%m-%d %H:%M:%S", &tm);
+ }
+ 
++static int merge_limit_seconds = 600;
+ static struct buf *
+ flush_manifest(struct buf *bp)
+ {
+@@ -688,7 +690,7 @@ flush_manifest(struct buf *bp)
+ 	bp = prepare_manifest((const char *)sqlite3_column_text(stmt, 3),
+ 	    date, (const char *)sqlite3_column_text(stmt, 1));
+ 
+-	add_time(date, date_limit, sizeof(date_limit), 600);
++	add_time(date, date_limit, sizeof(date_limit), merge_limit_seconds);
+ 
+ 	++cur_commit;
+ 	return bp;
+@@ -1019,7 +1021,7 @@ tracef(void *unused, const char *sql)
+ static void
+ usage(void)
+ {
+-	fprintf(stderr, "Usage: %s [-b 40-byte-hash] database repository\n",
++	fprintf(stderr, "Usage: %s [-b 40-byte-hash] [-l queue_limit] [-s merge_limit_seconds] database repository\n",
+ 	    getprogname());
+ 	exit(1);
+ }
+@@ -1066,7 +1068,7 @@ main(int argc, char **argv)
+ 	delta_stmt_thread = calloc(sizeof(*delta_stmt_thread), ncpu);
+ 	threads = calloc(sizeof(*threads), 2 * ncpu);
+ 
+-	while ((ch = getopt(argc, argv, "b:l:")) != -1) {
++	while ((ch = getopt(argc, argv, "b:l:s:")) != -1) {
+ 		switch (ch) {
+ 		case 'b':
+ 			if (strlen(optarg) != 40)
+@@ -1077,6 +1079,9 @@ main(int argc, char **argv)
+ 			compress_queue_limit = atoi(optarg);
+ 			delta_queue_limit = atoi(optarg);
+ 			break;
++		case 's':
++			merge_limit_seconds = atoi(optarg);
++			break;
+ 		default:
+ 			usage();
+ 		}


Home | Main Index | Thread Index | Old Index