version 1.51, 2006/11/09 10:08:33 |
version 1.52, 2006/11/09 12:51:23 |
|
|
#include "log.h" |
#include "log.h" |
#include "remote.h" |
#include "remote.h" |
|
|
|
#define T_CHECK_UPTODATE 0x01 |
|
#define T_DELETE 0x02 |
|
#define T_FORCE_MOVE 0x04 |
|
|
void cvs_tag_local(struct cvs_file *); |
void cvs_tag_local(struct cvs_file *); |
|
|
static int tag_del(struct cvs_file *); |
static int tag_del(struct cvs_file *); |
static int tag_add(struct cvs_file *); |
static int tag_add(struct cvs_file *); |
|
|
static int tag_delete = 0; |
static int runflags = 0; |
static int tag_force_move = 0; |
|
static char *tag = NULL; |
static char *tag = NULL; |
static char *tag_date = NULL; |
static char *tag_date = NULL; |
static char *tag_name = NULL; |
static char *tag_name = NULL; |
|
|
|
|
while ((ch = getopt(argc, argv, cvs_cmd_tag.cmd_opts)) != -1) { |
while ((ch = getopt(argc, argv, cvs_cmd_tag.cmd_opts)) != -1) { |
switch (ch) { |
switch (ch) { |
|
case 'c': |
|
runflags |= T_CHECK_UPTODATE; |
|
break; |
case 'D': |
case 'D': |
tag_date = optarg; |
tag_date = optarg; |
break; |
break; |
case 'd': |
case 'd': |
tag_delete = 1; |
runflags |= T_DELETE; |
break; |
break; |
case 'F': |
case 'F': |
tag_force_move = 1; |
runflags |= T_FORCE_MOVE; |
break; |
break; |
case 'l': |
case 'l': |
flags &= ~CR_RECURSE_DIRS; |
flags &= ~CR_RECURSE_DIRS; |
|
|
tag_name, RCS_SYM_INVALCHAR); |
tag_name, RCS_SYM_INVALCHAR); |
|
|
if (tag_oldname != NULL) { |
if (tag_oldname != NULL) { |
if (tag_delete == 1) |
if (runflags & T_DELETE) |
tag_oldname = NULL; |
tag_oldname = NULL; |
else |
else |
tag = tag_oldname; |
tag = tag_oldname; |
} |
} |
|
|
if (tag_date != NULL) { |
if (tag_date != NULL) { |
if (tag_delete == 1) |
if (runflags & T_DELETE) |
tag_date = NULL; |
tag_date = NULL; |
else |
else |
tag = tag_date; |
tag = tag_date; |
|
|
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { |
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { |
cr.fileproc = cvs_client_sendfile; |
cr.fileproc = cvs_client_sendfile; |
|
|
if (tag_delete == 1) |
if (runflags & T_CHECK_UPTODATE) |
|
cvs_client_send_request("Argument -c"); |
|
|
|
if (runflags & T_DELETE) |
cvs_client_send_request("Argument -d"); |
cvs_client_send_request("Argument -d"); |
|
|
if (tag_force_move == 1) |
if (runflags & T_FORCE_MOVE) |
cvs_client_send_request("Argument -F"); |
cvs_client_send_request("Argument -F"); |
|
|
if (!(flags & CR_RECURSE_DIRS)) |
if (!(flags & CR_RECURSE_DIRS)) |
|
|
if (cf->file_type == CVS_DIR) { |
if (cf->file_type == CVS_DIR) { |
if (verbosity > 1) { |
if (verbosity > 1) { |
cvs_log(LP_NOTICE, "%s %s", |
cvs_log(LP_NOTICE, "%s %s", |
(tag_delete == 1) ? "Untagging" : "Tagging", |
(runflags & T_DELETE) ? "Untagging" : "Tagging", |
cf->file_path); |
cf->file_path); |
} |
} |
return; |
return; |
|
|
|
|
cvs_file_classify(cf, tag, 0); |
cvs_file_classify(cf, tag, 0); |
|
|
if (tag_delete == 1) { |
if (runflags & T_CHECK_UPTODATE) { |
|
if (cf->file_status != FILE_UPTODATE && |
|
cf->file_status != FILE_CHECKOUT && |
|
cf->file_status != FILE_PATCH) { |
|
cvs_log(LP_NOTICE, |
|
"%s is locally modified", cf->file_path); |
|
return; |
|
} |
|
} |
|
|
|
if (runflags & T_DELETE) { |
if (tag_del(cf) == 0) { |
if (tag_del(cf) == 0) { |
if (verbosity > 0) |
if (verbosity > 0) |
cvs_printf("D %s\n", cf->file_path); |
cvs_printf("D %s\n", cf->file_path); |
|
|
} |
} |
(void)rcsnum_tostr(trev, trevbuf, sizeof(trevbuf)); |
(void)rcsnum_tostr(trev, trevbuf, sizeof(trevbuf)); |
|
|
if (tag_force_move == 0) { |
if (!(runflags & T_FORCE_MOVE)) { |
cvs_printf("W %s : %s ", cf->file_path, tag_name); |
cvs_printf("W %s : %s ", cf->file_path, tag_name); |
cvs_printf("already exists on version %s", trevbuf); |
cvs_printf("already exists on version %s", trevbuf); |
cvs_printf(" : NOT MOVING tag to version %s\n", revbuf); |
cvs_printf(" : NOT MOVING tag to version %s\n", revbuf); |
|
|
return (-1); |
return (-1); |
} else if (tag_force_move == 1) { |
} else if (runflags & T_FORCE_MOVE) { |
sym = rcs_sym_get(cf->file_rcs, tag_name); |
sym = rcs_sym_get(cf->file_rcs, tag_name); |
rcsnum_cpy(cf->file_rcsrev, sym->rs_num, 0); |
rcsnum_cpy(cf->file_rcsrev, sym->rs_num, 0); |
cf->file_rcs->rf_flags &= ~RCS_SYNCED; |
cf->file_rcs->rf_flags &= ~RCS_SYNCED; |