bug-cvs
[Top][All Lists]
Advanced

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

Re: Feature request/ideas


From: Frank Hemer
Subject: Re: Feature request/ideas
Date: Thu, 24 Feb 2005 16:50:12 +0100
User-agent: KMail/1.5.1

On Wednesday 23 February 2005 00:31, Derek Price wrote:
> Frank Hemer wrote:
> | In response to an old thread/message from dec 04,
> | (http://lists.gnu.org/archive/html/bug-cvs/2004-12/msg00150.html) I
> | would like to add some suggestions:
> |
> | The cvsnt commitid feature for the log cmd is a very neet feature
> | because it allows to collect all versions that belong to a single
> | commit.
>
> Yes, this would be nice.

I have added support for the commitid in about the same manner as it is 
implemented in cvsnt, so this shouldn't be a compatibility issue. However, 
the commitid is as well added to the 1.1 and 1.1.1.1 revisions at the initial 
import.

Here goes the patch:

Index: src/cvs.h
===================================================================
RCS file: /cvs/ccvs/src/cvs.h,v
retrieving revision 1.328
diff -u -r1.328 cvs.h
--- src/cvs.h   23 Feb 2005 19:59:49 -0000      1.328
+++ src/cvs.h   24 Feb 2005 15:35:05 -0000
@@ -896,3 +896,6 @@
 void cvs_flusherr (void);
 void cvs_flushout (void);
 void cvs_output_tagged (const char *, const char *);
+
+#define GLOBAL_SESSION_ID_LENGTH 64
+extern char global_session_id[GLOBAL_SESSION_ID_LENGTH];
Index: src/import.c
===================================================================
RCS file: /cvs/ccvs/src/import.c,v
retrieving revision 1.165
diff -u -r1.165 import.c
--- src/import.c        21 Feb 2005 18:51:58 -0000      1.165
+++ src/import.c        24 Feb 2005 15:35:06 -0000
@@ -1275,6 +1275,9 @@
        if (fprintf (fprcs, "next    %s;\012", add_vhead) < 0)
            goto write_error;

+       if (fprintf (fprcs, "commitid        %s;\012", global_session_id) < 0)
+           goto write_error;
+
 #ifdef PRESERVE_PERMISSIONS_SUPPORT
        /* Store initial permissions if necessary. */
        if (config->preserve_perms)
@@ -1306,6 +1309,9 @@
        if (fprintf (fprcs, "next     ;\012") < 0)
            goto write_error;

+       if (fprintf (fprcs, "commitid        %s;\012", global_session_id) < 0)
+           goto write_error;
+
 #ifdef PRESERVE_PERMISSIONS_SUPPORT
        /* Store initial permissions if necessary. */
        if (config->preserve_perms)
@@ -1322,7 +1328,8 @@
                fprintf (fprcs, "date     %s;  author %s;  state Exp;\012",
                         altdate1, author) < 0 ||
                fprintf (fprcs, "branches ;\012") < 0 ||
-               fprintf (fprcs, "next     ;\012") < 0)
+               fprintf (fprcs, "next     ;\012") < 0 ||
+               fprintf (fprcs, "commitid        %s;\012", global_session_id) < 
0)
                goto write_error;
 
 #ifdef PRESERVE_PERMISSIONS_SUPPORT
Index: src/log.c
===================================================================
RCS file: /cvs/ccvs/src/log.c,v
retrieving revision 1.99
diff -u -r1.99 log.c
--- src/log.c   1 Feb 2005 21:43:48 -0000       1.99
+++ src/log.c   24 Feb 2005 15:35:06 -0000
@@ -1635,6 +1635,16 @@
        cvs_output_tagged ("text", " -");
        cvs_output_tagged ("text", pdel->data);
     }
+
+    cvs_output_tagged ("text", ";");
+    p = findnode(ver->other_delta,"commitid");
+    if(p && p->data)
+    {
+        cvs_output_tagged ("text", "  commitid: ");
+       cvs_output_tagged ("text", p->data);
+       cvs_output_tagged ("text", ";");
+    }
+
     cvs_output_tagged ("newline", NULL);
 
     if (ver->branches != NULL)
Index: src/main.c
===================================================================
RCS file: /cvs/ccvs/src/main.c,v
retrieving revision 1.239
diff -u -r1.239 main.c
--- src/main.c  23 Feb 2005 19:59:49 -0000      1.239
+++ src/main.c  24 Feb 2005 15:35:10 -0000
@@ -25,6 +25,8 @@
 const char *program_path;
 const char *cvs_cmd_name;
 
+char global_session_id[GLOBAL_SESSION_ID_LENGTH]; /* Random session ID */
+
 char *hostname;
 #ifdef SERVER_SUPPORT
 char *server_hostname;
@@ -678,6 +680,12 @@
 cause intermittent sandbox corruption.");
     }

+    /* Calculate the cvs global session ID */
+
+    
sprintf(global_session_id,"%x%08lx%04x",(int)getpid(),(long)time(NULL),rand()&0xFFFF);
+
+    TRACE(TRACE_FUNCTION,"Session ID is %s",global_session_id);
+
     /* Look up the command name. */
 
     cvs_cmd_name = argv[0];
Index: src/rcs.c
===================================================================
RCS file: /cvs/ccvs/src/rcs.c,v
retrieving revision 1.329
diff -u -r1.329 rcs.c
--- src/rcs.c   23 Feb 2005 01:24:28 -0000      1.329
+++ src/rcs.c   24 Feb 2005 15:35:11 -0000
@@ -4954,6 +4954,7 @@
 #ifdef PRESERVE_PERMISSIONS_SUPPORT
     struct stat sb;
 #endif
+    Node *np;

     commitpt = NULL;

@@ -5023,6 +5024,16 @@
     else
        delta->state = xstrdup ("Exp");

+    delta->other_delta = getlist();
+
+    /* save the commit ID */
+    np = getnode();
+    np->type = RCSFIELD;
+    np->key = xstrdup ("commitid");
+    np->data = xstrdup(global_session_id);
+    addnode (delta->other_delta, np);
+
+
 #ifdef PRESERVE_PERMISSIONS_SUPPORT
     /* If permissions should be preserved on this project, then
        save the permission info. */
Index: src/status.c
===================================================================
RCS file: /cvs/ccvs/src/status.c,v
retrieving revision 1.63
diff -u -r1.63 status.c
--- src/status.c        1 Feb 2005 22:20:07 -0000       1.63
+++ src/status.c        24 Feb 2005 15:35:11 -0000
@@ -125,6 +125,7 @@
     Ctype status;
     char *sstat;
     Vers_TS *vers;
+    Node *node;

     status = Classify_File (finfo, (char *) NULL, (char *) NULL, (char *) 
NULL,
                            1, 0, &vers, 0);
@@ -248,6 +249,20 @@
        cvs_output ("\t", 0);
        cvs_output (vers->srcfile->print_path, 0);
        cvs_output ("\n", 0);
+
+       node = findnode(vers->srcfile->versions,vers->vn_rcs);
+       if (node)
+       {
+           RCSVers *v;
+           v=(RCSVers*)node->data;
+           node = findnode(v->other_delta,"commitid");
+           cvs_output("   Commit Identifier:\t", 0);
+           if(node && node->data)
+               cvs_output(node->data, 0);
+           else
+               cvs_output("(none)",0);
+           cvs_output("\n",0);
+       }
     }

     if (vers->entdata)

Enjoy
Frank Hemer





reply via email to

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