bug-cvs
[Top][All Lists]
Advanced

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

Fwd: patch for cvs and tkcvs to allow better handling of unedit/reset fr


From: niraj gupta
Subject: Fwd: patch for cvs and tkcvs to allow better handling of unedit/reset from tkcvs
Date: Tue, 13 Nov 2001 11:25:39 -0800

----------  Forwarded Message  ----------

Subject: patch for cvs and tkcvs to allow better handling of unedit/reset 
from tkcvs
Date: Tue, 13 Nov 2001 11:21:31 -0800
From: niraj gupta <nirajgupta@yahoo.com>
To: dev@ccvs.cvshome.org, tkcvs-discuss@ccvs.cvshome.org

patch for cvs: the following patch adds a 'quiet' option in the cvs unedit
command allow unedit to be done without asking questions.
please accept the patches and do the needful, i am not sure if i am posting
this to the right forum, if not please suggest alternatives, or forward this
to the relevant person
also if somebody can forward this to dorothyr it would be nice

cheers
niraj gupta

--- cvs-1.11.1p1/src/edit.c     Tue Apr 24 11:14:53 2001
+++ edit.c      Tue Nov 13 10:43:53 2001
@@ -461,6 +461,7 @@
     time_t now;
     char *ascnow;
     char *basefilename;
+    int quiet = (int)(callerdat);

     if (noexec)
        return 0;
@@ -477,7 +478,7 @@
        return 0;
     }

-    if (xcmp (finfo->file, basefilename) != 0)
+    if (xcmp (finfo->file, basefilename) != 0 && !quiet)
     {
        printf ("%s has been modified; revert changes? ", finfo->fullname);
        if (!yesno ())
@@ -568,7 +569,7 @@

 static const char *const unedit_usage[] =
 {
-    "Usage: %s %s [-lR] [files...]\n",
+    "Usage: %s %s [-lRq] [files...]\n",
     "-l: Local directory only, not recursive\n",
     "-R: Process directories recursively\n",
     "(Specify the --help global option for a list of other help options)\n",
@@ -580,7 +581,7 @@
     int argc;
     char **argv;
 {
-    int local = 0;
+    int local = 0, quiet = 0;
     int c;
     int err;

@@ -588,7 +589,7 @@
        usage (unedit_usage);

     optind = 0;
-    while ((c = getopt (argc, argv, "+lR")) != -1)
+    while ((c = getopt (argc, argv, "+lRq")) != -1)
     {
        switch (c)
        {
@@ -598,6 +599,9 @@
            case 'R':
                local = 0;
                break;
+           case 'q':
+               quiet = 1;
+               break;
            case '?':
            default:
                usage (unedit_usage);
@@ -610,7 +614,7 @@
     /* No need to readlock since we aren't doing anything to the
        repository.  */
     err = start_recursion (unedit_fileproc, (FILESDONEPROC) NULL,
-                          (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
+                          (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, (void *
)quiet,
                           argc, argv, local, W_LOCAL, 0, 0, (char *)NULL,
                           0);


patch for tkcvs: asks the user if he really wants to unedit the file if
changed and then uses the above patch in cvs

--- tkcvs-7.0.2/tkcvs/cvs.tcl   Sun Oct 14 23:24:33 2001
+++ cvs.tcl     Tue Nov 13 11:15:50 2001
@@ -217,15 +217,29 @@
     set commandline "cvs -d $cvscfg(cvsroot) -n -l update \"$file\""
     gen_log:log C "$commandline"
     catch {eval "exec $commandline"} view_this
-    # Its OK if its locally added
-    if {([llength $view_this] > 0) && ![string match "A*" $view_this] } {
-      gen_log:log D "$view_this"
-      cvsfail "File $file is not up-to-date"
-      gen_log:log T "LEAVE -- cvs unedit failed"
-      return
+    if {([llength $view_this] > 0) && [string mat---
tkcvs-7.0.2/tkcvs/cvs.tcl   Sun Oct 14 23:24:33 2001
+++ cvs.tcl     Tue Nov 13 11:15:50 2001
@@ -217,15 +217,29 @@
     set commandline "cvs -d $cvscfg(cvsroot) -n -l update \"$file\""
     gen_log:log C "$commandline"
     catch {eval "exec $commandline"} view_this
-    # Its OK if its locally added
-    if {([llength $view_this] > 0) && ![string match "A*" $view_this] } {
-      gen_log:log D "$view_this"
-      cvsfail "File $file is not up-to-date"
-      gen_log:log T "LEAVE -- cvs unedit failed"
-      return
+    if {([llength $view_this] > 0) && [string match "M*" $view_this] } {
+      set mess "You are about to unedit a file"
+      append mess " which has been locally modified"
+      append mess " all changes will be lost\n"
+      append mess "\n\t$file"
+      append mess"\n\nAre you sure?"
+      if {[cvsconfirm $mess] == 1} {
+        gen_log:log D "$view_this"
+       cvsfail "File $file is not up-to-date"
+       gen_log:log T "LEAVE -- cvs unedit failed"
+       return
+      }
+    } else {
+      # Its OK if its locally added
+      if {([llength $view_this] > 0) && ![string match "A*" $view_this] } {
+        gen_log:log D "$view_this"
+        cvsfail "File $file is not up-to-date"
+        gen_log:log T "LEAVE -- cvs unedit failed"
+        return
+      }
     }

-    set commandline "$cvs -d $cvscfg(cvsroot) unedit \"$file\""
+    set commandline "$cvs -d $cvscfg(cvsroot) unedit -q \"$file\""
     gen_log:log C "$commandline"
     set ret [catch {eval "exec $commandline"} view_this]
     if {$ret != 0} {ch "M*" $view_this] } {
+      set mess "You are about to unedit a file"
+      append mess " which has been locally modified"
+      append mess " all changes will be lost\n"
+      append mess "\n\t$file"
+      append mess"\n\nAre you sure?"
+      if {[cvsconfirm $mess] == 1} {
+        gen_log:log D "$view_this"
+       cvsfail "File $file is not up-to-date"
+       gen_log:log T "LEAVE -- cvs unedit failed"
+       return
+      }
+    } else {
+      # Its OK if its locally added
+      if {([llength $view_this] > 0) && ![string match "A*" $view_this] } {
+        gen_log:log D "$view_this"
+        cvsfail "File $file is not up-to-date"
+        gen_log:log T "LEAVE -- cvs unedit failed"
+        return
+      }
     }

-    set commandline "$cvs -d $cvscfg(cvsroot) unedit \"$file\""
+    set commandline "$cvs -d $cvscfg(cvsroot) unedit -q \"$file\""
     gen_log:log C "$commandline"
     set ret [catch {eval "exec $commandline"} view_this]
     if {$ret != 0} {

-------------------------------------------------------



reply via email to

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