Hello community, here is the log from the commit of package cvsps for openSUSE:Factory checked in at 2013-01-11 15:54:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cvsps (Old) and /work/SRC/openSUSE:Factory/.cvsps.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cvsps", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/cvsps/cvsps.changes 2013-01-03 13:54:37.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.cvsps.new/cvsps.changes 2013-01-11 15:54:21.000000000 +0100 @@ -1,0 +2,13 @@ +Fri Jan 11 11:17:22 UTC 2013 - [email protected] + +- update to 3.7 + * bug fix in timezone handling (thanks to Chris Rorvick). + * major performance gain in the CVS client code (thanks to + Sergei Trofimovich). + * third field in an author entry is now interpreted as if it + were TZ. + * remove the --test-log option now that cvsps has its own test suite. + * new --reposurgeon option for passing reference-lifting hints + to reposurgeon. + +------------------------------------------------------------------- Old: ---- cvsps-3.4.tar.gz New: ---- cvsps-3.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cvsps.spec ++++++ --- /var/tmp/diff_new_pack.7I12GS/_old 2013-01-11 15:54:22.000000000 +0100 +++ /var/tmp/diff_new_pack.7I12GS/_new 2013-01-11 15:54:22.000000000 +0100 @@ -20,7 +20,7 @@ Summary: A Program for Generating Patch Set Information from a CVS Repository License: GPL-2.0+ Group: Development/Tools/Version Control -Version: 3.4 +Version: 3.7 Release: 0 Source0: http://www.catb.org/~esr/cvsps/%{name}-%{version}.tar.gz Url: http://www.catb.org/~esr/cvsps/ ++++++ cvsps-3.4.tar.gz -> cvsps-3.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/Makefile new/cvsps-3.7/Makefile --- old/cvsps-3.4/Makefile 2013-01-01 18:40:56.000000000 +0100 +++ new/cvsps-3.7/Makefile 2013-01-09 16:57:03.000000000 +0100 @@ -1,9 +1,12 @@ -VERSION=3.4 +VERSION=3.7 CC?=gcc CFLAGS?=-g -O2 -Wall CPPFLAGS+=-I. -DVERSION=\"$(VERSION)\" +LDLIBS+=-lz # += to allow solaris and friends add their libs like -lsocket prefix?=/usr/local +target=$(DESTDIR)$(prefix) + OBJS= debug.o \ hash.o \ sio.o \ @@ -20,7 +23,7 @@ makedepend -Y -I. *.c cvsps: $(OBJS) - $(CC) -o cvsps $(OBJS) -lz + $(CC) -o cvsps $(OBJS) $(LDFLAGS) $(LDLIBS) check: @(cd test >/dev/null; make --quiet) @@ -46,16 +49,17 @@ a2x --doctype manpage --format xhtml $*.txt install: cvsps.1 - [ -d $(prefix)/bin ] || mkdir -p $(prefix)/bin - [ -d $(prefix)/share/man/man1 ] || mkdir -p $(prefix)/share/man/man1 - install cvsps $(prefix)/bin - install -m 644 cvsps.1 $(prefix)/share/man/man1 + [ -d "$(target)/bin" ] || mkdir -p "$(target)/bin" + [ -d "$(target)/share/man/man1" ] || mkdir -p "$(target)/share/man/man1" + install cvsps "$(target)/bin" + install -m 644 cvsps.1 "$(target)/share/man/man1" tags: *.c *.h ctags *.c *.h clean: rm -f cvsps *.o core tags cvsps.1 cvsps.html docbook-xsl.css + rm -f SHIPPER.FREECODE SOURCES = Makefile *.[ch] merge_utils.sh DOCS = README COPYING NEWS cvsps.asc TODO @@ -66,7 +70,7 @@ dist: cvsps-$(VERSION).tar.gz release: cvsps-$(VERSION).tar.gz cvsps.html - shipper -u -m -t; make clean + shipper -u -m -t; make clean; rm SHIPPER.FREECODE .PHONY: install clean version dist check # DO NOT DELETE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/NEWS new/cvsps-3.7/NEWS --- old/cvsps-3.4/NEWS 2013-01-01 18:40:47.000000000 +0100 +++ new/cvsps-3.7/NEWS 2013-01-09 16:56:14.000000000 +0100 @@ -1,5 +1,16 @@ CVSps project news +3.7 @ 2013-01-08 + Bug fix in timezone handling (thanks to Chris Rorvick). + Major performance gain in the CVS client code (thanks to Sergei Trofimovich). + +3.6 @ 2013-01-06 + The third field in an author entry is now interpreted as if it were TZ. + +3.5 @ 2013-01-02 + Remove the --test-log option now that cvsps has its own test suite. + New --reposurgeon option for passing reference-lifting hints to reposurgeon. + 3.4 @ 2013-01-01 Incorporate Heiko Voight's patch solving some time-skew cases. The git-tree tests for cvsps are now completely merged into the test suite. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/README new/cvsps-3.7/README --- old/cvsps-3.4/README 2013-01-01 18:37:36.000000000 +0100 +++ new/cvsps-3.7/README 2013-01-07 13:21:56.000000000 +0100 @@ -17,19 +17,27 @@ If you have not used an older version of CVSps, you can skip this section. -The 3.x versions have changed significantly. In 2012, CVS use is declining -swiftly (GNU CVS hasn't been updated since 2004) and the original use case -for this tool - browsing change sets in a live CVS repository - is obsolete. -The 3.x versions are more focused on the --fast-export mode. +The 3.x versions have changed significantly. In 2012, CVS use is +declining swiftly (GNU CVS hasn't been updated since 2004) and the +original use case for this tool - browsing change sets in a live CVS +repository - is obsolete. The 3.x versions are more focused on the +--fast-export mode. Accordingly, a large amount of old code and options have been discarded in order to reduce CVSps's complexity and improve its -performance. It now always runs in what used to be cvs_direct mode, +performance. It now always runs in what used to be cvs-direct mode, doing client transactions with the CVS server and not relying on local CVS commands at all. Consequently, all the hairiness around caching and different log/rlog versions is gone and the tool is much faster. Also, it is no longer required that CVSps be run in a CVS checkout -directory, providing CVSROOT is set or --root is used. +directory; it can run from a repository directory, or actually +from anywhere at all providing CVSROOT is set or --root is used. + +The old -A option enabling ancestry-branch tracking didn't work +and has been dropped (equivalent topological analysis is done in +fast-export mode). The new -A option accepts an author-mapping file +in the same format traditionally accepted by git-cvsimport, cvs2git, +git-svn, reposurgeon, and other similar tools. The old-style non-fast-export reporting mode is still supported, but deprecated. In the future, it is possible that it may be dropped @@ -40,6 +48,14 @@ Do 'make' and 'make install'. This is very plain-vanilla ANSI C and should run on any Unixoid OS. +== Dependencies == + +The -g diff-generation option of cvsps depends on diff and sed at runtime. + +== Testing == + +'make check' runs a regression-test suite. + == Running == Note: not all options are necessarily discussed here. Please check the @@ -206,3 +222,4 @@ You can always run CVSps in that subdirectory, and since it IS a separate repository, that does make a little bit of sense. +//end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/compiler.h new/cvsps-3.7/compiler.h --- old/cvsps-3.4/compiler.h 1970-01-01 01:00:00.000000000 +0100 +++ new/cvsps-3.7/compiler.h 2013-01-09 16:44:31.000000000 +0100 @@ -0,0 +1,16 @@ +/* + * Copyright 2013 Sergei Trofimovich + * See COPYING file for license information + */ + +#ifndef COMPILER_H +#define COMPILER_H + +/* gcc specific extension. does nothing on other compilers */ +#if defined(__GNUC__) +# define GCCISM(x) x +#else +# define GCCISM(x) +#endif /* __GNUC__ */ + +#endif /* COMPILER_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/cvsclient.c new/cvsps-3.7/cvsclient.c --- old/cvsps-3.4/cvsclient.c 2013-01-01 18:37:36.000000000 +0100 +++ new/cvsps-3.7/cvsclient.c 2013-01-09 16:48:13.000000000 +0100 @@ -12,6 +12,7 @@ #include <zlib.h> #include <sys/socket.h> +#include "compiler.h" #include "debug.h" #include "tcpsocket.h" #include "sio.h" @@ -42,7 +43,7 @@ }; static void get_cvspass(char *, const char *, int len); -static void send_string(CvsServerCtx *, const char *, ...); +static void send_string(CvsServerCtx *, const char *, ...) GCCISM(__attribute__ ((format (printf, 2, 3)))); static int read_response(CvsServerCtx *, const char *); static void ctx_to_fp(CvsServerCtx * ctx, FILE * fp); static int read_line(CvsServerCtx * ctx, char * p, int len); @@ -126,7 +127,7 @@ send_string(ctx, "Root %s\n", ctx->root); /* this is taken from 1.11.1p1 trace - but with Mbinary removed. we can't handle it (yet!) */ - send_string(ctx, "Valid-responses ok error Valid-requests Checked-in New-entry Checksum Copy-file Updated Created Update-existing Merged Patched Rcs-diff Mode Mod-time Removed Remove-entry Set-static-directory Clear-static-directory Set-sticky Clear-sticky Template Set-checkin-prog Set-update-prog Notified Module-expansion Wrapper-rcsOption M E F\n", ctx->root); + send_string(ctx, "Valid-responses ok error Valid-requests Checked-in New-entry Checksum Copy-file Updated Created Update-existing Merged Patched Rcs-diff Mode Mod-time Removed Remove-entry Set-static-directory Clear-static-directory Set-sticky Clear-sticky Template Set-checkin-prog Set-update-prog Notified Module-expansion Wrapper-rcsOption M E F\n"); send_string(ctx, "valid-requests\n"); @@ -721,24 +722,58 @@ static void ctx_to_fp(CvsServerCtx * ctx, FILE * fp) { char line[BUFSIZ]; + long int conv; + char * sz_e; while (1) { read_line(ctx, line, BUFSIZ); debug(DEBUG_TCP, "ctx_to_fp: %s", line); - if (memcmp(line, "M ", 2) == 0) + + if (strncmp (line, "error ", 6) == 0) { - if (fp) - fprintf(fp, "%s\n", line + 2); + debug(DEBUG_APPERROR, "ctx_to_fp: error: %s", line); + exit(1); } - else if (memcmp(line, "E ", 2) == 0) + + /* EOF. likely delete file */ + if (strcmp (line, "ok") == 0) + break; + + /* wait for raw data size */ + conv = strtol(line, &sz_e, 10); + if (conv == LONG_MIN || conv == LONG_MAX || *sz_e != '\0') + continue; + + debug(DEBUG_TCP, "ctx_to_fp: file size: %ld", conv); + + while (conv) { - debug(DEBUG_TCP, "%s", line + 2); + long bs = ctx->tail - ctx->head; + if (bs > conv) bs = conv; + + fwrite (ctx->head, 1, bs, fp); + ctx->head += bs; + conv -= bs; + + if (conv) + { + if (refill_buffer(ctx) <= 0) + { + debug(DEBUG_APPERROR, "ctx_to_fp: refill_buffer error"); + exit(1); + } + } } - else if (strncmp(line, "ok", 2) == 0 || strncmp(line, "error", 5) == 0) + + read_line(ctx, line, BUFSIZ); + if (strcmp (line, "ok") != 0) { - break; + debug(DEBUG_APPERROR, "ctx_to_fp: error: expected 'ok' at EOF but got: %s", line); + exit(1); } + + break; } if (fp) @@ -766,7 +801,6 @@ { if (kk) send_string(ctx, "Argument -kk\n"); - send_string(ctx, "Argument -p\n"); send_string(ctx, "Argument -r\n"); send_string(ctx, "Argument %s\n", rev); send_string(ctx, "Argument %s/%s\n", rep, file); @@ -840,7 +874,7 @@ } else { - send_string(ctx, "Directory %s\n", rep, file_buff); + send_string(ctx, "Directory %s\n", rep); send_string(ctx, "%s/%s\n", ctx->root, rep); } @@ -877,6 +911,7 @@ char lbuff[BUFSIZ]; int len; + reread: len = read_line(ctx, lbuff, BUFSIZ); debug(DEBUG_TCP, "cvsclient: rlog: read %s", lbuff); @@ -889,6 +924,7 @@ else if (memcmp(lbuff, "E ", 2) == 0) { debug(DEBUG_TCP, "%s", lbuff + 2); + goto reread; } else if (strcmp(lbuff, "ok") == 0 || strncmp(lbuff, "error", 5) == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/cvsps.asc new/cvsps-3.7/cvsps.asc --- old/cvsps-3.4/cvsps.asc 2013-01-01 18:37:36.000000000 +0100 +++ new/cvsps-3.7/cvsps.asc 2013-01-07 13:45:04.000000000 +0100 @@ -9,19 +9,19 @@ [-h] [-z 'fuzz'] [-g] [-s 'patchset'] [-a 'author'] [-f 'file'] [-d 'date1' [-d 'date2']] [-l 'text'] [-b 'branch'] [-n] [-r 'tag' [-r 'tag']] [-p 'directory'] [-A 'authormap'] [-R 'revmap'] - [-v] [-t] [--summary-first] [--test-log 'filename'] - [--diff-opts 'option string'] + [-v] [-t] [--summary-first] [--diff-opts 'option string'] [--debuglvl 'bitmask'] [-Z 'compression'] [--root 'cvsroot'] - [-q] [--fast-export] [-k] [-T] [-V] ['module-path'] + [-q] [--fast-export] [--reposurgeon] [-k] [-T] [-V] ['module-path'] == DESCRIPTION == -cvsps is a program for generating 'patchset' information from a CVS -repository. A patchset in this case is defined as a set of changes made -to a collection of files, and all committed at the same time (using a -single 'cvs commit' command). This information is valuable to seeing the -big picture of the evolution of a CVS project. While CVS tracks revision -information, it is often difficult to see what changes were committed -'atomically' to the repository. +cvsps tries to group the per-file commits and tags in a CVS project +repository into per-project changeset commits with common metadata, in +the style of Subversion and later version-control systems. + +The older, default reporting mode is designed for humans to look at +and only includes commit metadata, not file contents. The newer +--fast-export mode emits a git-style fast-import stream which can be +consumed by the importers for git and other version-control systems. There are several different ways to invoke cvsps: @@ -43,9 +43,7 @@ CVSROOT environment variable, in which case a module-path argument is required. -The default reporting mode is designed for humans to look at. The ---fast-export mode emits a git import stream which can be consumed -by the importers for other version-control systems. In this mode: +In fast-export mode: * Each patchset becomes a commit. @@ -55,15 +53,12 @@ * Other tag and branch names are sanitized to be legal for git. -* CVS keyword expansion is suppressed. - * Since .cvsignore files have a syntax upward-compatible with that -of .gitignore files, they're renamed. + of .gitignore files, they're renamed. -cvsps honors the CVS_RSH and CVS_SERVER environment variables, but -does not parse the $HOME/.cvsrc file. If you have a $HOME/.cvspass file -(such as is normally created by cvs login) it will be searched -for a password. +cvsps does not parse the $HOME/.cvsrc file. If you have a +$HOME/.cvspass file (such as is normally created by cvs login) it will +be searched for a password. == OPTIONS == -h:: @@ -98,16 +93,18 @@ Apply an author-map file to the attribution lines. Each line must be of the form + -------------------------------------------------------- -ferd = Ferd J. Foonly <[email protected]> -0500 -------------------------------------------------------- +------------------------------------------------------ +ferd = Ferd J. Foonly <[email protected]> America/Chicago +------------------------------------------------------ + and will be applied to map the Unix username 'ferd' to the DVCS-style user identity specified after the equals sign. The timezone field (after > and whitespace) is optional and (if present) is used to set -timezone offset to be attached to the date. Whitespace around the -equals sign is stripped. Lines beginning with a # or not containing -an equals sign are silently ignored. +the timezone offset to be attached to the date; acceptable formats for +the timezone field are anything that can be in the TZ environment +variable, including a [+-]hhmm offst. Whitespace around the equals +sign is stripped. Lines beginning with a # or not containing an +equals sign are silently ignored. -R 'revmap':: Write a revision map to the specified argument filename. Each line of the revision map consists of three whitespace-separated fields: a @@ -120,9 +117,6 @@ --summary-first:: when multiple patchset diffs are being generated, put the patchset summary for all patchsets at the beginning of the output. ---test-log 'captured cvs log file':: -for testing changes, you can capture cvs log output, then test against -this captured file instead of hammering some poor CVS server. --diffs-opts 'option string':: send a custom set of options to diff, for example to increase the number of context lines, or change the diff format. @@ -138,17 +132,22 @@ Kill keywords: will extract files with '-kk' from the CVS archive to avoid noisy changesets. -T:: -Force deterministic dates for regression testing. Takes a date -argument which set the base time; ech patchset will have an attributed -date of as many seconds passs the base time as its ID. +Force deterministic dates for regression testing. Each patchset will +have a monotonic-increasing attributed date computed from its patchdet ID. --fast-export:: Emit the report as a git import stream. +--reposurgeon:: +Emit for each commit a list of the CVS file:revision pairs composing it as a +bzr-style commit property named "cvs-revisions". From version 2.12 +onward, reposurgeon can interpret these and use them as hints for +reference-lifting. -V:: Emit the program version and exit. 'module-path':: Operate on the specified module. If this option is not given, either the CVSROOT environment variable must be set to point directly at the -module or cvsps must be run in a repository's checkout directory. +module or cvsps must be run in a checkout directory or repository +module subdirectory. == COMPATIBILITY == The old --cvs-direct option, and the -u and -x options having to do @@ -165,8 +164,9 @@ == USAGE EXAMPLES == cvsps:: - Run within a checkout directory, dumps the history of its module in - its repository in the old format. + Run within a checkout directory or a module subdirectory within + a repository, dumps the history of its module in its repository + in the old format. cvsps --root :local:$PWD/foo --fast-export bar:: Dump the history of module bar from a local repository directory foo in fast-export format. @@ -264,8 +264,8 @@ == CVS LIMITATIONS == Translating CVS repositories to the generic DVCS model expressed by import streams is not merely difficult and messy, there are weird -CVS cases that cannot be correctly translated at all. 'cvsps' will try to -warn you about this rather than silently producing broken or +CVS cases that cannot be correctly translated at all. cvsps will try to +warn you about these cases rather than silently producing broken or incomplete translations. CVS-NT and versions of GNU CVS after 1.12 (2004) added a changeset @@ -284,7 +284,7 @@ within the commit-matching time window, the order of commits reported may be wrong. -These problems cannot be fixed in 'cvsps'; they are inherent to CVS. +These problems cannot be fixed in cvsps; they are inherent to CVS. == CVSPS LIMITATIONS == cvsps may be unable to communicate with some extremely ancient CVS @@ -297,10 +297,10 @@ If any files were ever imported more than once (e.g., import of more than one vendor release), the head revision might contain -incorrect content. 'cvsps' issues a warning when this might occur. +incorrect content. cvsps issues a warning when this might occur. If a CVS branch symbol could not be resolved to a translated -commit, 'cvsps' will issue a warning to that effect. +commit, cvsps will issue a warning to that effect. == REPORTING BUGS == Report bugs to Eric S. Raymond <[email protected]>. The project page diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/cvsps.c new/cvsps-3.7/cvsps.c --- old/cvsps-3.4/cvsps.c 2013-01-01 18:37:36.000000000 +0100 +++ new/cvsps-3.7/cvsps.c 2013-01-09 17:15:08.000000000 +0100 @@ -32,6 +32,9 @@ #define CVS_LOG_BOUNDARY "----------------------------\n" #define CVS_FILE_BOUNDARY "=============================================================================\n" +/* not yet used */ +#define CVS_IGNORES "# Generated by cvsps\nRCS\nSCCS\nCVS\nCVS.adm\nRCSLOG\ncvslog.*\ntags\nTAGS\n.make.state\n.nse_depinfo\n*~\n#*\n.#*\n,*\n_$*\n*$\n*.old\n*.bak\n*.BAK\n*.orig\n*.rej\n.del-*\n*.a\n*.olb\n*.o\n*.obj\n*.so\n*.exe\n*.Z\n*.elc\n*.ln\ncore\n" + enum { NEED_RCS_FILE, @@ -72,7 +75,6 @@ static char strip_path[PATH_MAX]; static int strip_path_len; static bool statistics; -static const char * test_log_file; static struct hash_table * branch_heads; static struct list_head all_patch_sets; static struct list_head collisions; @@ -102,11 +104,12 @@ static const char * diff_opts; static int compress; static char compress_arg[8]; -static time_t regression_time; +static bool regression_time; static bool selection_sense = true; static FILE *revfp; static int verbose = 0; static bool keyword_suppression = false; +static bool reposurgeon = false; static int parse_args(int, char *[]); static int parse_rc(); @@ -147,7 +150,7 @@ static void find_branch_points(PatchSet * ps); static int debug_levels[] = { - DEBUG_APPERROR|DEBUG_SYSERROR|DEBUG_APPWARN, + DEBUG_APPERROR|DEBUG_SYSERROR|DEBUG_APPWARN|DEBUG_USAGE, DEBUG_RETRIEVAL, DEBUG_STATUS, DEBUG_TCP, @@ -189,8 +192,7 @@ */ init_paths(); - if (!test_log_file) - cvsclient_ctx = open_cvs_server(root_path, compress); + cvsclient_ctx = open_cvs_server(root_path, compress); load_from_cvs(); @@ -232,11 +234,11 @@ { if (fast_export) debug(DEBUG_APPERROR, - "commitid reliable only after commit :%d%s", + "commitid reliable only after commit :%d", ps->mark); else debug(DEBUG_APPERROR, - "commitid reliable only after patch set %d%s", + "commitid reliable only after patch set %d", ps->psid); } } @@ -311,9 +313,7 @@ int loglen = 0; bool have_log = false; - if (test_log_file) - cvsfp = fopen(test_log_file, "r"); - else if (cvsclient_ctx) + if (cvsclient_ctx) cvsfp = cvs_rlog_open(cvsclient_ctx, repository_path); if (!cvsfp) @@ -584,11 +584,7 @@ exit(1); } - if (test_log_file) - { - fclose(cvsfp); - } - else if (cvsclient_ctx) + if (cvsclient_ctx) { cvs_rlog_close(cvsclient_ctx); } @@ -597,48 +593,47 @@ static int usage(const char * str1, const char * str2) { if (str1) - debug(DEBUG_APPERROR, "\nbad usage: %s %s\n", str1, str2); + debug(DEBUG_USAGE, "\nbad usage: %s %s\n", str1, str2); - debug(DEBUG_APPERROR, "Usage: cvsps [-h] [-x] [-u] [-z <fuzz>] [-g] [-s <range>[,<range>]] "); - debug(DEBUG_APPERROR, " [-a <author>] [-f <file>] [-d <date1> [-d <date2>]] "); - debug(DEBUG_APPERROR, " [-b <branch>] [-l <regex>] [-n] [-r <tag> [-r <tag>]] "); - debug(DEBUG_APPERROR, " [-p <directory>] [-A 'authormap'] [-v] [-t] [--summary-first]"); - debug(DEBUG_APPERROR, " [--test-log <captured cvs log file>]"); - debug(DEBUG_APPERROR, " [--diff-opts <option string>]"); - debug(DEBUG_APPERROR, " [--debuglvl <bitmask>] [-Z <compression>] [--root <cvsroot>]"); - debug(DEBUG_APPERROR, " [-k] [-T] [-V] [<repository>]"); - debug(DEBUG_APPERROR, ""); - debug(DEBUG_APPERROR, "Where:"); - debug(DEBUG_APPERROR, " -h display this informative message"); - debug(DEBUG_APPERROR, " -z <fuzz> set the timestamp fuzz factor for identifying patch sets"); - debug(DEBUG_APPERROR, " -g generate diffs of the selected patch sets"); - debug(DEBUG_APPERROR, " -s <patch set>[-[<patch set>]][,<patch set>...] restrict patch sets by id"); - debug(DEBUG_APPERROR, " -a <author> restrict output to patch sets created by author"); - debug(DEBUG_APPERROR, " -f <file> restrict output to patch sets involving file"); - debug(DEBUG_APPERROR, " -d <date1> -d <date2> if just one date specified, show"); - debug(DEBUG_APPERROR, " revisions newer than date1. If two dates specified,"); - debug(DEBUG_APPERROR, " show revisions between two dates."); - debug(DEBUG_APPERROR, " -b <branch> restrict output to patch sets affecting history of branch"); - debug(DEBUG_APPERROR, " -l <regex> restrict output to patch sets matching <regex> in log message"); - debug(DEBUG_APPERROR, " -n negate filter sense, print all patchsetss *not* matching."); - debug(DEBUG_APPERROR, " -r <tag1> -r <tag2> if just one tag specified, show"); - debug(DEBUG_APPERROR, " revisions since tag1. If two tags specified, show"); - debug(DEBUG_APPERROR, " revisions between the two tags."); - debug(DEBUG_APPERROR, " -p <directory> output patch sets to individual files in <directory>"); - debug(DEBUG_APPERROR, " -v show very verbose parsing messages"); - debug(DEBUG_APPERROR, " -t show some brief memory usage statistics"); - debug(DEBUG_APPERROR, " --summary-first when multiple patch sets are shown, put all summaries first"); - debug(DEBUG_APPERROR, " --test-log <captured cvs log> supply a captured cvs log for testing"); - debug(DEBUG_APPERROR, " --diff-opts <option string> supply special set of options to diff"); - debug(DEBUG_APPERROR, " --debuglvl <bitmask> enable various debug channels."); - debug(DEBUG_APPERROR, " -Z <compression> A value 1-9 which specifies amount of compression"); - debug(DEBUG_APPERROR, " --root <cvsroot> specify cvsroot. overrides env. and working directory"); - debug(DEBUG_APPERROR, " -k suppress CVS keyword expansion"); - debug(DEBUG_APPERROR, " -T <date> set base date for regression testing"); - debug(DEBUG_APPERROR, " --fast-export emit a git-style fast-import stream"); - debug(DEBUG_APPERROR, " -V emit version and exit"); - debug(DEBUG_APPERROR, " <repository> apply cvsps to repository. Overrides working directory"); - debug(DEBUG_APPERROR, "\ncvsps version %s\n", VERSION); + debug(DEBUG_USAGE, "Usage: cvsps [-h] [-x] [-u] [-z <fuzz>] [-g] [-s <range>[,<range>]] "); + debug(DEBUG_USAGE, " [-a <author>] [-f <file>] [-d <date1> [-d <date2>]] "); + debug(DEBUG_USAGE, " [-b <branch>] [-l <regex>] [-n] [-r <tag> [-r <tag>]] "); + debug(DEBUG_USAGE, " [-p <directory>] [-A 'authormap'] [-v] [-t] [--summary-first]"); + debug(DEBUG_USAGE, " [--diff-opts <option string>]"); + debug(DEBUG_USAGE, " [--debuglvl <bitmask>] [-Z <compression>] [--root <cvsroot>]"); + debug(DEBUG_USAGE, " [-k] [-T] [-V] [<repository>]"); + debug(DEBUG_USAGE, " "); + debug(DEBUG_USAGE, "Where:"); + debug(DEBUG_USAGE, " -h display this informative message"); + debug(DEBUG_USAGE, " -z <fuzz> set the timestamp fuzz factor for identifying patch sets"); + debug(DEBUG_USAGE, " -g generate diffs of the selected patch sets"); + debug(DEBUG_USAGE, " -s <patch set>[-[<patch set>]][,<patch set>...] restrict patch sets by id"); + debug(DEBUG_USAGE, " -a <author> restrict output to patch sets created by author"); + debug(DEBUG_USAGE, " -f <file> restrict output to patch sets involving file"); + debug(DEBUG_USAGE, " -d <date1> -d <date2> if just one date specified, show"); + debug(DEBUG_USAGE, " revisions newer than date1. If two dates specified,"); + debug(DEBUG_USAGE, " show revisions between two dates."); + debug(DEBUG_USAGE, " -b <branch> restrict output to patch sets affecting history of branch"); + debug(DEBUG_USAGE, " -l <regex> restrict output to patch sets matching <regex> in log message"); + debug(DEBUG_USAGE, " -n negate filter sense, print all patchsetss *not* matching."); + debug(DEBUG_USAGE, " -r <tag1> -r <tag2> if just one tag specified, show"); + debug(DEBUG_USAGE, " revisions since tag1. If two tags specified, show"); + debug(DEBUG_USAGE, " revisions between the two tags."); + debug(DEBUG_USAGE, " -p <directory> output patch sets to individual files in <directory>"); + debug(DEBUG_USAGE, " -v show very verbose parsing messages"); + debug(DEBUG_USAGE, " -t show some brief memory usage statistics"); + debug(DEBUG_USAGE, " --summary-first when multiple patch sets are shown, put all summaries first"); + debug(DEBUG_USAGE, " --diff-opts <option string> supply special set of options to diff"); + debug(DEBUG_USAGE, " --debuglvl <bitmask> enable various debug channels."); + debug(DEBUG_USAGE, " -Z <compression> A value 1-9 which specifies amount of compression"); + debug(DEBUG_USAGE, " --root <cvsroot> specify cvsroot. overrides env. and working directory"); + debug(DEBUG_USAGE, " -k suppress CVS keyword expansion"); + debug(DEBUG_USAGE, " -T <date> set base date for regression testing"); + debug(DEBUG_USAGE, " --fast-export emit a git-style fast-import stream"); + debug(DEBUG_USAGE, " --reposurgeon emit reference-lifting hints for reposurgeon.\n"); + debug(DEBUG_USAGE, " -V emit version and exit"); + debug(DEBUG_USAGE, " <repository> apply cvsps to repository. Overrides working directory"); + debug(DEBUG_USAGE, "\ncvsps version %s\n", VERSION); return -1; } @@ -646,6 +641,7 @@ static int parse_args(int argc, char *argv[]) { int i = 1; + debuglvl = debug_levels[0]; while (i < argc) { if (strcmp(argv[i], "-a") == 0) @@ -680,7 +676,7 @@ fp = fopen(argv[i++], "r"); if (fp == NULL) { - debug(DEBUG_APPERROR, "cvsps: couldn't open specified author map.\n"); + debug(DEBUG_APPERROR, "couldn't open specified author map.\n"); exit(1); } /* coverity[tainted_data] */ @@ -696,11 +692,9 @@ ++shortname; if (*shortname == '#') continue; - for (cp = eq; cp >= shortname; --cp) - if (*cp == '=') - continue; - else if (isspace(*cp)) - *cp = '\0'; + *eq = '\0'; + for (cp = eq-1; cp >= shortname && isspace(*cp); --cp) + *cp = '\0'; for (longname = eq + 1; isspace(*longname); ++longname) continue; timezone = strchr(longname, '>'); @@ -871,24 +865,24 @@ if (strcmp(argv[i], "-T") == 0) { - if (++i >= argc) - return usage("argument to -T missing", ""); - - convert_date(®ression_time, argv[i++]); + regression_time = true; + i++; continue; } /* leave this in place so git-cvsimport will cause graceful death */ if (strcmp(argv[i], "-u") == 0) { - debug(DEBUG_APPERROR, "cvsps: -u is no longer supported.\n"); - debug(DEBUG_APPERROR, "cvsps: your calling program needs to be upgraded to work with cvsps 3.x.\n"); + debug(DEBUG_APPERROR, "-u is no longer supported.\n"); + debug(DEBUG_APPERROR, "your calling program needs to be upgraded to work with cvsps 3.x.\n"); exit(1); } if (strcmp(argv[i], "-v") == 0) { verbose++; + if (verbose < sizeof(debug_levels)/sizeof(debug_levels[0])) + debuglvl |= debug_levels[verbose]; i++; continue; } @@ -927,10 +921,17 @@ if (strcmp(argv[i], "--debuglvl") == 0) { + char *end; + long lvl; + if (++i >= argc) return usage("argument to --debuglvl missing", ""); - debuglvl = atoi(argv[i++]); + lvl = strtol(argv[i], &end, 0); + if (*end != '\0') + return usage("invalid value passed to --debuglvl", argv[i]); + debuglvl = lvl; + i++; continue; } @@ -973,12 +974,10 @@ continue; } - if (strcmp(argv[i], "--test-log") == 0) + if (strcmp(argv[i], "--reposurgeon") == 0) { - if (++i >= argc) - return usage("argument to --test-log missing", ""); - - test_log_file = argv[i++]; + reposurgeon = true; + i++; continue; } @@ -988,21 +987,6 @@ strcpy(repository_path, argv[i++]); } - if (fast_export && test_log_file) - { - debug(DEBUG_APPERROR, "cvsps: --fast-export and --test-log are not compatible.\n"); - exit(1); - } - - if (do_diff && test_log_file) - { - debug(DEBUG_APPERROR, "cvsps: -g and --test-log are not compatible.\n"); - exit(1); - } - - if (debuglvl == 0) - for (i = 0; i <= verbose && i < sizeof(debug_levels)/sizeof(debug_levels[0]); i++) - debuglvl |= debug_levels[i]; return 0; } @@ -1556,6 +1540,7 @@ return false; ok: + //fprintf(stderr, "Time check: %zd %zd %zd\n", restrict_date_start, restrict_date_end, ps->date); if (restrict_date_start > 0 && (ps->date < restrict_date_start || (restrict_date_end > 0 && ps->date > restrict_date_end))) @@ -1703,6 +1688,33 @@ printf("\n"); } +static const char *utc_offset_timestamp(const time_t *timep, const char *tz) +{ + static char outbuf[BUFSIZ]; + + struct tm *tm; + char tzbuf[BUFSIZ]; + char *oldtz = getenv("TZ"); + + // make a copy in case original is clobbered + if (oldtz != NULL) + strncpy(tzbuf, oldtz, sizeof(tzbuf)); + + setenv("TZ", tz, 1); + tzset(); // just in case ... + + tm = localtime(timep); + strftime(outbuf, sizeof(outbuf), "%s %z", tm); + + if (oldtz != NULL) + setenv("TZ", tzbuf, 1); + else + unsetenv("TZ"); + tzset(); + + return outbuf; +} + #define SUFFIX(a, s) (strcmp(a + strlen(a) - strlen(s), s) == 0) static char *fast_export_sanitize(char *name, char *sanitized, int sanlength) @@ -1734,7 +1746,6 @@ static void print_fast_export(PatchSet * ps) { - struct tm *tm; struct list_head * next, * tagl, * mapl; static int mark = 0; char *tf = tmpnam(NULL); /* ugly necessity */ @@ -1785,23 +1796,16 @@ } } - /* we need to be able to fake dates for regression testing */ - if (regression_time == 0) - tm = localtime(&ps->date); - else - { - time_t clock_tick = regression_time + ps->psid * timestamp_fuzz_factor * 2; - tm = localtime(&clock_tick); - } - for all_patchset_members(next, ps) { PatchSetMember * psm = list_entry(next, PatchSetMember, link); + size_t res; if (!psm->post_rev->dead) { FILE *ofp = fopen(tf, "w"); FILE *cfp; + char buf[BUFSIZ]; if (ofp == NULL) { @@ -1837,8 +1841,8 @@ psm->file->filename, psm->post_rev->rev); exit(1); } - while ((c = fgetc(cfp)) != EOF) - putchar(c); + while ((res = fread (buf, 1, sizeof (buf), cfp)) != 0) + fwrite (buf, 1, res, stdout); (void)fclose(cfp); putchar('\n'); @@ -1851,7 +1855,7 @@ } match = NULL; - tz = "+0000"; + tz = "UTC"; for (mapl = authormap.next; mapl != &authormap; mapl = mapl->next) { MapEntry* mapentry = list_entry (mapl, MapEntry, link); @@ -1879,13 +1883,49 @@ printf("committer %s", match); else printf("committer %s <%s>", ps->author, ps->author); - printf(" %zd %s\n", mktime(tm) - tm->tm_gmtoff, tz); + printf(" %s\n", utc_offset_timestamp(&ps->date, tz)); printf("data %zd\n%s\n", strlen(ps->descr), ps->descr); + if (reposurgeon) + { + FILE *ofp = fopen(tf, "w"); + FILE *cfp; + + if (ofp == NULL) + { + debug(DEBUG_APPERROR, "tempfile write of CVS revisions failed.\n"); + exit(1); + } + for all_patchset_members(next, ps) + { + PatchSetMember * psm = list_entry(next, PatchSetMember, link); + + if (!psm->post_rev->dead) + fprintf(ofp, + "%s:%s\n", psm->file->filename, psm->post_rev->rev); + } + fclose(ofp); + + /* coverity[toctou] */ + if (stat(tf, &st) != 0) + { + debug(DEBUG_APPERROR, "stat(2) of CVS revisuions failed.\n"); + exit(1); + } + printf("property cvs-revisions %ld ", st.st_size); + if ((cfp = fopen(tf, "r")) == NULL) + { + debug(DEBUG_APPERROR, "tempfile read of CVS revisions failed.\n"); + exit(1); + } + while ((c = fgetc(cfp)) != EOF) + putchar(c); + (void)fclose(cfp); + putchar('\n'); + } if (ancestor_mark) printf("from :%d\n", ancestor_mark); ps->mark = tip->mark = mark; - for all_patchset_members(next, ps) { PatchSetMember * psm = list_entry(next, PatchSetMember, link); @@ -1941,7 +1981,7 @@ if (branch->ps == NULL) debug(DEBUG_APPWARN, "branch symbol %s not translated", name); - else + else if (branch->ps->mark) printf("reset refs/tags/%s\nfrom :%d\n\n", name, branch->ps->mark); } @@ -1968,6 +2008,10 @@ ps_counter++; ps->psid = ps_counter; + /* we need to be able to fake dates for regression testing */ + if (regression_time) + ps->date = ps->psid * timestamp_fuzz_factor * 2; + find_branch_points(ps); } else @@ -2907,8 +2951,8 @@ if (next_ps->date > ps->date) break; - debug(DEBUG_STATUS, "ps->date %d next_ps->date %d rev->rev %s rev->branch %s", - ps->date, next_ps->date, rev->rev, rev->branch); + debug(DEBUG_STATUS, "ps->date %lld next_ps->date %lld rev->rev %s rev->branch %s", + (long long)ps->date, (long long)next_ps->date, rev->rev, rev->branch); /* * If the tagname is one of the two possible '-r' tags diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/debug.c new/cvsps-3.7/debug.c --- old/cvsps-3.4/debug.c 2013-01-01 18:37:36.000000000 +0100 +++ new/cvsps-3.7/debug.c 2013-01-06 22:50:51.000000000 +0100 @@ -65,8 +65,10 @@ fprintf(channel, BUGPREFIX "%s: %s\n", msgbuff, errmsg); } - else + else if (dtype != DEBUG_USAGE) fprintf(channel, BUGPREFIX "%s\n", msgbuff); + else + fprintf(channel, "%s\n", msgbuff); fflush(channel); #ifdef _WIN32 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/debug.h new/cvsps-3.7/debug.h --- old/cvsps-3.4/debug.h 2013-01-01 18:37:36.000000000 +0100 +++ new/cvsps-3.7/debug.h 2013-01-09 16:44:48.000000000 +0100 @@ -12,6 +12,7 @@ #include <sys/types.h> #endif +#include "compiler.h" #include "inline.h" #define DEBUG_NUM_FACILITIES 32 /* should be 64 on 64bit CPU... */ @@ -19,6 +20,7 @@ #define DEBUG_ERROR 0x0001 #define DEBUG_APPERROR 0x0002 #define DEBUG_APPWARN 0x0004 +#define DEBUG_USAGE 0x0008 #define DEBUG_RETRIEVAL 0x0010 #define DEBUG_STATUS 0x0020 #define DEBUG_TCP 0x0040 @@ -31,13 +33,14 @@ extern unsigned int debuglvl; -void hexdump( const char *ptr, int size, const char *fmt, ... ); +void hexdump( const char *ptr, int size, const char *fmt, ... ) GCCISM(__attribute__ ((format (printf, 3, 4)))); void vdebug(int dtype, const char *fmt, va_list); void vmdebug(int dtype, const char *fmt, va_list); void to_hex( char* dest, const char* src, size_t n ); void debug_set_error_file(FILE *); void debug_set_error_facility(int mask, FILE *); +static INLINE void debug(unsigned int dtype, const char *fmt, ...) GCCISM(__attribute__ ((format (printf, 2, 3)))); static INLINE void debug(unsigned int dtype, const char *fmt, ...) { va_list ap; @@ -50,6 +53,7 @@ va_end(ap); } +static INLINE void mdebug(unsigned int dtype, const char *fmt, ...) GCCISM(__attribute__ ((format (printf, 2, 3)))); static INLINE void mdebug(unsigned int dtype, const char *fmt, ...) { va_list ap; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvsps-3.4/tcpsocket.c new/cvsps-3.7/tcpsocket.c --- old/cvsps-3.4/tcpsocket.c 2013-01-01 18:37:36.000000000 +0100 +++ new/cvsps-3.7/tcpsocket.c 2013-01-09 17:10:48.000000000 +0100 @@ -15,6 +15,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> +#include <netinet/tcp.h> #include <arpa/inet.h> #include <netdb.h> #include <errno.h> @@ -47,6 +48,21 @@ setsockopt( retval, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(int)); } + /* + * This is a good performance enhancement when the socket is going to + * be used to pass a lot of short commands. It prevents them from being + * delayed by the Nagle algorithm until they can be aggreagated into + * a large packet. See http://en.wikipedia.org/wiki/Nagle%27s_algorithm + * for discussion. + */ + yes = 1; + setsockopt (retval, /* socket affected */ + IPPROTO_TCP, /* set option at TCP level */ + TCP_NODELAY, /* name of option */ + (char *) &yes, /* the cast is historical + cruft */ + sizeof(int)); /* length of option value */ + debug(DEBUG_TCP, "tcp: socket created"); #ifdef WIN32 return get_fd(retval, WIN32_SOCKET); @@ -224,7 +240,7 @@ break; } - debug(DEBUG_ERROR, "gethostbyname failed for %s: ", addr_str, errstr); + debug(DEBUG_ERROR, "gethostbyname failed for %s: %s", addr_str, errstr); retval = -1; } -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
