summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-10 22:58:54 +0200
committerYann Dirson <ydirson@altern.org>2006-06-10 22:58:54 +0200
commitbb6b1ea1a785e10bee7bfba294012a821ddc3bd1 (patch)
treeb44c28242aad93232e383b3a36ff0f0545580bbb
parentab0095940796152f171d2de4fbd60ecc6ed433c3 (diff)
downloadcvsps-bb6b1ea1a785e10bee7bfba294012a821ddc3bd1.tar.gz
Improve handling of file collisions in the same patchset
Take the file revision into account.
-rw-r--r--cvsps.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/cvsps.c b/cvsps.c
index 1e64e3c..c22147e 100644
--- a/cvsps.c
+++ b/cvsps.c
@@ -2384,8 +2384,31 @@ void patch_set_add_member(PatchSet * ps, PatchSetMember * psm)
for (next = ps->members.next; next != &ps->members; next = next->next)
{
PatchSetMember * m = list_entry(next, PatchSetMember, link);
- if (m->file == psm->file && ps->collision_link.next == NULL)
- list_add(&ps->collision_link, &collisions);
+ if (m->file == psm->file) {
+ int order = compare_rev_strings(psm->post_rev->rev, m->post_rev->rev);
+
+ /*
+ * Same revision too? Add it to the collision list
+ * if it isn't already.
+ */
+ if (!order) {
+ if (ps->collision_link.next == NULL)
+ list_add(&ps->collision_link, &collisions);
+ return;
+ }
+
+ /*
+ * If this is an older revision than the one we already have
+ * in this patchset, just ignore it
+ */
+ if (order < 0)
+ return;
+
+ /*
+ * This is a newer one, remove the old one
+ */
+ list_del(&m->link);
+ }
}
psm->ps = ps;