summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Dirson <ydirson@altern.org>2006-04-11 17:26:12 +0200
committerYann Dirson <ydirson@altern.org>2007-05-12 00:01:41 +0200
commit9a096c852b5df000620cfd2ec7afb2e9312d415a (patch)
tree798aa73fd9fb4c11c4a66e055364a09adfaa2507
parenteb4b9ba691b7815db33e290757903a524ddeaba7 (diff)
downloadcvsps-dev/multitag.tar.gz
Allow to have multiple tags on a single patchset.dev/multitag
Still misses: - cache reading for "tags:" line (CACHE_NEED_PS_TAG)
-rw-r--r--cache.c16
-rw-r--r--cvsps.c42
-rw-r--r--cvsps_types.h11
3 files changed, 54 insertions, 15 deletions
diff --git a/cache.c b/cache.c
index 5f67a7c..4f98218 100644
--- a/cache.c
+++ b/cache.c
@@ -23,7 +23,7 @@
#define CACHE_DESCR_BOUNDARY "-=-END CVSPS DESCR-=-\n"
/* change this when making the on-disk cache-format invalid */
-static int cache_version = 1;
+static int cache_version = 2;
/* the tree walk API pretty much requries use of globals :-( */
static FILE * cache_fp;
@@ -519,8 +519,18 @@ static void dump_patch_set(FILE * fp, PatchSet * ps)
fprintf(fp, "patchset: %d\n", ps_counter);
fprintf(fp, "date: %d\n", (int)ps->date);
fprintf(fp, "author: %s\n", ps->author);
- fprintf(fp, "tag: %s\n", ps->tag ? ps->tag : "");
- fprintf(fp, "tag_flags: %d\n", ps->tag_flags);
+ {
+ fprintf(fp, "tags:");
+ struct list_head * tag;
+ for (tag = ps->tags.next; tag != &ps->tags; tag = tag->next)
+ {
+ TagName* tagname = list_entry (tag, TagName, link);
+
+ fprintf(fp, " %s %d%s", tagname->name, tagname->flags,
+ (tag->next == &ps->tags) ? "" : ",");
+ }
+ fprintf(fp, "\n");
+ }
fprintf(fp, "branch: %s\n", ps->branch);
fprintf(fp, "branch_add: %d\n", ps->branch_add);
fprintf(fp, "descr:\n%s", ps->descr); /* descr is guaranteed to end with LF */
diff --git a/cvsps.c b/cvsps.c
index 7996d29..d0757d1 100644
--- a/cvsps.c
+++ b/cvsps.c
@@ -1499,7 +1499,18 @@ static void print_patch_set(PatchSet * ps)
printf("Branch: %s\n", ps->branch);
if (ps->ancestor_branch)
printf("Ancestor branch: %s\n", ps->ancestor_branch);
- printf("Tag: %s %s\n", ps->tag ? ps->tag : "(none)", tag_flag_descr[ps->tag_flags]);
+ {
+ printf("Tags:");
+ struct list_head * tagl;
+ for (tagl = ps->tags.next; tagl != &ps->tags; tagl = tagl->next)
+ {
+ TagName* tag = list_entry (tagl, TagName, link);
+
+ printf(" %s %s%s", tag->name, tag_flag_descr[tag->flags],
+ (tagl->next == &ps->tags) ? "" : ",");
+ }
+ printf("\n");
+ }
printf("Log:\n%s\n", ps->descr);
printf("Members: \n");
@@ -2069,8 +2080,7 @@ static PatchSet * create_patch_set()
ps->max_date = 0;
ps->descr = NULL;
ps->author = NULL;
- ps->tag = NULL;
- ps->tag_flags = 0;
+ INIT_LIST_HEAD(&ps->tags);
ps->branch_add = 0;
ps->funk_factor = 0;
ps->ancestor_branch = NULL;
@@ -2304,7 +2314,12 @@ static void resolve_global_symbols()
return;
}
- ps->tag = sym->tag;
+ {
+ TagName* tagname = (TagName*)malloc(sizeof(TagName));
+ tagname->name = sym->tag;
+ tagname->flags = 0;
+ list_add(&tagname->link, &ps->tags);
+ }
/* check if this ps is one of the '-r' patchsets */
if (restrict_tag_start && strcmp(restrict_tag_start, sym->tag) == 0)
@@ -2356,7 +2371,8 @@ static void resolve_global_symbols()
int flag = check_rev_funk(ps, next_rev);
debug(DEBUG_STATUS, "file %s revision %s tag %s: TAG VIOLATION %s",
rev->file->filename, rev->rev, sym->tag, tag_flag_descr[flag]);
- ps->tag_flags |= flag;
+ /* FIXME: using tags.next is somewhat kludgy */
+ list_entry(ps->tags.next, TagName, link)->flags |= flag;
}
}
}
@@ -2487,6 +2503,11 @@ static int check_rev_funk(PatchSet * ps, CvsFileRevision * rev)
{
int retval = TAG_FUNKY;
+ struct list_head * tag;
+ for (tag = ps->tags.next; tag != &ps->tags; tag = tag->next)
+ {
+ char* tagname = list_entry (&tag, TagName, link)->name;
+
while (rev)
{
PatchSet * next_ps = rev->post_psm->ps;
@@ -2499,7 +2520,7 @@ static int check_rev_funk(PatchSet * ps, CvsFileRevision * rev)
ps->date, next_ps->date, rev->rev, rev->branch);
/*
- * If the ps->tag is one of the two possible '-r' tags
+ * If the tagname is one of the two possible '-r' tags
* then the funkyness is even more important.
*
* In the restrict_tag_start case, this next_ps is chronologically
@@ -2511,9 +2532,9 @@ static int check_rev_funk(PatchSet * ps, CvsFileRevision * rev)
* Start assuming the HIDE/SHOW_ALL case, we will determine
* below if we have a split ps case
*/
- if (restrict_tag_start && strcmp(ps->tag, restrict_tag_start) == 0)
+ if (restrict_tag_start && strcmp(tagname, restrict_tag_start) == 0)
next_ps->funk_factor = FNK_SHOW_ALL;
- if (restrict_tag_end && strcmp(ps->tag, restrict_tag_end) == 0)
+ if (restrict_tag_end && strcmp(tagname, restrict_tag_end) == 0)
next_ps->funk_factor = FNK_HIDE_ALL;
/*
@@ -2526,7 +2547,7 @@ static int check_rev_funk(PatchSet * ps, CvsFileRevision * rev)
for (next = next_ps->members.next; next != &next_ps->members; next = next->next)
{
PatchSetMember * psm = list_entry(next, PatchSetMember, link);
- if (before_tag(psm->post_rev, ps->tag))
+ if (before_tag(psm->post_rev, tagname))
{
retval = TAG_INVALID;
/* only set bad_funk for one of the -r tags */
@@ -2539,7 +2560,7 @@ static int check_rev_funk(PatchSet * ps, CvsFileRevision * rev)
debug(DEBUG_APPMSG1,
"WARNING: Invalid PatchSet %d, Tag %s:\n"
" %s:%s=after, %s:%s=before. Treated as 'before'",
- next_ps->psid, ps->tag,
+ next_ps->psid, tagname,
rev->file->filename, rev->rev,
psm->post_rev->file->filename, psm->post_rev->rev);
}
@@ -2547,6 +2568,7 @@ static int check_rev_funk(PatchSet * ps, CvsFileRevision * rev)
rev = rev_follow_branch(rev, ps->branch);
}
+ }
return retval;
}
diff --git a/cvsps_types.h b/cvsps_types.h
index dba145d..74c3cd8 100644
--- a/cvsps_types.h
+++ b/cvsps_types.h
@@ -21,6 +21,7 @@ typedef struct _PatchSetRange PatchSetRange;
typedef struct _CvsFileRevision CvsFileRevision;
typedef struct _GlobalSymbol GlobalSymbol;
typedef struct _Tag Tag;
+typedef struct _TagName TagName;
struct _CvsFileRevision
{
@@ -112,8 +113,7 @@ struct _PatchSet
time_t max_date;
char *descr;
char *author;
- char *tag;
- int tag_flags;
+ struct list_head tags;
char *branch;
char *ancestor_branch;
struct list_head members;
@@ -159,4 +159,11 @@ struct _Tag
struct list_head rev_link;
};
+struct _TagName
+{
+ char * name;
+ int flags;
+ struct list_head link;
+};
+
#endif /* CVSPS_TYPES_H */