1116
}
1117
1118
static int process_parents(struct rev_info *revs, struct commit *commit,
1119
- struct commit_list **list, struct prio_queue *queue)
1119
+ struct prio_queue *queue)
1120
{
1121
struct commit_list *parent = commit->parents;
1122
unsigned pass_flags;
1158
if (p->object.flags & SEEN)
1159
continue;
1160
p->object.flags |= (SEEN | NOT_USER_GIVEN);
1161
- if (list)
1162
- commit_list_insert_by_date(p, list);
1161
if (queue)
1162
prio_queue_put(queue, p);
1163
if (revs->exclude_first_parent_only)
1205
p->object.flags |= pass_flags | CHILD_VISITED;
1206
if (!(p->object.flags & SEEN)) {
1207
p->object.flags |= (SEEN | NOT_USER_GIVEN);
1210
- if (list)
1211
- commit_list_insert_by_date(p, list);
1208
if (queue)
1209
prio_queue_put(queue, p);
1210
}
1466
1467
if (revs->max_age != -1 && (commit->date < revs->max_age))
1468
obj->flags |= UNINTERESTING;
1473
- if (process_parents(revs, commit, NULL, &queue) < 0) {
1469
+ if (process_parents(revs, commit, &queue) < 0) {
1470
clear_prio_queue(&queue);
1471
return -1;
1472
}
3253
void release_revisions(struct rev_info *revs)
3254
{
3255
commit_list_free(revs->commits);
3256
+ clear_prio_queue(&revs->commit_queue);
3257
commit_list_free(revs->ancestry_path_bottoms);
3258
release_display_notes(&revs->notes_opt);
3259
object_array_clear(&revs->pending);
3723
if (revs->max_age != -1 && (c->date < revs->max_age))
3724
c->object.flags |= UNINTERESTING;
3725
3729
- if (process_parents(revs, c, NULL, NULL) < 0)
3726
+ if (process_parents(revs, c, NULL) < 0)
3727
return;
3728
3729
if (c->object.flags & UNINTERESTING)
3899
{
3900
struct commit_list *p;
3901
struct topo_walk_info *info = revs->topo_walk_info;
3905
- if (process_parents(revs, commit, NULL, NULL) < 0) {
3902
+ if (process_parents(revs, commit, NULL) < 0) {
3903
if (!revs->ignore_missing_links)
3904
die("Failed to traverse parents of commit %s",
3905
oid_to_hex(&commit->object.oid));
3935
}
3936
}
3937
3938
+void rev_info_commit_list_to_queue(struct rev_info *revs)
3939
+{
3940
+ while (revs->commits)
3941
+ prio_queue_put(&revs->commit_queue, pop_commit(&revs->commits));
3942
+}
3943
+
3944
+
3945
int prepare_revision_walk(struct rev_info *revs)
3946
{
3947
int i;
4010
for (;;) {
4011
struct commit *p = *pp;
4012
if (!revs->limited)
4009
- if (process_parents(revs, p, NULL, queue) < 0)
4013
+ if (process_parents(revs, p, queue) < 0)
4014
return rewrite_one_error;
4015
if (p->object.flags & UNINTERESTING)
4016
return rewrite_one_ok;
4024
}
4025
}
4026
4023
-static void merge_queue_into_list(struct prio_queue *q, struct commit_list **list)
4027
+static void merge_queue_into_prio_queue(struct prio_queue *from,
4028
+ struct prio_queue *to)
4029
{
4025
- while (q->nr) {
4026
- struct commit *item = prio_queue_peek(q);
4027
- struct commit_list *p = *list;
4028
-
4029
- if (p && p->item->date >= item->date)
4030
- list = &p->next;
4031
- else {
4032
- p = commit_list_insert(item, list);
4033
- list = &p->next; /* skip newly added item */
4034
- prio_queue_get(q); /* pop item */
4035
- }
4036
- }
4030
+ while (from->nr)
4031
+ prio_queue_put(to, prio_queue_get(from));
4032
}
4033
4034
static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp)
4035
{
4036
struct prio_queue queue = { compare_commits_by_commit_date };
4037
enum rewrite_result ret = rewrite_one_1(revs, pp, &queue);
4043
- merge_queue_into_list(&queue, &revs->commits);
4038
+ merge_queue_into_prio_queue(&queue, &revs->commit_queue);
4039
clear_prio_queue(&queue);
4040
return ret;
4041
}
4326
REV_WALK_REFLOG,
4327
REV_WALK_TOPO,
4328
REV_WALK_LIMITED,
4329
+ REV_WALK_NO_WALK,
4330
REV_WALK_STREAMING,
4331
};
4332
4338
return REV_WALK_TOPO;
4339
if (revs->limited)
4340
return REV_WALK_LIMITED;
4341
+ if (revs->no_walk)
4342
+ return REV_WALK_NO_WALK;
4343
return REV_WALK_STREAMING;
4344
}
4345
4347
{
4348
enum rev_walk_mode mode = get_walk_mode(revs);
4349
4350
+ if (mode == REV_WALK_STREAMING && revs->commits)
4351
+ rev_info_commit_list_to_queue(revs);
4352
+
4353
while (1) {
4354
struct commit *commit;
4355
4361
commit = next_topo_commit(revs);
4362
break;
4363
case REV_WALK_LIMITED:
4363
- case REV_WALK_STREAMING:
4364
+ case REV_WALK_NO_WALK:
4365
commit = pop_commit(&revs->commits);
4366
break;
4367
+ case REV_WALK_STREAMING:
4368
+ commit = prio_queue_get(&revs->commit_queue);
4369
+ break;
4370
}
4371
4372
if (!commit)
4394
break;
4395
case REV_WALK_STREAMING:
4396
if (process_parents(revs, commit,
4393
- &revs->commits, NULL) < 0) {
4397
+ &revs->commit_queue) < 0) {
4398
if (!revs->ignore_missing_links)
4399
die("Failed to traverse parents of commit %s",
4400
oid_to_hex(&commit->object.oid));
4401
}
4402
break;
4403
+ case REV_WALK_NO_WALK:
4404
case REV_WALK_LIMITED:
4405
break;
4406
}