Skip to contentSkip to conversation

cvsserver: make the output of 'update' more compatible with cvs.

PATCH Superseded Sergei Organov 5 participants 8 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cvsserver: make the output of 'update' more compatible with cvs.

Native cvs update outputs the string "cvs update: Updating <DIR>" for every directory it processes (to stderr). This is used, e.g., by emacs pcl-cvs to split files by directory. This commit implements this feature in cvsserver.

---
 git-cvsserver.perl |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
git-cvsserver.perl +12 -0
index 6dc45f5..5994951 100755
@@ -981,10 +981,22 @@ sub req_update
 
     #$log->debug("update state : " . Dumper($state));
 
+    my $last_dirname = "///";
+    
     # foreach file specified on the command line ...
     foreach my $filename ( @{$state->{args}} )
     {
         $filename = filecleanup($filename);
+        my $cur_dirname = dirname($filename);
+        if ( $cur_dirname ne $last_dirname )
+        {
+            $last_dirname = $cur_dirname;
+            if ( $cur_dirname eq "" )
+            {
+                $cur_dirname = ".";
+            }
+            print "E cvs update: Updating $cur_dirname\n";
+        }
 
         $log->debug("Processing file $filename");
 
Signature · 1 line
1.6.6.rc0.67.g68b144.dirty
#1 lore raw
Quoted 9 lines · Sergei Organov
git-cvsserver.perl +4 -0
+    my $last_dirname = "///";
+    
     # foreach file specified on the command line ...
     foreach my $filename ( @{$state->{args}} )
     {
         $filename = filecleanup($filename);
+        my $cur_dirname = dirname($filename);
+        if ( $cur_dirname ne $last_dirname )

git-cvsserver.perl sub req_update · line 1001

Quoted 10 lines
git-cvsserver.perl +8 -0
+        {
+            $last_dirname = $cur_dirname;
+            if ( $cur_dirname eq "" )
+            {
+                $cur_dirname = ".";
+            }
+            print "E cvs update: Updating $cur_dirname\n";
+        }
 
         $log->debug("Processing file $filename");

This should probably be conditional on the absense of the global "cvs -q update" and "cvs -Q update" options, in case other CVS clients depend on quiet operation when they specify those options.

--
Matthew Ogilvie [[email protected]]

#2 lore raw
Quoted 19 lines · [email protected] writes:
Quoted 18 lines · Sergei Organov
git-cvsserver.perl +12 -0
+    my $last_dirname = "///";
+    
     # foreach file specified on the command line ...
     foreach my $filename ( @{$state->{args}} )
     {
         $filename = filecleanup($filename);
+        my $cur_dirname = dirname($filename);
+        if ( $cur_dirname ne $last_dirname )
+        {
+            $last_dirname = $cur_dirname;
+            if ( $cur_dirname eq "" )
+            {
+                $cur_dirname = ".";
+            }
+            print "E cvs update: Updating $cur_dirname\n";
+        }
Quoted 6 lines
Quoted 1 line
         $log->debug("Processing file $filename");

This should probably be conditional on the absense of the global "cvs -q update" and "cvs -Q update" options, in case other CVS clients depend on quiet operation when they specify those options.

Good catch, thanks! I'll redo the patch.

-- Sergei.

#3 lore raw

PATCH v2 1/1 cvsserver: make the output of 'update' more compatible with cvs.

In reply to Sergei Organov

Native cvs update outputs the string "cvs update: Updating <DIR>" for every directory it processes (to stderr) unless -q or -Q is given on comman-line. This is used, e.g., by emacs pcl-cvs to split files by directory. This commit implements this feature in cvsserver.

---
 git-cvsserver.perl |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
git-cvsserver.perl +16 -0
index 6dc45f5..f4c75bb 100755
@@ -981,6 +981,8 @@ sub req_update
 
     #$log->debug("update state : " . Dumper($state));
 
+    my $last_dirname = "///";
+    
     # foreach file specified on the command line ...
     foreach my $filename ( @{$state->{args}} )
     {
@@ -988,6 +990,20 @@ sub req_update
 
         $log->debug("Processing file $filename");
 
+        unless ( $state->{globaloptions}{-Q} || $state->{globaloptions}{-q} )
+        {
+            my $cur_dirname = dirname($filename);
+            if ( $cur_dirname ne $last_dirname )
+            {
+                $last_dirname = $cur_dirname;
+                if ( $cur_dirname eq "" )
+                {
+                    $cur_dirname = ".";
+                }
+                print "E cvs update: Updating $cur_dirname\n";
+            }
+        }
+
         # if we have a -C we should pretend we never saw modified stuff
         if ( exists ( $state->{opt}{C} ) )
         {
Signature · 1 line
1.6.6.rc0.67.gc0456.dirty
#5 lore raw
Quoted 1 line · Nanako Shiraishi

Junio, could you tell us what happened to this thread?

Well, since I don't use cvsserver myself, but this v2 was done with improvements based on some review suggestions, I was waiting for a response or two from people who know better and care more about cvs server emulation than me, which unfortunately didn't happen.

Thanks for reminding; I can queue it to 'pu' or perhaps 'next' and see if anybody screams by getting hit by an unintended side effects.

#6 lore raw
Quoted 4 lines · Junio C Hamano

Well, since I don't use cvsserver myself, but this v2 was done with improvements based on some review suggestions, I was waiting for a response or two from people who know better and care more about cvs server emulation than me, which unfortunately didn't happen.

Looks good to me -- good to get it into pu. While I continue to use git extensively, I don't use cvsserver anymore, nor work with people that do. Might have reason to revisit cvsserver in the near future though, to help Moodle transition to git.

That transition will bring a few top-posters and Eclipse lovers to the list. Looking past such details, they are fine people who may need a little bit of git-newbie help ;-)

happy new year,

m

Signature · 5 lines
 [email protected]
 [email protected] -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
#7 lore raw
Quoted 11 lines · Martin Langhoff
Quoted 4 lines · Junio C Hamano

Well, since I don't use cvsserver myself, but this v2 was done with improvements based on some review suggestions, I was waiting for a response or two from people who know better and care more about cvs server emulation than me, which unfortunately didn't happen.

Looks good to me -- good to get it into pu. While I continue to use git extensively, I don't use cvsserver anymore, nor work with people that do. Might have reason to revisit cvsserver in the near future though, to help Moodle transition to git.

Quoted 5 lines

That transition will bring a few top-posters and Eclipse lovers to the list. Looking past such details, they are fine people who may need a little bit of git-newbie help ;-)

happy new year,

Happy new year to you, Nana and Sergei, but not yet in my timezone ;-)

Thanks; I'll forge/add your "Acked-by:" when I queue it.