info-cvs
[Top][All Lists]
Advanced

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

Re: Equivalent to "cvs log -rBASE::HEAD"?


From: Larry Jones
Subject: Re: Equivalent to "cvs log -rBASE::HEAD"?
Date: Tue, 1 Feb 2005 14:50:14 -0500 (EST)

Jim Searle writes:
> 
> I found this question in the archives, but never saw an answer.  Is there a
> way to get 'BASE' to work with 'cvs log'?

Yes, by fixing the code, which I just did.  :-)

The fix will be in the next releases.  If you just can't wait, here's a
patch (for the stable [1.11] branch):

Index: log.c
===================================================================
RCS file: /cvs/ccvs/src/log.c,v
retrieving revision 1.79.4.12
retrieving revision 1.79.4.14
diff -u -r1.79.4.12 -r1.79.4.14
--- log.c       29 Jan 2005 18:39:50 -0000      1.79.4.12
+++ log.c       1 Feb 2005 19:09:07 -0000       1.79.4.14
@@ -1,6 +1,11 @@
 /*
- * Copyright (c) 1992, Brian Berliner and Jeff Polk
- * Copyright (c) 1989-1992, Brian Berliner
+ * Copyright (C) 1986-2005 The Free Software Foundation, Inc.
+ *
+ * Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
+ *                                  and others.
+ *
+ * Portions Copyright (C) 1992, Brian Berliner and Jeff Polk
+ * Portions Copyright (C) 1989-1992, Brian Berliner
  * 
  * You may distribute under the terms of the GNU General Public License as
  * specified in the README file that comes with the CVS source distribution.
@@ -123,7 +128,7 @@
 static struct option_revlist *log_parse_revlist PROTO ((const char *));
 static void log_parse_date PROTO ((struct log_data *, const char *));
 static void log_parse_list PROTO ((List **, const char *));
-static struct revlist *log_expand_revlist PROTO ((RCSNode *,
+static struct revlist *log_expand_revlist PROTO ((RCSNode *, char *,
                                                  struct option_revlist *,
                                                  int));
 static void log_free_revlist PROTO ((struct revlist *));
@@ -810,21 +815,30 @@
 {
     struct log_data *log_data = (struct log_data *) callerdat;
     Node *p;
+    char *baserev;
     int selrev = -1;
     RCSNode *rcsfile;
     char buf[50];
     struct revlist *revlist = NULL;
     struct log_data_and_rcs log_data_and_rcs;
 
-    if ((rcsfile = finfo->rcs) == NULL)
+    rcsfile = finfo->rcs;
+    p = findnode (finfo->entries, finfo->file);
+    if (p != NULL)
+    {
+       Entnode *e = p->data;
+       baserev = e->version;
+       if (baserev[0] == '-') ++baserev;
+    }
+    else
+       baserev = NULL;
+
+    if (rcsfile == NULL)
     {
        /* no rcs file.  What *do* we know about this file? */
-       p = findnode (finfo->entries, finfo->file);
-       if (p != NULL)
+       if (baserev != NULL)
        {
-           Entnode *e = p->data;
-
-           if (e->version[0] == '0' && e->version[1] == '\0')
+           if (baserev[0] == '0' && baserev[1] == '\0')
            {
                if (!really_quiet)
                    error (0, 0, "%s has been added, but not committed",
@@ -847,7 +861,7 @@
 
        /* Turn any symbolic revisions in the revision list into numeric
           revisions.  */
-       revlist = log_expand_revlist (rcsfile, log_data->revlist,
+       revlist = log_expand_revlist (rcsfile, baserev, log_data->revlist,
                                      log_data->default_branch);
        if (log_data->sup_header
             || (!log_data->header && !log_data->long_header))
@@ -1037,8 +1051,9 @@
  * Expand any symbolic revisions.
  */
 static struct revlist *
-log_expand_revlist (rcs, revlist, default_branch)
+log_expand_revlist (rcs, baserev, revlist, default_branch)
     RCSNode *rcs;
+    char *baserev;
     struct option_revlist *revlist;
     int default_branch;
 {
@@ -1099,7 +1114,9 @@
                nr->first = xstrdup (r->first);
            else
            {
-               if (RCS_nodeisbranch (rcs, r->first))
+               if (baserev && strcmp (r->first, TAG_BASE) == 0)
+                   nr->first = xstrdup (baserev);
+               else if (RCS_nodeisbranch (rcs, r->first))
                    nr->first = RCS_whatbranch (rcs, r->first);
                else
                    nr->first = RCS_gettag (rcs, r->first, 1, (int *) NULL);
@@ -1117,7 +1134,9 @@
                nr->last = xstrdup (r->last);
            else
            {
-               if (RCS_nodeisbranch (rcs, r->last))
+               if (baserev && strcmp (r->last, TAG_BASE) == 0)
+                   nr->last = xstrdup (baserev);
+               else if (RCS_nodeisbranch (rcs, r->last))
                    nr->last = RCS_whatbranch (rcs, r->last);
                else
                    nr->last = RCS_gettag (rcs, r->last, 1, (int *) NULL);

-Larry Jones

There's never enough time to do all the nothing you want. -- Calvin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]