diff options
author | peter <peter@FreeBSD.org> | 2002-12-02 03:13:37 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-12-02 03:13:37 +0000 |
commit | 3dc96f7243ece1d1f7f87b03334f840415e0db63 (patch) | |
tree | 15f00bd8ebd718713d8c0a8707ebebfced99c550 /contrib/cvs/src/log.c | |
parent | cf46dfb750863d760d19b9858b0a336b158275da (diff) | |
download | FreeBSD-src-3dc96f7243ece1d1f7f87b03334f840415e0db63.zip FreeBSD-src-3dc96f7243ece1d1f7f87b03334f840415e0db63.tar.gz |
Import cvs-1.11.2.1 as of 2002/12/01 onto vendor branch. This fixes all
of the bugs that I know of. We've been running a slightly older version
of this on freefall/repoman, where it was afflicted by a silly merge error
on my part (fixed).
Approved by: re
Diffstat (limited to 'contrib/cvs/src/log.c')
-rw-r--r-- | contrib/cvs/src/log.c | 104 |
1 files changed, 78 insertions, 26 deletions
diff --git a/contrib/cvs/src/log.c b/contrib/cvs/src/log.c index ad780bb..c7e5600 100644 --- a/contrib/cvs/src/log.c +++ b/contrib/cvs/src/log.c @@ -383,6 +383,7 @@ cvslog (argc, argv) dellist (&log_data.statelist); send_arg_list ("-w", log_data.authorlist); dellist (&log_data.authorlist); + send_arg ("--"); if (is_rlog) { @@ -549,7 +550,7 @@ rlog_proc (argc, argv, xwhere, mwhere, mfile, shorten, local, mname, msg) err = start_recursion (log_fileproc, (FILESDONEPROC) NULL, log_dirproc, (DIRLEAVEPROC) NULL, (void *) &log_data, - argc - 1, argv + 1, local, which, 0, 1, + argc - 1, argv + 1, local, which, 0, LOCK_READ, where, 1); return err; } @@ -753,7 +754,7 @@ log_parse_list (plist, argstring) len = cp - argstring; p->key = xmalloc (len + 1); strncpy (p->key, argstring, len); - p->key[len + 1] = '\0'; + p->key[len] = '\0'; } if (*plist == NULL) @@ -1108,21 +1109,26 @@ log_expand_revlist (rcs, revlist, default_branch) does. This code is a bit cryptic for my tastes, but keeping the same implementation as rlog ensures a certain degree of compatibility. */ - if (r->first == NULL && nr->last != NULL) + if (r->first == NULL) { - nr->fields = numdots (nr->last) + 1; - if (nr->fields < 2) - nr->first = xstrdup (".0"); + if (nr->last == NULL) + nr->fields = 0; else { - char *cp; - - nr->first = xstrdup (nr->last); - cp = strrchr (nr->first, '.'); - strcpy (cp, ".0"); + nr->fields = numdots (nr->last) + 1; + if (nr->fields < 2) + nr->first = xstrdup (".0"); + else + { + char *cp; + + nr->first = xstrdup (nr->last); + cp = strrchr (nr->first, '.'); + strcpy (cp + 1, "0"); + } } } - else if (r->last == NULL && nr->first != NULL) + else if (r->last == NULL) { nr->fields = numdots (nr->first) + 1; nr->last = xstrdup (nr->first); @@ -1136,13 +1142,30 @@ log_expand_revlist (rcs, revlist, default_branch) *cp = '\0'; } } - else if (nr->first != NULL && nr->last != NULL) + else if (nr->first == NULL || nr->last == NULL) + nr->fields = 0; + else if (strcmp (nr->first, nr->last) == 0) + nr->fields = numdots (nr->last) + 1; + else { - nr->fields = numdots (nr->first) + 1; - if (nr->fields != numdots (nr->last) + 1 - || (nr->fields > 2 - && version_compare (nr->first, nr->last, - nr->fields - 1) != 0)) + int ord; + int dots1 = numdots (nr->first); + int dots2 = numdots (nr->last); + if (dots1 > dots2 || (dots1 == dots2 && + version_compare (nr->first, nr->last, dots1 + 1) > 0)) + { + char *tmp = nr->first; + nr->first = nr->last; + nr->last = tmp; + nr->fields = dots2 + 1; + dots2 = dots1; + dots1 = nr->fields - 1; + } + else + nr->fields = dots1 + 1; + dots1 += (nr->fields & 1); + ord = version_compare (nr->first, nr->last, dots1); + if (ord > 0 || (nr->fields > 2 && ord < 0)) { error (0, 0, "invalid branch or revision pair %s:%s in `%s'", @@ -1153,17 +1176,46 @@ log_expand_revlist (rcs, revlist, default_branch) nr->last = NULL; nr->fields = 0; } - else if (version_compare (nr->first, nr->last, nr->fields) > 0) + else { - char *tmp; - - tmp = nr->first; - nr->first = nr->last; - nr->last = tmp; + if (nr->fields <= dots2 && (nr->fields & 1)) + { + char *p = xmalloc (strlen (nr->first) + 3); + strcpy (p, nr->first); + strcat (p, ".0"); + free (nr->first); + nr->first = p; + ++nr->fields; + } + while (nr->fields <= dots2) + { + char *p; + int i; + + nr->next = NULL; + *pr = nr; + nr = (struct revlist *) xmalloc (sizeof *nr); + nr->inclusive = 1; + nr->first = xstrdup ((*pr)->last); + nr->last = xstrdup ((*pr)->last); + nr->fields = (*pr)->fields; + p = (*pr)->last; + for (i = 0; i < nr->fields; i++) + p = strchr (p, '.') + 1; + p[-1] = '\0'; + p = strchr (nr->first + (p - (*pr)->last), '.'); + if (p != NULL) + { + *++p = '0'; + *++p = '\0'; + nr->fields += 2; + } + else + ++nr->fields; + pr = &(*pr)->next; + } } } - else - nr->fields = 0; } nr->next = NULL; |