Annotation of src/usr.bin/cvs/checkout.c, Revision 1.145
1.145 ! tobias 1: /* $OpenBSD: checkout.c,v 1.144 2008/05/22 15:45:01 tobias Exp $ */
1.1 jfb 2: /*
1.53 joris 3: * Copyright (c) 2006 Joris Vink <joris@openbsd.org>
1.1 jfb 4: *
1.53 joris 5: * Permission to use, copy, modify, and distribute this software for any
6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
1.1 jfb 8: *
1.53 joris 9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1 jfb 16: */
17:
1.92 otto 18: #include <sys/param.h>
19: #include <sys/dirent.h>
20: #include <sys/stat.h>
1.117 tobias 21: #include <sys/time.h>
1.92 otto 22:
23: #include <errno.h>
24: #include <fcntl.h>
1.100 tobias 25: #include <libgen.h>
1.130 xsa 26: #include <stdlib.h>
1.92 otto 27: #include <string.h>
28: #include <unistd.h>
1.1 jfb 29:
30: #include "cvs.h"
1.53 joris 31: #include "diff.h"
1.66 joris 32: #include "remote.h"
1.72 joris 33:
1.61 xsa 34: static void checkout_check_repository(int, char **);
1.113 tobias 35: static int checkout_classify(const char *, const char *);
1.53 joris 36: static void checkout_repository(const char *, const char *);
1.14 joris 37:
1.101 joris 38: extern int print_stdout;
1.54 joris 39: extern int prune_dirs;
1.57 joris 40: extern int build_dirs;
1.54 joris 41:
1.78 xsa 42: static int flags = CR_REPO | CR_RECURSE_DIRS;
1.132 tobias 43: static int Aflag = 0;
1.120 joris 44: static char *dflag = NULL;
1.125 tobias 45: static char *koptstr = NULL;
1.133 joris 46: static char *dateflag = NULL;
1.78 xsa 47:
1.127 joris 48: static int nflag = 0;
49:
1.133 joris 50: char *checkout_target_dir = NULL;
1.136 joris 51: time_t cvs_specified_date = -1;
1.131 tobias 52:
1.22 jfb 53: struct cvs_cmd cvs_cmd_checkout = {
1.112 tobias 54: CVS_OP_CHECKOUT, CVS_USE_WDIR, "checkout",
1.22 jfb 55: { "co", "get" },
1.53 joris 56: "Checkout a working copy of a repository",
1.33 xsa 57: "[-AcflNnPpRs] [-D date | -r tag] [-d dir] [-j rev] [-k mode] "
1.22 jfb 58: "[-t id] module ...",
1.77 xsa 59: "AcD:d:fj:k:lNnPpRr:st:",
1.59 joris 60: NULL,
61: cvs_checkout
62: };
63:
64: struct cvs_cmd cvs_cmd_export = {
1.112 tobias 65: CVS_OP_EXPORT, CVS_USE_WDIR, "export",
1.59 joris 66: { "exp", "ex" },
67: "Export sources from CVS, similar to checkout",
1.61 xsa 68: "[-flNnR] [-d dir] [-k mode] -D date | -r rev module ...",
69: "D:d:k:flNnRr:",
1.22 jfb 70: NULL,
1.61 xsa 71: cvs_export
1.33 xsa 72: };
73:
1.53 joris 74: int
75: cvs_checkout(int argc, char **argv)
1.1 jfb 76: {
1.78 xsa 77: int ch;
1.13 jfb 78:
1.53 joris 79: while ((ch = getopt(argc, argv, cvs_cmd_checkout.cmd_opts)) != -1) {
1.1 jfb 80: switch (ch) {
1.76 xsa 81: case 'A':
1.132 tobias 82: Aflag = 1;
83: if (koptstr == NULL)
84: reset_option = 1;
85: if (cvs_specified_tag == NULL)
86: reset_tag = 1;
1.76 xsa 87: break;
1.129 joris 88: case 'c':
89: cvs_modules_list();
90: exit(0);
1.131 tobias 91: case 'D':
1.133 joris 92: dateflag = optarg;
93: cvs_specified_date = cvs_date_parse(dateflag);
1.131 tobias 94: break;
1.120 joris 95: case 'd':
96: if (dflag != NULL)
97: fatal("-d specified two or more times");
98: dflag = optarg;
1.133 joris 99: checkout_target_dir = dflag;
1.120 joris 100: break;
1.142 joris 101: case 'j':
102: if (cvs_join_rev1 == NULL)
103: cvs_join_rev1 = optarg;
104: else if (cvs_join_rev2 == NULL)
105: cvs_join_rev2 = optarg;
106: else
107: fatal("too many -j options");
108: break;
1.125 tobias 109: case 'k':
1.132 tobias 110: reset_option = 0;
1.125 tobias 111: koptstr = optarg;
112: kflag = rcs_kflag_get(koptstr);
113: if (RCS_KWEXP_INVAL(kflag)) {
114: cvs_log(LP_ERR,
1.144 tobias 115: "invalid RCS keyword expansion mode");
1.125 tobias 116: fatal("%s", cvs_cmd_add.cmd_synopsis);
117: }
118: break;
1.77 xsa 119: case 'l':
120: flags &= ~CR_RECURSE_DIRS;
121: break;
1.104 joris 122: case 'N':
123: break;
1.127 joris 124: case 'n':
125: nflag = 1;
126: break;
1.54 joris 127: case 'P':
128: prune_dirs = 1;
1.77 xsa 129: break;
1.101 joris 130: case 'p':
1.112 tobias 131: cmdp->cmd_flags &= ~CVS_USE_WDIR;
1.101 joris 132: print_stdout = 1;
133: cvs_noexec = 1;
1.127 joris 134: nflag = 1;
1.101 joris 135: break;
1.77 xsa 136: case 'R':
1.110 tobias 137: flags |= CR_RECURSE_DIRS;
1.54 joris 138: break;
1.93 niallo 139: case 'r':
1.132 tobias 140: reset_tag = 0;
1.97 joris 141: cvs_specified_tag = optarg;
1.93 niallo 142: break;
1.1 jfb 143: default:
1.53 joris 144: fatal("%s", cvs_cmd_checkout.cmd_synopsis);
1.1 jfb 145: }
146: }
147:
148: argc -= optind;
149: argv += optind;
150:
1.53 joris 151: if (argc == 0)
152: fatal("%s", cvs_cmd_checkout.cmd_synopsis);
1.22 jfb 153:
1.61 xsa 154: checkout_check_repository(argc, argv);
155:
156: return (0);
157: }
158:
159: int
160: cvs_export(int argc, char **argv)
161: {
1.78 xsa 162: int ch;
1.61 xsa 163:
164: prune_dirs = 1;
165:
166: while ((ch = getopt(argc, argv, cvs_cmd_export.cmd_opts)) != -1) {
167: switch (ch) {
1.125 tobias 168: case 'k':
169: koptstr = optarg;
170: kflag = rcs_kflag_get(koptstr);
171: if (RCS_KWEXP_INVAL(kflag)) {
172: cvs_log(LP_ERR,
1.144 tobias 173: "invalid RCS keyword expansion mode");
1.125 tobias 174: fatal("%s", cvs_cmd_add.cmd_synopsis);
175: }
176: break;
1.61 xsa 177: case 'l':
178: flags &= ~CR_RECURSE_DIRS;
179: break;
180: case 'R':
1.110 tobias 181: flags |= CR_RECURSE_DIRS;
1.98 xsa 182: break;
183: case 'r':
184: cvs_specified_tag = optarg;
1.61 xsa 185: break;
186: default:
187: fatal("%s", cvs_cmd_export.cmd_synopsis);
188: }
189: }
190:
191: argc -= optind;
192: argv += optind;
193:
1.108 tobias 194: if (cvs_specified_tag == NULL)
195: fatal("must specify a tag or date");
196:
1.61 xsa 197: if (argc == 0)
198: fatal("%s", cvs_cmd_export.cmd_synopsis);
199:
200: checkout_check_repository(argc, argv);
201:
202: return (0);
203: }
204:
205: static void
206: checkout_check_repository(int argc, char **argv)
207: {
1.67 xsa 208: int i;
1.123 joris 209: char *wdir, *d;
1.79 joris 210: struct cvs_recursion cr;
1.119 joris 211: struct module_checkout *mc;
1.123 joris 212: struct cvs_ignpat *ip;
213: struct cvs_filelist *fl, *nxt;
214: char repo[MAXPATHLEN], fpath[MAXPATHLEN], *f[1];
1.79 joris 215:
1.102 tobias 216: build_dirs = print_stdout ? 0 : 1;
217:
1.79 joris 218: if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
219: cvs_client_connect_to_server();
220:
1.97 joris 221: if (cvs_specified_tag != NULL)
222: cvs_client_send_request("Argument -r%s",
223: cvs_specified_tag);
1.132 tobias 224: if (Aflag)
1.79 joris 225: cvs_client_send_request("Argument -A");
1.133 joris 226:
227: if (dateflag != NULL)
228: cvs_client_send_request("Argument -D%s", dateflag);
1.122 joris 229:
1.125 tobias 230: if (kflag)
231: cvs_client_send_request("Argument -k%s", koptstr);
232:
1.122 joris 233: if (dflag != NULL)
234: cvs_client_send_request("Argument -d%s", dflag);
1.80 xsa 235:
236: if (!(flags & CR_RECURSE_DIRS))
237: cvs_client_send_request("Argument -l");
1.79 joris 238:
239: if (cvs_cmdop == CVS_OP_CHECKOUT && prune_dirs == 1)
240: cvs_client_send_request("Argument -P");
241:
1.101 joris 242: if (print_stdout == 1)
243: cvs_client_send_request("Argument -p");
244:
1.127 joris 245: if (nflag == 1)
246: cvs_client_send_request("Argument -n");
247:
1.79 joris 248: cr.enterdir = NULL;
249: cr.leavedir = NULL;
1.103 tobias 250: if (print_stdout)
251: cr.fileproc = NULL;
252: else
253: cr.fileproc = cvs_client_sendfile;
254:
255: flags &= ~CR_REPO;
1.79 joris 256: cr.flags = flags;
257:
1.108 tobias 258: if (cvs_cmdop != CVS_OP_EXPORT)
259: cvs_file_run(argc, argv, &cr);
1.79 joris 260:
261: cvs_client_send_files(argv, argc);
262: cvs_client_senddir(".");
263:
264: cvs_client_send_request("%s",
265: (cvs_cmdop == CVS_OP_CHECKOUT) ? "co" : "export");
266:
267: cvs_client_get_responses();
268:
269: return;
270: }
1.104 joris 271:
1.53 joris 272: for (i = 0; i < argc; i++) {
1.119 joris 273: mc = cvs_module_lookup(argv[i]);
274: current_module = mc;
1.116 joris 275:
1.123 joris 276: TAILQ_FOREACH(fl, &(mc->mc_ignores), flist)
277: cvs_file_ignore(fl->file_path, &checkout_ign_pats);
1.13 jfb 278:
1.123 joris 279: TAILQ_FOREACH(fl, &(mc->mc_modules), flist) {
1.139 tobias 280: module_repo_root = NULL;
281:
1.123 joris 282: (void)xsnprintf(repo, sizeof(repo), "%s/%s",
283: current_cvsroot->cr_dir, fl->file_path);
1.121 joris 284:
1.123 joris 285: if (!(mc->mc_flags & MODULE_ALIAS) || dflag != NULL)
1.139 tobias 286: module_repo_root = xstrdup(fl->file_path);
1.123 joris 287:
288: if (mc->mc_flags & MODULE_NORECURSE)
289: flags &= ~CR_RECURSE_DIRS;
290:
291: if (dflag != NULL)
292: wdir = dflag;
1.124 joris 293: else if (mc->mc_flags & MODULE_ALIAS)
294: wdir = fl->file_path;
1.123 joris 295: else
1.124 joris 296: wdir = mc->mc_name;
1.123 joris 297:
298: switch (checkout_classify(repo, fl->file_path)) {
299: case CVS_FILE:
300: cr.fileproc = cvs_update_local;
301: cr.flags = flags;
302:
303: if (!(mc->mc_flags & MODULE_ALIAS)) {
304: module_repo_root =
1.139 tobias 305: xstrdup(dirname(fl->file_path));
1.123 joris 306: d = wdir;
307: (void)xsnprintf(fpath, sizeof(fpath),
308: "%s/%s", d,
309: basename(fl->file_path));
310: } else {
311: d = dirname(wdir);
312: strlcpy(fpath, fl->file_path,
313: sizeof(fpath));
314: }
315:
316: if (build_dirs == 1)
317: cvs_mkpath(d, cvs_specified_tag);
318:
319: f[0] = fpath;
320: cvs_file_run(1, f, &cr);
321: break;
322: case CVS_DIR:
323: if (build_dirs == 1)
324: cvs_mkpath(wdir, cvs_specified_tag);
325: checkout_repository(repo, wdir);
326: break;
327: default:
328: break;
329: }
1.126 joris 330:
1.127 joris 331: if (nflag != 1 && mc->mc_prog != NULL &&
1.128 joris 332: mc->mc_flags & MODULE_RUN_ON_CHECKOUT)
1.126 joris 333: cvs_exec(mc->mc_prog);
1.139 tobias 334:
335: if (module_repo_root != NULL)
336: xfree(module_repo_root);
1.123 joris 337: }
1.119 joris 338:
1.123 joris 339: if (mc->mc_canfree == 1) {
340: for (fl = TAILQ_FIRST(&(mc->mc_modules));
341: fl != TAILQ_END(&(mc->mc_modules)); fl = nxt) {
342: nxt = TAILQ_NEXT(fl, flist);
343: TAILQ_REMOVE(&(mc->mc_modules), fl, flist);
344: xfree(fl->file_path);
345: xfree(fl);
346: }
347: }
1.120 joris 348:
1.123 joris 349: while ((ip = TAILQ_FIRST(&checkout_ign_pats)) != NULL) {
350: TAILQ_REMOVE(&checkout_ign_pats, ip, ip_list);
351: xfree(ip);
1.113 tobias 352: }
1.119 joris 353:
354: xfree(mc);
1.113 tobias 355: }
356: }
1.100 tobias 357:
1.113 tobias 358: static int
359: checkout_classify(const char *repo, const char *arg)
360: {
361: char *d, *f, fpath[MAXPATHLEN];
362: struct stat sb;
363:
364: if (stat(repo, &sb) == 0) {
1.123 joris 365: if (S_ISDIR(sb.st_mode))
366: return CVS_DIR;
1.113 tobias 367: }
1.97 joris 368:
1.113 tobias 369: d = dirname(repo);
370: f = basename(repo);
371:
372: (void)xsnprintf(fpath, sizeof(fpath), "%s/%s%s", d, f, RCS_FILE_EXT);
373: if (stat(fpath, &sb) == 0) {
374: if (!S_ISREG(sb.st_mode)) {
375: cvs_log(LP_ERR, "ignoring %s: not a regular file", arg);
376: return 0;
377: }
378: return CVS_FILE;
1.33 xsa 379: }
1.113 tobias 380:
381: (void)xsnprintf(fpath, sizeof(fpath), "%s/%s/%s%s",
382: d, CVS_PATH_ATTIC, f, RCS_FILE_EXT);
383: if (stat(fpath, &sb) == 0) {
384: if (!S_ISREG(sb.st_mode)) {
385: cvs_log(LP_ERR, "ignoring %s: not a regular file", arg);
386: return 0;
387: }
388: return CVS_FILE;
389: }
390:
391: cvs_log(LP_ERR, "cannot find module `%s' - ignored", arg);
392: return 0;
1.14 joris 393: }
1.9 jfb 394:
1.53 joris 395: static void
396: checkout_repository(const char *repobase, const char *wdbase)
1.14 joris 397: {
1.53 joris 398: struct cvs_flisthead fl, dl;
399: struct cvs_recursion cr;
400:
401: TAILQ_INIT(&fl);
402: TAILQ_INIT(&dl);
1.94 joris 403:
1.99 xsa 404: cvs_history_add((cvs_cmdop == CVS_OP_CHECKOUT) ?
405: CVS_HISTORY_CHECKOUT : CVS_HISTORY_EXPORT, NULL, wdbase);
1.41 joris 406:
1.112 tobias 407: if (print_stdout) {
408: cr.enterdir = NULL;
409: cr.leavedir = NULL;
410: } else {
411: cr.enterdir = cvs_update_enterdir;
1.118 tobias 412: cr.leavedir = prune_dirs ? cvs_update_leavedir : NULL;
1.112 tobias 413: }
1.64 joris 414: cr.fileproc = cvs_update_local;
1.78 xsa 415: cr.flags = flags;
1.41 joris 416:
1.143 joris 417: cvs_repository_lock(repobase, 0);
1.111 tobias 418: cvs_repository_getdir(repobase, wdbase, &fl, &dl,
419: flags & CR_RECURSE_DIRS ? 1 : 0);
1.1 jfb 420:
1.53 joris 421: cvs_file_walklist(&fl, &cr);
422: cvs_file_freelist(&fl);
1.23 joris 423:
1.53 joris 424: cvs_repository_unlock(repobase);
1.23 joris 425:
1.53 joris 426: cvs_file_walklist(&dl, &cr);
427: cvs_file_freelist(&dl);
428: }
1.23 joris 429:
1.58 joris 430: void
1.105 joris 431: cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags)
1.53 joris 432: {
1.141 joris 433: int cf_kflag, exists, fd;
1.53 joris 434: time_t rcstime;
435: CVSENTRIES *ent;
436: struct timeval tv[2];
1.134 tobias 437: struct tm *datetm;
1.87 joris 438: char *tosend;
1.135 xsa 439: char template[MAXPATHLEN], *entry;
1.115 xsa 440: char kbuf[8], sticky[CVS_REV_BUFSZ], rev[CVS_REV_BUFSZ];
1.96 xsa 441: char timebuf[CVS_TIME_BUFSZ], tbuf[CVS_TIME_BUFSZ];
1.22 jfb 442:
1.87 joris 443: exists = 0;
444: tosend = NULL;
1.104 joris 445:
446: if (!(co_flags & CO_REMOVE))
447: rcsnum_tostr(rnum, rev, sizeof(rev));
1.41 joris 448:
1.66 joris 449: cvs_log(LP_TRACE, "cvs_checkout_file(%s, %s, %d) -> %s",
1.78 xsa 450: cf->file_path, rev, co_flags,
1.66 joris 451: (cvs_server_active) ? "to client" : "to disk");
1.42 joris 452:
1.78 xsa 453: if (co_flags & CO_DUMP) {
1.106 tobias 454: rcs_rev_write_fd(cf->file_rcs, rnum, STDOUT_FILENO, 0);
1.65 reyk 455: return;
456: }
1.87 joris 457:
1.66 joris 458: if (cvs_server_active == 0) {
1.141 joris 459: (void)unlink(cf->file_path);
460:
1.87 joris 461: if (!(co_flags & CO_MERGE)) {
462: if (cf->fd != -1) {
463: exists = 1;
464: (void)close(cf->fd);
465: }
466:
1.141 joris 467: cf->fd = open(cf->file_path,
1.142 joris 468: O_CREAT | O_RDWR | O_TRUNC);
1.87 joris 469: if (cf->fd == -1)
470: fatal("cvs_checkout_file: open: %s",
471: strerror(errno));
472:
1.106 tobias 473: rcs_rev_write_fd(cf->file_rcs, rnum, cf->fd, 0);
1.87 joris 474: } else {
1.142 joris 475: cvs_merge_file(cf, (cvs_join_rev1 == NULL));
1.66 joris 476: }
477:
478: if (fchmod(cf->fd, 0644) == -1)
479: fatal("cvs_checkout_file: fchmod: %s", strerror(errno));
480:
1.87 joris 481: if ((exists == 0) && (cf->file_ent == NULL) &&
482: !(co_flags & CO_MERGE))
1.66 joris 483: rcstime = rcs_rev_getdate(cf->file_rcs, rnum);
1.84 joris 484: else
1.66 joris 485: time(&rcstime);
486:
487: tv[0].tv_sec = rcstime;
488: tv[0].tv_usec = 0;
489: tv[1] = tv[0];
490: if (futimes(cf->fd, tv) == -1)
491: fatal("cvs_checkout_file: futimes: %s",
492: strerror(errno));
1.53 joris 493: } else {
494: time(&rcstime);
1.41 joris 495: }
496:
1.84 joris 497: asctime_r(gmtime(&rcstime), tbuf);
1.107 tobias 498: tbuf[strcspn(tbuf, "\n")] = '\0';
1.58 joris 499:
1.78 xsa 500: if (co_flags & CO_MERGE) {
1.89 xsa 501: (void)xsnprintf(timebuf, sizeof(timebuf), "Result of merge+%s",
1.58 joris 502: tbuf);
503: } else {
504: strlcpy(timebuf, tbuf, sizeof(timebuf));
505: }
1.41 joris 506:
1.89 xsa 507: if (co_flags & CO_SETSTICKY)
1.105 joris 508: if (tag != NULL)
1.114 xsa 509: (void)xsnprintf(sticky, sizeof(sticky), "T%s", tag);
1.136 joris 510: else if (cvs_specified_date != -1) {
1.138 xsa 511: datetm = gmtime(&cvs_specified_date);
512: (void)strftime(sticky, sizeof(sticky),
513: "D"CVS_DATE_FMT, datetm);
1.134 tobias 514: } else
1.114 xsa 515: (void)xsnprintf(sticky, sizeof(sticky), "T%s", rev);
1.132 tobias 516: else if (!reset_tag && cf->file_ent != NULL &&
1.109 tobias 517: cf->file_ent->ce_tag != NULL)
1.114 xsa 518: (void)xsnprintf(sticky, sizeof(sticky), "T%s",
1.109 tobias 519: cf->file_ent->ce_tag);
1.89 xsa 520: else
1.114 xsa 521: sticky[0] = '\0';
1.60 joris 522:
1.85 xsa 523: kbuf[0] = '\0';
1.125 tobias 524: if (cf->file_rcs->rf_expand != NULL) {
525: cf_kflag = rcs_kflag_get(cf->file_rcs->rf_expand);
526: if (kflag || cf_kflag != RCS_KWEXP_DEFAULT)
527: (void)xsnprintf(kbuf, sizeof(kbuf),
528: "-k%s", cf->file_rcs->rf_expand);
1.132 tobias 529: } else if (!reset_option && cf->file_ent != NULL) {
1.85 xsa 530: if (cf->file_ent->ce_opts != NULL)
531: strlcpy(kbuf, cf->file_ent->ce_opts, sizeof(kbuf));
532: }
533:
1.135 xsa 534: entry = xmalloc(CVS_ENT_MAXLINELEN);
535: cvs_ent_line_str(cf->file_name, rev, timebuf, kbuf, sticky, 0, 0,
536: entry, CVS_ENT_MAXLINELEN);
1.41 joris 537:
1.66 joris 538: if (cvs_server_active == 0) {
1.108 tobias 539: if (!(co_flags & CO_REMOVE) && cvs_cmdop != CVS_OP_EXPORT) {
1.95 joris 540: ent = cvs_ent_open(cf->file_wd);
541: cvs_ent_add(ent, entry);
542: cvs_ent_close(ent, ENT_SYNC);
1.142 joris 543: cf->file_ent = cvs_ent_parse(entry);
1.135 xsa 544: xfree(entry);
1.95 joris 545: }
1.66 joris 546: } else {
1.87 joris 547: if (co_flags & CO_MERGE) {
1.141 joris 548: (void)unlink(cf->file_path);
1.142 joris 549: cvs_merge_file(cf, (cvs_join_rev1 == NULL));
1.87 joris 550: tosend = cf->file_path;
1.140 joris 551: fd = cf->fd;
1.87 joris 552: }
553:
1.78 xsa 554: if (co_flags & CO_COMMIT)
1.137 tobias 555: cvs_server_update_entry("Updated", cf);
1.87 joris 556: else if (co_flags & CO_MERGE)
557: cvs_server_update_entry("Merged", cf);
1.95 joris 558: else if (co_flags & CO_REMOVE)
559: cvs_server_update_entry("Removed", cf);
1.69 joris 560: else
561: cvs_server_update_entry("Updated", cf);
1.68 joris 562:
1.135 xsa 563: if (!(co_flags & CO_REMOVE)) {
1.95 joris 564: cvs_remote_output(entry);
1.135 xsa 565: xfree(entry);
566: }
1.66 joris 567:
1.137 tobias 568: if (!(co_flags & CO_REMOVE)) {
1.87 joris 569: if (!(co_flags & CO_MERGE)) {
1.89 xsa 570: (void)xsnprintf(template, MAXPATHLEN,
1.87 joris 571: "%s/checkout.XXXXXXXXXX", cvs_tmpdir);
1.89 xsa 572:
1.140 joris 573: fd = rcs_rev_write_stmp(cf->file_rcs, rnum,
1.87 joris 574: template, 0);
575: tosend = template;
576: }
577:
1.140 joris 578: cvs_remote_send_file(tosend, fd);
1.87 joris 579:
580: if (!(co_flags & CO_MERGE)) {
1.140 joris 581: close(fd);
1.87 joris 582: (void)unlink(template);
583: cvs_worklist_run(&temp_files,
584: cvs_worklist_unlink);
585: }
1.68 joris 586: }
1.66 joris 587: }
1.1 jfb 588: }