20 |
* Returns non-zero on error. |
* Returns non-zero on error. |
21 |
*/ |
*/ |
22 |
|
|
23 |
|
#ifdef HAVE_CONFIG_H |
24 |
|
# include <config.h> |
25 |
|
#endif |
26 |
|
|
27 |
|
/* CVS */ |
28 |
|
#include "base.h" |
29 |
|
|
30 |
#include "cvs.h" |
#include "cvs.h" |
31 |
#include "fileattr.h" |
#include "fileattr.h" |
32 |
#include "edit.h" |
#include "edit.h" |
35 |
Checkin (int type, struct file_info *finfo, char *rev, char *tag, |
Checkin (int type, struct file_info *finfo, char *rev, char *tag, |
36 |
char *options, char *message) |
char *options, char *message) |
37 |
{ |
{ |
38 |
Vers_TS *vers; |
Vers_TS *vers, *pvers; |
39 |
int set_time; |
int set_time; |
40 |
char *tocvsPath = NULL; |
char *tocvsPath = NULL; |
41 |
|
|
58 |
*/ |
*/ |
59 |
assert (finfo->rcs != NULL); |
assert (finfo->rcs != NULL); |
60 |
|
|
61 |
|
pvers = Version_TS (finfo, NULL, tag, NULL, 1, 0); |
62 |
switch (RCS_checkin (finfo->rcs, finfo->update_dir, finfo->file, message, |
switch (RCS_checkin (finfo->rcs, finfo->update_dir, finfo->file, message, |
63 |
rev, 0, RCS_FLAGS_KEEPFILE)) |
rev, 0, RCS_FLAGS_KEEPFILE)) |
64 |
{ |
{ |
90 |
&& (!strcmp (options, "-ko") || !strcmp (options, "-kb"))) |
&& (!strcmp (options, "-ko") || !strcmp (options, "-kb"))) |
91 |
|| !RCS_cmp_file (finfo->rcs, rev, NULL, NULL, |
|| !RCS_cmp_file (finfo->rcs, rev, NULL, NULL, |
92 |
options, finfo->file)) |
options, finfo->file)) |
|
{ |
|
93 |
/* The existing file is correct. We don't have to do |
/* The existing file is correct. We don't have to do |
94 |
anything. */ |
anything. */ |
95 |
set_time = 0; |
set_time = 0; |
|
} |
|
96 |
else |
else |
97 |
|
set_time = 1; |
98 |
|
|
99 |
|
vers = Version_TS (finfo, NULL, tag, NULL, 1, set_time); |
100 |
|
|
101 |
|
if (set_time) |
102 |
{ |
{ |
103 |
/* The existing file is incorrect. We need to check |
/* The existing file is incorrect. We need to check |
104 |
out the correct file contents. */ |
out the correct file contents. */ |
105 |
if (RCS_checkout (finfo->rcs, finfo->file, rev, NULL, |
if (base_checkout (finfo->rcs, finfo, pvers->vn_user, |
106 |
options, RUN_TTY, NULL, NULL) != 0) |
vers->vn_rcs, NULL, options, |
107 |
|
cvswrite |
108 |
|
|| fileattr_get (finfo->file, "_watched"))) |
109 |
error (1, 0, "failed when checking out new copy of %s", |
error (1, 0, "failed when checking out new copy of %s", |
110 |
finfo->fullname); |
finfo->fullname); |
111 |
xchmod (finfo->file, 1); |
base_copy (finfo, rev, "y"); |
112 |
set_time = 1; |
set_time = 1; |
113 |
} |
} |
114 |
|
|
122 |
xchmod (finfo->file, 0); |
xchmod (finfo->file, 0); |
123 |
|
|
124 |
/* Re-register with the new data. */ |
/* Re-register with the new data. */ |
|
vers = Version_TS (finfo, NULL, tag, NULL, 1, set_time); |
|
125 |
if (strcmp (vers->options, "-V4") == 0) |
if (strcmp (vers->options, "-V4") == 0) |
126 |
vers->options[0] = '\0'; |
vers->options[0] = '\0'; |
127 |
Register (finfo->entries, finfo->file, vers->vn_rcs, vers->ts_user, |
Register (finfo->entries, finfo->file, vers->vn_rcs, vers->ts_user, |
176 |
if (set_time) |
if (set_time) |
177 |
/* Need to update the checked out file on the client side. */ |
/* Need to update the checked out file on the client side. */ |
178 |
server_updated (finfo, vers, SERVER_UPDATED, |
server_updated (finfo, vers, SERVER_UPDATED, |
179 |
(mode_t) -1, NULL, NULL, false); |
(mode_t) -1, NULL, NULL, true); |
180 |
else |
else |
181 |
server_checked_in (finfo->file, finfo->update_dir, |
server_checked_in (finfo->file, finfo->update_dir, |
182 |
finfo->repository); |
finfo->repository); |