bug-rcs
[Top][All Lists]
Advanced

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

selections with rlog -R


From: Aaron S. Hawley
Subject: selections with rlog -R
Date: Mon, 15 Aug 2005 15:44:11 -0400 (EDT)

rlog uses RCS's usual selection system for displaying selected revisions.
RCS's selection options include `-d', `-l', `-r', `-s', and `-w'.

rlog ignores such options when the following "output restriction" options
are entered:

 * `-h' (rlog header with no description),
 * `-t' (rlog header with descriptive text)
 * and `-R' (RCS pathanem only).

Currently, the only way for rlog to ignore (internally skip) files is with
`-L'.  This makes rlog's behavior limited.  Currently, the following
commands below with selection options simply print the RCS pathname always
and are equivalent to `rlog -R RCS/*'.  Above each command in a Shell
comment is what one would think would be the meaning of the command.

  # With current revision checked in by login "ashawley"
  rlog -r -w"ashawley" -R RCS/*

  # With any revisions after Aug 15 2005
  rlog -d">2005/08/15" -R RCS/*

  # With current revision before Aug 15 2005
  rlog -r -d">2005/08/15" -R RCS/*

  # Current revision with state Release or Stable.
  rlog -r -s"Rel,Sta" -R RCS/*

Attached is a patch that actually utilizes RCS's selectiong system for
`-R'.  Most of the patch is whitespace indentation introduced by
conditionals, so included below is a whitespace-changes-removed patch.
This is work in progress.  Really, such a patch needs to not only improve
`-R', but also `-h' and `-t' options.  That will take more work.

Here are some examples (and tests) of the patch's functionality using just
some rudimentary selections:

$ mkdir RCS
$ touch file1
$ ci -i -t-file1 -sRel file1
RCS/file1,v  <--  file1
initial revision: 1.1
done
$ co -l file1
RCS/file1,v  -->  file1
revision 1.1 (locked)
done
$ echo experimenting is fun >> file1
$ ci -m"experimental edit" -sExp file1
RCS/file1,v  <--  file1
new revision: 1.2; previous revision: 1.1
done
$ rlog -R -sExp file1
RCS/file1,v
$ rlog -R -sRel file1
RCS/file1,v
$ rlog -r -R -sExp file1
RCS/file1,v
$ rlog -r -R -sRel file1
$ touch file2
$ ci -i -t-file2 -sExp file2
RCS/file2,v  <--  file2
initial revision: 1.1
done
$ rlog -R -sRel RCS/*
RCS/file1,v
$ rlog -R -sExp RCS/*
RCS/file1,v
RCS/file2,v
$ rlog -R -r -sRel RCS/*
$ rlog -R -r -sExp RCS/*
RCS/file1,v
RCS/file2,v

Here is how it runs in the existing RCS 5.7 version of rlog:

$ mkdir RCS
$ touch file1
$ ci -i -t-file1 -sRel file1
RCS/file1,v  <--  file1
initial revision: 1.1
done
$ co -l file1
RCS/file1,v  -->  file1
revision 1.1 (locked)
done
$ echo experimenting is fun >> file1
$ ci -m"experimental edit" -sExp file1
RCS/file1,v  <--  file1
new revision: 1.2; previous revision: 1.1
done
$ rlog -R -sExp file1
RCS/file1,v
$ rlog -R -sRel file1
RCS/file1,v
$ rlog -r -R -sExp file1
RCS/file1,v
$ rlog -r -R -sRel file1
RCS/file1,v
$ touch file2
$ ci -i -t-file2 -sExp file2
RCS/file2,v  <--  file2
initial revision: 1.1
done
$ rlog -R -sRel RCS/*
RCS/file1,v
RCS/file2,v
$ rlog -R -sExp RCS/*
RCS/file1,v
RCS/file2,v
$ rlog -R -r -sRel RCS/*
RCS/file1,v
RCS/file2,v
$ rlog -R -r -sExp RCS/*
RCS/file1,v
RCS/file2,v

--- rlog.c      1995/06/16 06:19:24     5.18
+++ rlog.c      2005/08/12 22:45:15
@@ -212,6 +212,8 @@
 static int branchflag; /*set on -b */
 static int exitstatus;
 static int lockflag;
+static int onlyRCSflag;  /* print only RCS pathname */
+static int printedRCS;  /* RCS pathaname printed for -R */
 static struct Datepairs *datelist, *duelst;
 static struct Revpairs *revlist, *Revlst;
 static struct authors *authorlist;
@@ -235,7 +237,6 @@
        struct rcslock const *currlock;
        int descflag, selectflag;
        int onlylockflag;  /* print only files with locks */
-       int onlyRCSflag;  /* print only RCS pathname */
        int pre5;
        int shownames;
        int revno;
@@ -371,11 +372,6 @@
            if (onlylockflag && !Locks)
                continue;

-           if ( onlyRCSflag ) {
-               aprintf(out, "%s\n", RCSname);
-               continue;
-           }
-
            gettree();

            if (!getnumericrev())
@@ -385,7 +381,8 @@
            * Output the first character with putc, not printf.
            * Otherwise, an SVR4 stdio bug buffers output inefficiently.
            */
+           if (! onlyRCSflag ) {
                afputc('\n', out)

            /*   print RCS pathname, working pathname and optional
                  administrative information                         */
@@ -429,6 +426,7 @@
            aprintf(out, "\ntotal revisions: %d", TotalDeltas);

            revno = 0;
+           }

            if (Head  &&  selectflag & descflag) {

@@ -444,12 +442,19 @@

                revno = extdate(Head);

+               if (! onlyRCSflag ) {
                aprintf(out, ";\tselected revisions: %d", revno);
            }
+           }

+           if (! onlyRCSflag ) {
            afputc('\n',out);
+           }
            if (descflag) {
+               if (! onlyRCSflag ) {
                aputs("description:\n", out);
+                   getdesc(false);
+               } else
                getdesc(true);
            }
            if (revno) {
@@ -459,11 +464,15 @@
                    /* Read through delta->next to get its insertlns.  */
                    while (readdeltalog() != delta->next)
                        continue;
+               printedRCS = false;
                putrunk();
                putree(Head);
+               printedRCS = false;
            }
+           if (! onlyRCSflag ) {
            
aputs("=============================================================================\n",out);
          }
+         }
        Ofclose(out);
        exitmain(exitstatus);
 }
@@ -571,6 +580,13 @@
             return;

        out = stdout;
+       if ( onlyRCSflag ) {
+           if (! printedRCS ) {
+               aprintf(out, "%s\n", RCSname);
+               printedRCS = true;
+           }
+           return;
+       }
        aprintf(out,
                "----------------------------\nrevision %s%s",
                node->num,  pre5 ? "        " : ""

Attachment: rlog.c-improve_-R_option.diff
Description: diff -u patch against rlog.c


reply via email to

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