[gitg/wip/albfan/time-order] Fix time sort mode
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/albfan/time-order] Fix time sort mode
- Date: Sun, 5 May 2019 10:12:19 +0000 (UTC)
commit 1be2990feab6a01d578fd7f84b33475275755dc7
Author: Alberto Fanjul <albertofanjul gmail com>
Date: Sun May 5 12:11:50 2019 +0200
Fix time sort mode
Fix topological/time sort mode
Save miss commits on same second until its parents are painted
gitg/history/gitg-history.vala | 4 ++--
libgitg/gitg-commit-model.vala | 49 +++++++++++++++++++++++++++++++++++++++---
libgitg/gitg-lanes.vala | 12 +++++++++--
3 files changed, 58 insertions(+), 7 deletions(-)
---
diff --git a/gitg/history/gitg-history.vala b/gitg/history/gitg-history.vala
index a2172357..09dd67f1 100644
--- a/gitg/history/gitg-history.vala
+++ b/gitg/history/gitg-history.vala
@@ -231,11 +231,11 @@ namespace GitgHistory
{
if (d_settings.get_boolean("topological-order"))
{
- d_commit_list_model.sort_mode |= Ggit.SortMode.TOPOLOGICAL;
+ d_commit_list_model.sort_mode = Ggit.SortMode.TOPOLOGICAL;
}
else
{
- d_commit_list_model.sort_mode &= ~Ggit.SortMode.TOPOLOGICAL;
+ d_commit_list_model.sort_mode = Ggit.SortMode.TIME |
Ggit.SortMode.TOPOLOGICAL;
}
}
diff --git a/libgitg/gitg-commit-model.vala b/libgitg/gitg-commit-model.vala
index e473dc52..193a33fb 100644
--- a/libgitg/gitg-commit-model.vala
+++ b/libgitg/gitg-commit-model.vala
@@ -138,7 +138,7 @@ namespace Gitg
construct
{
d_lanes = new Lanes();
- d_sortmode = Ggit.SortMode.TIME | Ggit.SortMode.TOPOLOGICAL;
+ d_sortmode = Ggit.SortMode.TOPOLOGICAL | Ggit.SortMode.TIME;
}
public override void dispose()
@@ -418,8 +418,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)
{
+ debug ("finded parent for %s %s\n", commit.get_subject(),
commit.get_id().to_string());
commit.update_lanes((owned)lanes, mylane);
lock(d_id_hash)
@@ -440,7 +442,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();
+ debug ("trying again %s %s",
miss_commit.get_subject(), miss_commit.get_id().to_string());
+ bool tmp_finded = d_lanes.next(miss_commit, out
lanes, out mylane);
+ if (tmp_finded)
+ {
+ finded = true;
+ debug ("finded parent for miss %s %s\n",
miss_commit.get_subject(), 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..0deaf227 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();
@@ -165,11 +168,16 @@ public class Lanes : Object
expand_lanes(next);
}
+ debug("commit: %s %s", next.get_subject(), next.get_id().to_string());
LaneContainer? mylane = find_lane_by_oid(myoid, out nextpos);
-
if (mylane == null && d_roots != null && !d_roots.contains(myoid))
{
lanes = null;
+ if (save_miss) {
+ debug ("saving miss %s %s", next.get_id().to_string(),
next.get_id().to_string());
+ miss_commits.add(next);
+ }
+
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]