recurse.c (102843) | recurse.c (107487) |
---|---|
1/* 2 * Copyright (c) 1992, Brian Berliner and Jeff Polk 3 * 4 * You may distribute under the terms of the GNU General Public License as 5 * specified in the README file that comes with the CVS source distribution. 6 * 7 * General recursion handler 8 * | 1/* 2 * Copyright (c) 1992, Brian Berliner and Jeff Polk 3 * 4 * You may distribute under the terms of the GNU General Public License as 5 * specified in the README file that comes with the CVS source distribution. 6 * 7 * General recursion handler 8 * |
9 * $FreeBSD: head/contrib/cvs/src/recurse.c 102843 2002-09-02 05:57:14Z peter $ | 9 * $FreeBSD: head/contrib/cvs/src/recurse.c 107487 2002-12-02 03:17:49Z peter $ |
10 */ 11 12#include "cvs.h" 13#include "savecwd.h" 14#include "fileattr.h" 15#include "edit.h" 16 17static int do_dir_proc PROTO((Node * p, void *closure)); --- 11 unchanged lines hidden (view full) --- 29 FILEPROC fileproc; 30 FILESDONEPROC filesdoneproc; 31 DIRENTPROC direntproc; 32 DIRLEAVEPROC dirleaveproc; 33 void *callerdat; 34 Dtype flags; 35 int which; 36 int aflag; | 10 */ 11 12#include "cvs.h" 13#include "savecwd.h" 14#include "fileattr.h" 15#include "edit.h" 16 17static int do_dir_proc PROTO((Node * p, void *closure)); --- 11 unchanged lines hidden (view full) --- 29 FILEPROC fileproc; 30 FILESDONEPROC filesdoneproc; 31 DIRENTPROC direntproc; 32 DIRLEAVEPROC dirleaveproc; 33 void *callerdat; 34 Dtype flags; 35 int which; 36 int aflag; |
37 int readlock; | 37 int locktype; |
38 int dosrcs; 39}; 40 41static int do_recursion PROTO ((struct recursion_frame *frame)); 42 43/* I am half tempted to shove a struct file_info * into the struct 44 recursion_frame (but then we would need to modify or create a 45 recursion_frame for each file), or shove a struct recursion_frame * --- 16 unchanged lines hidden (view full) --- 62 63/* Start a recursive command. 64 65 Command line arguments (ARGC, ARGV) dictate the directories and 66 files on which we operate. In the special case of no arguments, we 67 default to ".". */ 68int 69start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat, | 38 int dosrcs; 39}; 40 41static int do_recursion PROTO ((struct recursion_frame *frame)); 42 43/* I am half tempted to shove a struct file_info * into the struct 44 recursion_frame (but then we would need to modify or create a 45 recursion_frame for each file), or shove a struct recursion_frame * --- 16 unchanged lines hidden (view full) --- 62 63/* Start a recursive command. 64 65 Command line arguments (ARGC, ARGV) dictate the directories and 66 files on which we operate. In the special case of no arguments, we 67 default to ".". */ 68int 69start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat, |
70 argc, argv, local, which, aflag, readlock, | 70 argc, argv, local, which, aflag, locktype, |
71 update_preload, dosrcs) 72 FILEPROC fileproc; 73 FILESDONEPROC filesdoneproc; 74 DIRENTPROC direntproc; 75 DIRLEAVEPROC dirleaveproc; 76 void *callerdat; 77 78 int argc; --- 19 unchanged lines hidden (view full) --- 98 but we recurse into a directory if it is exists in the working 99 directory *or* it exists in the repository. If a directory 100 does not exist in the working directory, the direntproc must 101 either tell us to skip it (R_SKIP_ALL), or must create it (I 102 think those are the only two cases). */ 103 int which; 104 105 int aflag; | 71 update_preload, dosrcs) 72 FILEPROC fileproc; 73 FILESDONEPROC filesdoneproc; 74 DIRENTPROC direntproc; 75 DIRLEAVEPROC dirleaveproc; 76 void *callerdat; 77 78 int argc; --- 19 unchanged lines hidden (view full) --- 98 but we recurse into a directory if it is exists in the working 99 directory *or* it exists in the repository. If a directory 100 does not exist in the working directory, the direntproc must 101 either tell us to skip it (R_SKIP_ALL), or must create it (I 102 think those are the only two cases). */ 103 int which; 104 105 int aflag; |
106 int readlock; | 106 int locktype; |
107 char *update_preload; 108 int dosrcs; 109{ 110 int i, err = 0; 111#ifdef CLIENT_SUPPORT 112 List *args_to_send_when_finished = NULL; 113#endif 114 List *files_by_dir = NULL; 115 struct recursion_frame frame; 116 117 frame.fileproc = fileproc; 118 frame.filesdoneproc = filesdoneproc; 119 frame.direntproc = direntproc; 120 frame.dirleaveproc = dirleaveproc; 121 frame.callerdat = callerdat; 122 frame.flags = local ? R_SKIP_DIRS : R_PROCESS; 123 frame.which = which; 124 frame.aflag = aflag; | 107 char *update_preload; 108 int dosrcs; 109{ 110 int i, err = 0; 111#ifdef CLIENT_SUPPORT 112 List *args_to_send_when_finished = NULL; 113#endif 114 List *files_by_dir = NULL; 115 struct recursion_frame frame; 116 117 frame.fileproc = fileproc; 118 frame.filesdoneproc = filesdoneproc; 119 frame.direntproc = direntproc; 120 frame.dirleaveproc = dirleaveproc; 121 frame.callerdat = callerdat; 122 frame.flags = local ? R_SKIP_DIRS : R_PROCESS; 123 frame.which = which; 124 frame.aflag = aflag; |
125 frame.readlock = readlock; | 125 frame.locktype = locktype; |
126 frame.dosrcs = dosrcs; 127 128 expand_wild (argc, argv, &argc, &argv); 129 130 if (update_preload == NULL) 131 update_dir = xstrdup (""); 132 else 133 update_dir = xstrdup (update_preload); --- 366 unchanged lines hidden (view full) --- 500static int 501do_recursion (frame) 502 struct recursion_frame *frame; 503{ 504 int err = 0; 505 int dodoneproc = 1; 506 char *srepository; 507 List *entries = NULL; | 126 frame.dosrcs = dosrcs; 127 128 expand_wild (argc, argv, &argc, &argv); 129 130 if (update_preload == NULL) 131 update_dir = xstrdup (""); 132 else 133 update_dir = xstrdup (update_preload); --- 366 unchanged lines hidden (view full) --- 500static int 501do_recursion (frame) 502 struct recursion_frame *frame; 503{ 504 int err = 0; 505 int dodoneproc = 1; 506 char *srepository; 507 List *entries = NULL; |
508 int should_readlock; | 508 int locktype; |
509 int process_this_directory = 1; 510 511 /* do nothing if told */ 512 if (frame->flags == R_SKIP_ALL) 513 return (0); 514 | 509 int process_this_directory = 1; 510 511 /* do nothing if told */ 512 if (frame->flags == R_SKIP_ALL) 513 return (0); 514 |
515 should_readlock = noexec ? 0 : frame->readlock; | 515 locktype = noexec ? LOCK_NONE : frame->locktype; |
516 517 /* The fact that locks are not active here is what makes us fail to have 518 the 519 520 If someone commits some changes in one cvs command, 521 then an update by someone else will either get all the 522 changes, or none of them. 523 --- 21 unchanged lines hidden (view full) --- 545 implemented in Jan 96, are probably acceptable; improvements 546 would be possible such as branch attributes which are in 547 separate files for each branch). */ 548 549#if defined(SERVER_SUPPORT) && defined(SERVER_FLOWCONTROL) 550 /* 551 * Now would be a good time to check to see if we need to stop 552 * generating data, to give the buffers a chance to drain to the | 516 517 /* The fact that locks are not active here is what makes us fail to have 518 the 519 520 If someone commits some changes in one cvs command, 521 then an update by someone else will either get all the 522 changes, or none of them. 523 --- 21 unchanged lines hidden (view full) --- 545 implemented in Jan 96, are probably acceptable; improvements 546 would be possible such as branch attributes which are in 547 separate files for each branch). */ 548 549#if defined(SERVER_SUPPORT) && defined(SERVER_FLOWCONTROL) 550 /* 551 * Now would be a good time to check to see if we need to stop 552 * generating data, to give the buffers a chance to drain to the |
553 * remote client. We should not have locks active at this point. 554 */ 555 if (server_active 556 /* If there are writelocks around, we cannot pause here. */ 557 && (should_readlock || noexec)) | 553 * remote client. We should not have locks active at this point, 554 * but if there are writelocks around, we cannot pause here. */ 555 if (server_active && locktype != LOCK_NONE) |
558 server_pause_check(); 559#endif 560 561 /* Check the value in CVSADM_ROOT and see if it's in the list. If 562 not, add it to our lists of CVS/Root directories and do not 563 process the files in this directory. Otherwise, continue as 564 usual. THIS_ROOT might be NULL if we're doing an initial 565 checkout -- check before using it. The default should be that --- 136 unchanged lines hidden (view full) --- 702 703 /* process the files (if any) */ 704 if (process_this_directory && filelist != NULL && frame->fileproc) 705 { 706 struct file_info finfo_struct; 707 struct frame_and_file frfile; 708 709 /* read lock it if necessary */ | 556 server_pause_check(); 557#endif 558 559 /* Check the value in CVSADM_ROOT and see if it's in the list. If 560 not, add it to our lists of CVS/Root directories and do not 561 process the files in this directory. Otherwise, continue as 562 usual. THIS_ROOT might be NULL if we're doing an initial 563 checkout -- check before using it. The default should be that --- 136 unchanged lines hidden (view full) --- 700 701 /* process the files (if any) */ 702 if (process_this_directory && filelist != NULL && frame->fileproc) 703 { 704 struct file_info finfo_struct; 705 struct frame_and_file frfile; 706 707 /* read lock it if necessary */ |
710 if (should_readlock && repository && Reader_Lock (repository) != 0) 711 error (1, 0, "read lock failed - giving up"); | 708 if (repository) 709 { 710 if (locktype == LOCK_READ) 711 { 712 if (Reader_Lock (repository) != 0) 713 error (1, 0, "read lock failed - giving up"); 714 } 715 else if (locktype == LOCK_WRITE) 716 lock_dir_for_write (repository); 717 } |
712 713#ifdef CLIENT_SUPPORT 714 /* For the server, we handle notifications in a completely different 715 place (server_notify). For local, we can't do them here--we don't 716 have writelocks in place, and there is no way to get writelocks 717 here. */ 718 if (current_parsed_root->isremote) 719 notify_check (repository, update_dir); --- 6 unchanged lines hidden (view full) --- 726 727 frfile.finfo = &finfo_struct; 728 frfile.frame = frame; 729 730 /* process the files */ 731 err += walklist (filelist, do_file_proc, &frfile); 732 733 /* unlock it */ | 718 719#ifdef CLIENT_SUPPORT 720 /* For the server, we handle notifications in a completely different 721 place (server_notify). For local, we can't do them here--we don't 722 have writelocks in place, and there is no way to get writelocks 723 here. */ 724 if (current_parsed_root->isremote) 725 notify_check (repository, update_dir); --- 6 unchanged lines hidden (view full) --- 732 733 frfile.finfo = &finfo_struct; 734 frfile.frame = frame; 735 736 /* process the files */ 737 err += walklist (filelist, do_file_proc, &frfile); 738 739 /* unlock it */ |
734 if (should_readlock) | 740 if (locktype != LOCK_NONE) |
735 Lock_Cleanup (); 736 737 /* clean up */ 738 dellist (&filelist); 739 } 740 741 /* call-back files done proc (if any) */ 742 if (process_this_directory && dodoneproc && frame->filesdoneproc != NULL) --- 478 unchanged lines hidden --- | 741 Lock_Cleanup (); 742 743 /* clean up */ 744 dellist (&filelist); 745 } 746 747 /* call-back files done proc (if any) */ 748 if (process_this_directory && dodoneproc && frame->filesdoneproc != NULL) --- 478 unchanged lines hidden --- |