16 |
#include "watch.h" |
#include "watch.h" |
17 |
#include "edit.h" |
#include "edit.h" |
18 |
#include "fileattr.h" |
#include "fileattr.h" |
19 |
|
#include "base.h" |
20 |
|
|
21 |
static int watch_onoff (int, char **); |
static int watch_onoff (int, char **); |
22 |
|
|
321 |
{ |
{ |
322 |
Node *node; |
Node *node; |
323 |
struct file_info finfo; |
struct file_info finfo; |
324 |
char *basefilename; |
char *editbasefn, *basefn, *rev; |
325 |
|
|
|
xchmod (filename, 1); |
|
326 |
|
|
327 |
|
node = findnode_fn (ent_list, filename); |
328 |
|
|
329 |
|
/* I'm not sure why this isn't an error. */ |
330 |
|
if (!node) return; |
331 |
|
rev = ((Entnode *) node->data)->version; |
332 |
|
|
333 |
|
xchmod (filename, 1); |
334 |
mkdir_if_needed (CVSADM_BASE); |
mkdir_if_needed (CVSADM_BASE); |
335 |
basefilename = Xasprintf ("%s/%s", CVSADM_BASE, filename); |
basefn = make_base_file_name (filename, rev); |
|
copy_file (filename, basefilename); |
|
|
free (basefilename); |
|
336 |
|
|
337 |
node = findnode_fn (ent_list, filename); |
if (!isfile (basefn)) |
|
if (node != NULL) |
|
338 |
{ |
{ |
339 |
finfo.file = filename; |
/* If this client is interoperating with clients older than 1.12.14, |
340 |
finfo.fullname = short_pathname; |
* then the CVS/Base/.#FILENAME.REV may not have been created on |
341 |
finfo.update_dir = dir_name (short_pathname); |
* checkout/update/commit. |
342 |
base_register (&finfo, ((Entnode *) node->data)->version); |
*/ |
343 |
free ((char *)finfo.update_dir); |
if (!quiet) |
344 |
|
{ |
345 |
|
error (0, 0, "Base revision (%s) for `%s' is missing.", |
346 |
|
rev, short_pathname); |
347 |
|
error (0, 0, "Using `%s' to create unedit fallback.", |
348 |
|
short_pathname); |
349 |
|
} |
350 |
|
|
351 |
|
free (basefn); |
352 |
|
basefn = xstrdup (filename); |
353 |
} |
} |
354 |
|
|
355 |
|
editbasefn = Xasprintf ("%s/%s", CVSADM_BASE, filename); |
356 |
|
copy_file (basefn, editbasefn); |
357 |
|
free (basefn); |
358 |
|
free (editbasefn); |
359 |
|
|
360 |
|
finfo.file = filename; |
361 |
|
finfo.fullname = short_pathname; |
362 |
|
finfo.update_dir = dir_name (short_pathname); |
363 |
|
base_register (finfo.update_dir, finfo.file, rev); |
364 |
|
free ((char *)finfo.update_dir); |
365 |
} |
} |
366 |
|
|
367 |
|
|
694 |
Node *node; |
Node *node; |
695 |
Entnode *entdata; |
Entnode *entdata; |
696 |
|
|
697 |
baserev = base_get (finfo); |
baserev = base_get (finfo->update_dir, finfo->file); |
698 |
node = findnode_fn (finfo->entries, finfo->file); |
node = findnode_fn (finfo->entries, finfo->file); |
699 |
/* The case where node is NULL probably should be an error or |
/* The case where node is NULL probably should be an error or |
700 |
something, but I don't want to think about it too hard right |
something, but I don't want to think about it too hard right |
727 |
entdata->conflict); |
entdata->conflict); |
728 |
} |
} |
729 |
free (baserev); |
free (baserev); |
730 |
base_deregister (finfo); |
base_deregister (finfo->update_dir, finfo->file); |
731 |
} |
} |
732 |
|
|
733 |
xchmod (finfo->file, 0); |
xchmod (finfo->file, 0); |
794 |
date file in CVSADM_BASE. */ |
date file in CVSADM_BASE. */ |
795 |
base = Xasprintf ("%s/%s", CVSADM_BASE, file); |
base = Xasprintf ("%s/%s", CVSADM_BASE, file); |
796 |
if (unlink_file (base) < 0 && ! existence_error (errno)) |
if (unlink_file (base) < 0 && ! existence_error (errno)) |
797 |
error (0, errno, "cannot remove %s", file); |
error (0, errno, "cannot remove `%s'", base); |
798 |
free (base); |
free (base); |
799 |
} |
} |
800 |
|
|