699 |
{ |
{ |
700 |
if (vers->ts_conflict) |
if (vers->ts_conflict) |
701 |
{ |
{ |
702 |
if (file_has_conflict (finfo, vers->ts_conflict) |
if (file_has_markers (finfo)) |
|
|| file_has_markers (finfo)) |
|
703 |
{ |
{ |
704 |
write_letter (finfo, 'C'); |
write_letter (finfo, 'C'); |
705 |
retval = 1; |
retval = 1; |
1860 |
|
|
1861 |
|
|
1862 |
|
|
1863 |
|
/* Reregister a file after a merge. */ |
1864 |
|
static void |
1865 |
|
RegisterMerge (struct file_info *finfo, Vers_TS *vers, |
1866 |
|
const char *backup, int has_conflicts) |
1867 |
|
{ |
1868 |
|
/* This file is the result of a merge, which means that it has |
1869 |
|
been modified. We use a special timestamp string which will |
1870 |
|
not compare equal to any actual timestamp. */ |
1871 |
|
char *cp = NULL; |
1872 |
|
|
1873 |
|
if (has_conflicts) |
1874 |
|
{ |
1875 |
|
time (&last_register_time); |
1876 |
|
cp = time_stamp (finfo->file); |
1877 |
|
} |
1878 |
|
Register (finfo->entries, finfo->file, vers->vn_rcs ? vers->vn_rcs : "0", |
1879 |
|
"Result of merge", vers->options, vers->tag, vers->date, cp); |
1880 |
|
if (cp) |
1881 |
|
free (cp); |
1882 |
|
|
1883 |
|
#ifdef SERVER_SUPPORT |
1884 |
|
/* Send the new contents of the file before the message. If we |
1885 |
|
wanted to be totally correct, we would have the client write |
1886 |
|
the message only after the file has safely been written. */ |
1887 |
|
if (server_active) |
1888 |
|
{ |
1889 |
|
server_copy_file (finfo->file, finfo->update_dir, finfo->repository, |
1890 |
|
backup); |
1891 |
|
server_updated (finfo, vers, SERVER_MERGED, (mode_t) -1, NULL, NULL); |
1892 |
|
} |
1893 |
|
#endif |
1894 |
|
} |
1895 |
|
|
1896 |
|
|
1897 |
|
|
1898 |
/* |
/* |
1899 |
* Do all the magic associated with a file which needs to be merged |
* Do all the magic associated with a file which needs to be merged |
1900 |
*/ |
*/ |
1940 |
thought needs to go into this, and in the meantime it is safe |
thought needs to go into this, and in the meantime it is safe |
1941 |
to treat any such mismatch as an automatic conflict. -twp */ |
to treat any such mismatch as an automatic conflict. -twp */ |
1942 |
|
|
1943 |
#ifdef SERVER_SUPPORT |
status = RCS_checkout (finfo->rcs, finfo->file, vers->vn_rcs, |
1944 |
if (server_active) |
vers->tag, vers->options, NULL, NULL, NULL); |
1945 |
server_copy_file (finfo->file, finfo->update_dir, |
if (status) |
1946 |
finfo->repository, backup); |
{ |
1947 |
#endif |
error (0, 0, "failed to check out `%s' file", finfo->fullname); |
1948 |
|
error (0, 0, "restoring `%s' from backup file `%s'", |
1949 |
|
finfo->fullname, backup); |
1950 |
|
rename_file (backup, finfo->file); |
1951 |
|
retval = 1; |
1952 |
|
goto out; |
1953 |
|
} |
1954 |
|
|
1955 |
|
xchmod (finfo->file, 1); |
1956 |
|
|
1957 |
status = checkout_file (finfo, vers, 0, 1, 1); |
RegisterMerge (finfo, vers, backup, 1); |
1958 |
|
|
1959 |
/* Is there a better term than "nonmergeable file"? What we |
/* Is there a better term than "nonmergeable file"? What we |
1960 |
really mean is, not something that CVS cannot or does not |
really mean is, not something that CVS cannot or does not |
1988 |
if (strcmp (vers->options, "-V4") == 0) |
if (strcmp (vers->options, "-V4") == 0) |
1989 |
vers->options[0] = '\0'; |
vers->options[0] = '\0'; |
1990 |
|
|
|
/* This file is the result of a merge, which means that it has |
|
|
been modified. We use a special timestamp string which will |
|
|
not compare equal to any actual timestamp. */ |
|
|
{ |
|
|
char *cp = 0; |
|
|
|
|
|
if (status) |
|
|
{ |
|
|
(void) time (&last_register_time); |
|
|
cp = time_stamp (finfo->file); |
|
|
} |
|
|
Register (finfo->entries, finfo->file, vers->vn_rcs, |
|
|
"Result of merge", vers->options, vers->tag, |
|
|
vers->date, cp); |
|
|
if (cp) |
|
|
free (cp); |
|
|
} |
|
|
|
|
1991 |
/* fix up the vers structure, in case it is used by join */ |
/* fix up the vers structure, in case it is used by join */ |
1992 |
if (join_rev1) |
if (join_rev1) |
1993 |
{ |
{ |
1998 |
vers->vn_user = xstrdup (vers->vn_rcs); |
vers->vn_user = xstrdup (vers->vn_rcs); |
1999 |
} |
} |
2000 |
|
|
2001 |
#ifdef SERVER_SUPPORT |
RegisterMerge (finfo, vers, backup, status); |
|
/* Send the new contents of the file before the message. If we |
|
|
wanted to be totally correct, we would have the client write |
|
|
the message only after the file has safely been written. */ |
|
|
if (server_active) |
|
|
{ |
|
|
server_copy_file (finfo->file, finfo->update_dir, finfo->repository, |
|
|
backup); |
|
|
server_updated (finfo, vers, SERVER_MERGED, (mode_t) -1, NULL, NULL); |
|
|
} |
|
|
#endif |
|
2002 |
|
|
2003 |
if (status == 1) |
if (status == 1) |
2004 |
{ |
{ |
2576 |
RCS_checkout above, and we aren't running as the server. |
RCS_checkout above, and we aren't running as the server. |
2577 |
However, that is not the normal case, and calling Register |
However, that is not the normal case, and calling Register |
2578 |
again won't cost much in that case. */ |
again won't cost much in that case. */ |
2579 |
{ |
RegisterMerge (finfo, vers, backup, status); |
|
char *cp = 0; |
|
|
|
|
|
if (status) |
|
|
{ |
|
|
(void) time (&last_register_time); |
|
|
cp = time_stamp (finfo->file); |
|
|
} |
|
|
Register (finfo->entries, finfo->file, |
|
|
vers->vn_rcs ? vers->vn_rcs : "0", "Result of merge", |
|
|
vers->options, vers->tag, vers->date, cp); |
|
|
if (cp) |
|
|
free(cp); |
|
|
} |
|
|
|
|
|
#ifdef SERVER_SUPPORT |
|
|
if (server_active) |
|
|
{ |
|
|
server_copy_file (finfo->file, finfo->update_dir, finfo->repository, |
|
|
backup); |
|
|
server_updated (finfo, vers, SERVER_MERGED, (mode_t) -1, NULL, NULL); |
|
|
} |
|
|
#endif |
|
2580 |
|
|
2581 |
out: |
out: |
2582 |
free (rev1); |
free (rev1); |