3846 |
that CVS can't write such lines unless there is a bug. */ |
that CVS can't write such lines unless there is a bug. */ |
3847 |
|
|
3848 |
buf_free (protocol); |
buf_free (protocol); |
3849 |
|
protocol = NULL; |
3850 |
|
|
3851 |
/* Close the pipes explicitly in order to send an EOF to the parent, |
/* Close the pipes explicitly in order to send an EOF to the parent, |
3852 |
* then wait for the parent to close the flow control pipe. This |
* then wait for the parent to close the flow control pipe. This |
5262 |
return; |
return; |
5263 |
} |
} |
5264 |
|
|
5265 |
if (use_base && supported_response ("Base-entry")) |
if (use_base && strcmp (cvs_cmd_name, "export") |
5266 |
|
&& supported_response ("Base-entry")) |
5267 |
{ |
{ |
5268 |
/* The client was already asked to create the base file and copy |
/* The client was already asked to create the base file and copy |
5269 |
* it into a temp file. This will complete the process and print |
* it into a temp file. This will complete the process and print |
6399 |
* than getting lost. |
* than getting lost. |
6400 |
*/ |
*/ |
6401 |
struct buffer *buf_to_net_save = buf_to_net; |
struct buffer *buf_to_net_save = buf_to_net; |
6402 |
|
error_use_protocol = 0; |
6403 |
buf_to_net = NULL; |
buf_to_net = NULL; |
6404 |
|
|
6405 |
(void) buf_flush (buf_to_net_save, 1); |
(void) buf_flush (buf_to_net_save, 1); |
6406 |
(void) buf_shutdown (buf_to_net_save); |
(void) buf_shutdown (buf_to_net_save); |
6407 |
buf_free (buf_to_net_save); |
buf_free (buf_to_net_save); |
|
error_use_protocol = 0; |
|
6408 |
} |
} |
6409 |
/* SIG_endCrSect(); */ |
/* SIG_endCrSect(); */ |
6410 |
} |
} |
8143 |
* diff against PREV when possible. If the client doesn't understand this |
* diff against PREV when possible. If the client doesn't understand this |
8144 |
* response, just ignore it and later code will also avoid the Base-* |
* response, just ignore it and later code will also avoid the Base-* |
8145 |
* responses. |
* responses. |
8146 |
|
* |
8147 |
|
* NOTES |
8148 |
|
* Processes PREV == NULL, PREV == REV, and PREV == "0", for convenience. |
8149 |
*/ |
*/ |
8150 |
void |
void |
8151 |
server_base_checkout (RCSNode *rcs, struct file_info *finfo, const char *prev, |
server_base_checkout (RCSNode *rcs, struct file_info *finfo, const char *prev, |
8158 |
|
|
8159 |
assert (rev); |
assert (rev); |
8160 |
|
|
8161 |
|
TRACE (TRACE_FUNCTION, "server_base_checkout (%s, %s, %s, %s, %s)", |
8162 |
|
finfo->fullname, prev, rev, tag, options); |
8163 |
|
|
8164 |
if (!supported_response ("Base-checkout")) return; |
if (!supported_response ("Base-checkout")) return; |
8165 |
|
|
8166 |
if (prev && !strcmp (prev, rev)) |
if (prev && !strcmp (prev, rev)) |
8174 |
*(finfo->update_dir) ? finfo->update_dir : ".", |
*(finfo->update_dir) ? finfo->update_dir : ".", |
8175 |
basefile); |
basefile); |
8176 |
|
|
8177 |
if (prev) |
if (prev && strcmp (prev, "0")) |
8178 |
{ |
{ |
8179 |
/* Compute and send diff. */ |
/* Compute and send diff. */ |
8180 |
int dargc = 0; |
int dargc = 0; |
8192 |
|
|
8193 |
run_add_arg_p (&dargc, &darg_allocated, &dargv, "-n"); |
run_add_arg_p (&dargc, &darg_allocated, &dargv, "-n"); |
8194 |
tmpfile = cvs_temp_name (); |
tmpfile = cvs_temp_name (); |
8195 |
status = diff_exec (basefile, pbasefile, NULL, NULL, dargc, dargv, |
status = diff_exec (pbasefile, basefile, NULL, NULL, dargc, dargv, |
8196 |
tmpfile); |
tmpfile); |
8197 |
run_arg_free_p (dargc, dargv); |
run_arg_free_p (dargc, dargv); |
8198 |
free (dargv); |
free (dargv); |
8208 |
} |
} |
8209 |
else senddiff = false; |
else senddiff = false; |
8210 |
|
|
8211 |
|
if (senddiff) |
8212 |
|
{ |
8213 |
|
struct stat bfi, dfi; |
8214 |
|
|
8215 |
|
/* Check to make sure the patch is really shorter */ |
8216 |
|
if (stat (basefile, &bfi) < 0) |
8217 |
|
error (1, errno, "could not stat `%s'", basefile); |
8218 |
|
if (stat (tmpfile, &dfi) < 0) |
8219 |
|
error (1, errno, "could not stat `%s'", tmpfile); |
8220 |
|
if (bfi.st_size <= dfi.st_size) |
8221 |
|
senddiff = false; |
8222 |
|
} |
8223 |
|
|
8224 |
buf_output0 (protocol, "Base-checkout "); |
buf_output0 (protocol, "Base-checkout "); |
8225 |
output_dir (finfo->update_dir, finfo->repository); |
output_dir (finfo->update_dir, finfo->repository); |
8226 |
buf_output0 (protocol, finfo->file); |
buf_output0 (protocol, finfo->file); |
8237 |
buf_output (protocol, "\n", 1); |
buf_output (protocol, "\n", 1); |
8238 |
|
|
8239 |
if (senddiff) |
if (senddiff) |
|
{ |
|
|
struct stat bfi, dfi; |
|
|
|
|
|
/* Check to make sure the patch is really shorter */ |
|
|
if (stat (basefile, &bfi) < 0) |
|
|
error (1, errno, "could not stat `%s'", basefile); |
|
|
if (stat (tmpfile, &dfi) < 0) |
|
|
error (1, errno, "could not stat `%s'", tmpfile); |
|
|
if (bfi.st_size <= dfi.st_size) |
|
|
senddiff = false; |
|
|
} |
|
|
|
|
|
if (senddiff) |
|
8240 |
server_send_file (tmpfile, fullbase, -1); |
server_send_file (tmpfile, fullbase, -1); |
8241 |
else |
else |
8242 |
/* The client does not have a previous base revision, so send the whole |
/* The client does not have a previous base revision, so send the whole |
8285 |
if (trace >= level) |
if (trace >= level) |
8286 |
{ |
{ |
8287 |
va_list va; |
va_list va; |
8288 |
|
char *buf; |
8289 |
|
int size; |
8290 |
|
|
8291 |
va_start (va, fmt); |
va_start (va, fmt); |
8292 |
#ifdef SERVER_SUPPORT |
#ifdef SERVER_SUPPORT |
8293 |
fprintf (stderr,"%c -> ",server_active?(isProxyServer()?'P':'S'):' '); |
cvs_outerr (server_active ? (isProxyServer() ? "P" : "S") : " ", 1); |
8294 |
#else /* ! SERVER_SUPPORT */ |
#else |
8295 |
fprintf (stderr," -> "); |
cvs_outerr (" ", 1); |
8296 |
#endif |
#endif |
8297 |
vfprintf (stderr, fmt, va); |
cvs_outerr (" -> ", 4); |
8298 |
fprintf (stderr,"\n"); |
if ((size = vasprintf (&buf, fmt, va)) < 0) |
8299 |
|
abort (); |
8300 |
|
cvs_outerr (buf, size); |
8301 |
|
cvs_outerr ("\n", 1); |
8302 |
va_end (va); |
va_end (va); |
8303 |
} |
} |
8304 |
} |
} |