[gitg/wip/albfan/time-order: 11/11] Recovering missed commits without topological order
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/albfan/time-order: 11/11] Recovering missed commits without topological order
- Date: Fri, 5 Apr 2019 12:36:09 +0000 (UTC)
commit 21153e84c1ef0586b8649243d2a5e840fe21c5e5
Author: Alberto Fanjul <albertofanjul gmail com>
Date: Thu Mar 21 02:58:49 2019 +0100
Recovering missed commits without topological order
libgitg/gitg-commit-model.vala | 47 ++++++++++++++++++++++++++++++++++++++++--
libgitg/gitg-lanes.vala | 9 +++++++-
2 files changed, 53 insertions(+), 3 deletions(-)
---
diff --git a/libgitg/gitg-commit-model.vala b/libgitg/gitg-commit-model.vala
index 7964e51a..b5985c45 100644
--- a/libgitg/gitg-commit-model.vala
+++ b/libgitg/gitg-commit-model.vala
@@ -405,8 +405,10 @@ namespace Gitg
int mylane;
SList<Lane> lanes;
- if (d_lanes.next(commit, out lanes, out mylane))
+ bool finded = d_lanes.next(commit, out lanes, out mylane, true);
+ if (finded)
{
+ message("finded parent for %s", commit.get_id().to_string());
commit.update_lanes((owned)lanes, mylane);
lock(d_id_hash)
@@ -427,7 +429,48 @@ namespace Gitg
d_ids[d_ids.length++] = commit;
}
- else
+ while (d_lanes.miss_commits.size > 0)
+ {
+ finded = false;
+ var iter = d_lanes.miss_commits.iterator();
+ while (iter.next())
+ {
+ var miss_commit = iter.get();
+ message("trying again %s",
miss_commit.get_id().to_string());
+ bool tmp_finded = d_lanes.next(miss_commit, out
lanes, out mylane);
+ if (tmp_finded)
+ {
+ finded = true;
+ message("finded parent for %s",
miss_commit.get_id().to_string());
+ iter.remove();
+ commit = miss_commit;
+
+ commit.update_lanes((owned)lanes, mylane);
+
+ lock(d_id_hash)
+ {
+ d_id_hash.set(id, d_ids.length);
+ }
+
+ if (needs_resize(d_ids, ref size))
+ {
+ var l = d_ids.length;
+
+ lock(d_ids)
+ {
+ d_ids.resize((int)size);
+ d_ids.length = l;
+ }
+ }
+
+ d_ids[d_ids.length++] = commit;
+ }
+ }
+ if (!finded)
+ break;
+ }
+
+ if (!finded)
{
if (needs_resize(d_hidden_ids, ref hidden_size))
{
diff --git a/libgitg/gitg-lanes.vala b/libgitg/gitg-lanes.vala
index 182a85f2..5a0cc2a3 100644
--- a/libgitg/gitg-lanes.vala
+++ b/libgitg/gitg-lanes.vala
@@ -26,6 +26,7 @@ public class Lanes : Object
public int inactive_collapse { get; set; default = 10; }
public int inactive_gap { get; set; default = 10; }
public bool inactive_enabled { get; set; default = true; }
+ public Gee.LinkedList<Commit> miss_commits {get; set; }
private SList<weak Commit> d_previous;
private Gee.LinkedList<LaneContainer> d_lanes;
@@ -133,6 +134,7 @@ public class Lanes : Object
Gee.HashSet<Ggit.OId>? roots = null)
{
d_lanes = new Gee.LinkedList<LaneContainer>();
+ miss_commits = new Gee.LinkedList<Commit>();
d_roots = roots;
Color.reset();
@@ -155,7 +157,8 @@ public class Lanes : Object
public bool next(Commit next,
out SList<Lane> lanes,
- out int nextpos)
+ out int nextpos,
+ bool save_miss = false)
{
var myoid = next.get_id();
@@ -166,6 +169,10 @@ public class Lanes : Object
}
LaneContainer? mylane = find_lane_by_oid(myoid, out nextpos);
+ if (mylane == null && save_miss) {
+ message("saving miss %s", next.get_id().to_string());
+ miss_commits.add(next);
+ }
if (mylane == null && d_roots != null && !d_roots.contains(myoid))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]