2012-07-02 18:02:34 +00:00
|
|
|
/*
|
|
|
|
* This file is part of gitg
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 - Jesse van den Kieboom
|
|
|
|
*
|
|
|
|
* gitg is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* gitg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2012-04-14 11:46:39 +00:00
|
|
|
namespace Gitg
|
|
|
|
{
|
|
|
|
|
|
|
|
public class Lanes : Object
|
|
|
|
{
|
2014-06-30 12:21:24 +00:00
|
|
|
public int inactive_max { get; set; default = 30; }
|
|
|
|
public int inactive_collapse { get; set; default = 10; }
|
|
|
|
public int inactive_gap { get; set; default = 10; }
|
|
|
|
public bool inactive_enabled { get; set; default = true; }
|
2012-04-14 11:46:39 +00:00
|
|
|
|
2014-06-11 12:58:31 +00:00
|
|
|
private SList<weak Commit> d_previous;
|
2014-06-11 12:58:55 +00:00
|
|
|
private Gee.LinkedList<LaneContainer> d_lanes;
|
2012-04-14 11:46:39 +00:00
|
|
|
private HashTable<Ggit.OId, CollapsedLane> d_collapsed;
|
2014-12-21 18:33:33 +00:00
|
|
|
private Gee.HashSet<Ggit.OId>? d_roots;
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
class LaneContainer
|
|
|
|
{
|
|
|
|
public Lane lane;
|
2014-12-21 18:33:33 +00:00
|
|
|
public int inactive;
|
2012-04-14 11:46:39 +00:00
|
|
|
public Ggit.OId? from;
|
|
|
|
public Ggit.OId? to;
|
|
|
|
|
2012-04-22 13:11:07 +00:00
|
|
|
public LaneContainer.with_color(Ggit.OId? from,
|
|
|
|
Ggit.OId? to,
|
|
|
|
Color? color)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
this.from = from;
|
|
|
|
this.to = to;
|
|
|
|
this.lane = new Lane.with_color(color);
|
|
|
|
this.inactive = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public LaneContainer(Ggit.OId? from,
|
|
|
|
Ggit.OId? to)
|
|
|
|
{
|
|
|
|
this.with_color(from, to, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void next(int index)
|
|
|
|
{
|
2014-12-21 18:33:33 +00:00
|
|
|
var hidden = is_hidden;
|
2012-04-14 11:46:39 +00:00
|
|
|
lane = lane.copy();
|
|
|
|
|
2012-04-22 13:11:07 +00:00
|
|
|
lane.tag = LaneTag.NONE;
|
2012-04-14 11:46:39 +00:00
|
|
|
lane.from = new SList<int>();
|
|
|
|
|
2014-12-21 18:33:33 +00:00
|
|
|
if (!hidden)
|
|
|
|
{
|
|
|
|
lane.from.prepend(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
is_hidden = hidden;
|
|
|
|
|
|
|
|
if (to != null && inactive >= 0)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
++inactive;
|
|
|
|
}
|
|
|
|
}
|
2014-12-21 18:33:33 +00:00
|
|
|
|
|
|
|
public bool is_hidden
|
|
|
|
{
|
|
|
|
get { return (lane.tag & LaneTag.HIDDEN) != 0; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value)
|
|
|
|
{
|
|
|
|
lane.tag |= LaneTag.HIDDEN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lane.tag &= ~LaneTag.HIDDEN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Compact]
|
|
|
|
class CollapsedLane
|
|
|
|
{
|
|
|
|
public Color color;
|
|
|
|
public uint index;
|
|
|
|
public Ggit.OId? from;
|
|
|
|
public Ggit.OId? to;
|
|
|
|
|
|
|
|
public CollapsedLane(LaneContainer container)
|
|
|
|
{
|
|
|
|
color = container.lane.color;
|
|
|
|
from = container.from;
|
|
|
|
to = container.to;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Lanes()
|
|
|
|
{
|
|
|
|
d_collapsed = new HashTable<Ggit.OId, CollapsedLane>(Ggit.OId.hash,
|
|
|
|
Ggit.OId.equal);
|
|
|
|
|
2014-06-30 12:21:50 +00:00
|
|
|
var settings = new Settings("org.gnome.gitg.preferences.history");
|
|
|
|
|
|
|
|
settings.bind("collapse-inactive-lanes-enabled",
|
|
|
|
this,
|
|
|
|
"inactive-enabled",
|
|
|
|
SettingsBindFlags.GET | SettingsBindFlags.SET);
|
|
|
|
|
|
|
|
settings.bind("collapse-inactive-lanes",
|
|
|
|
this,
|
|
|
|
"inactive-collapse",
|
|
|
|
SettingsBindFlags.GET | SettingsBindFlags.SET);
|
|
|
|
|
2012-04-14 11:46:39 +00:00
|
|
|
reset();
|
|
|
|
}
|
|
|
|
|
2015-09-27 12:59:39 +00:00
|
|
|
public void reset(Ggit.OId[]? reserved = null,
|
2014-12-21 18:33:33 +00:00
|
|
|
Gee.HashSet<Ggit.OId>? roots = null)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
2014-06-11 12:58:55 +00:00
|
|
|
d_lanes = new Gee.LinkedList<LaneContainer>();
|
2014-12-21 18:33:33 +00:00
|
|
|
d_roots = roots;
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
Color.reset();
|
|
|
|
|
2014-12-21 18:33:33 +00:00
|
|
|
if (reserved != null)
|
|
|
|
{
|
|
|
|
foreach (var r in reserved)
|
|
|
|
{
|
|
|
|
var ct = new LaneContainer(null, r);
|
|
|
|
ct.inactive = -1;
|
|
|
|
ct.is_hidden = true;
|
|
|
|
|
|
|
|
d_lanes.add(ct);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-14 11:46:39 +00:00
|
|
|
d_collapsed.remove_all();
|
2014-12-21 18:33:33 +00:00
|
|
|
d_previous = new SList<weak Commit>();
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-21 18:33:33 +00:00
|
|
|
public bool next(Commit next,
|
|
|
|
out SList<Lane> lanes,
|
|
|
|
out int nextpos)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
var myoid = next.get_id();
|
|
|
|
|
|
|
|
if (inactive_enabled)
|
|
|
|
{
|
|
|
|
collapse_lanes();
|
|
|
|
expand_lanes(next);
|
|
|
|
}
|
|
|
|
|
2014-06-11 12:58:55 +00:00
|
|
|
LaneContainer? mylane = find_lane_by_oid(myoid, out nextpos);
|
2012-04-14 11:46:39 +00:00
|
|
|
|
2014-12-21 18:33:33 +00:00
|
|
|
if (mylane == null && d_roots != null && !d_roots.contains(myoid))
|
|
|
|
{
|
|
|
|
lanes = null;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-04-14 11:46:39 +00:00
|
|
|
if (mylane == null)
|
|
|
|
{
|
2014-12-21 18:33:33 +00:00
|
|
|
// there is no lane reserved for this commit, add a new lane
|
|
|
|
mylane = new LaneContainer(myoid, null);
|
|
|
|
|
|
|
|
d_lanes.add(mylane);
|
2014-06-11 12:58:55 +00:00
|
|
|
nextpos = (int)d_lanes.size - 1;
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// copy the color here because the commit is a new stop
|
|
|
|
mylane.lane.color = mylane.lane.color.copy();
|
|
|
|
|
|
|
|
mylane.to = null;
|
|
|
|
mylane.from = next.get_id();
|
2014-12-21 18:33:33 +00:00
|
|
|
|
|
|
|
if (mylane.is_hidden && d_roots != null && d_roots.contains(myoid))
|
|
|
|
{
|
|
|
|
mylane.is_hidden = false;
|
|
|
|
mylane.lane.from = new SList<int>();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mylane.inactive >= 0)
|
|
|
|
{
|
|
|
|
mylane.inactive = 0;
|
|
|
|
}
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-21 18:33:33 +00:00
|
|
|
var hidden = mylane.is_hidden;
|
|
|
|
|
|
|
|
lanes = lanes_list();
|
|
|
|
prepare_lanes(next, nextpos, hidden);
|
2012-04-14 11:46:39 +00:00
|
|
|
|
2014-12-21 18:33:33 +00:00
|
|
|
return !hidden;
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-21 18:33:33 +00:00
|
|
|
private void prepare_lanes(Commit next, int pos, bool hidden)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
var parents = next.get_parents();
|
|
|
|
var myoid = next.get_id();
|
|
|
|
|
2015-11-09 08:39:45 +00:00
|
|
|
if (!hidden)
|
|
|
|
{
|
|
|
|
init_next_layer();
|
|
|
|
}
|
|
|
|
|
2014-06-11 12:58:55 +00:00
|
|
|
var mylane = d_lanes[pos];
|
2012-04-14 11:46:39 +00:00
|
|
|
|
2014-12-14 18:16:41 +00:00
|
|
|
for (uint i = 0; i < parents.size; ++i)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
int lnpos;
|
|
|
|
var poid = parents.get_id(i);
|
|
|
|
|
2014-06-11 12:58:55 +00:00
|
|
|
var container = find_lane_by_oid(poid, out lnpos);
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
if (container != null)
|
|
|
|
{
|
|
|
|
// there is already a lane for this parent. This means that
|
2013-05-16 10:35:53 +00:00
|
|
|
// we add pos as a merge for the lane.
|
|
|
|
if (i == 0 && pos < lnpos)
|
|
|
|
{
|
|
|
|
// we are at the mainline of a merge, and this parent has
|
|
|
|
// already been assigned to an existing lane, if our
|
|
|
|
// lane's pos is smaller, then the this parent should be in
|
|
|
|
// our lane instead.
|
|
|
|
mylane.to = poid;
|
|
|
|
mylane.from = myoid;
|
2014-12-21 18:33:33 +00:00
|
|
|
|
|
|
|
if (!container.is_hidden)
|
|
|
|
{
|
|
|
|
mylane.lane.from.append(lnpos);
|
|
|
|
mylane.is_hidden = false;
|
|
|
|
}
|
|
|
|
|
2013-05-16 10:36:17 +00:00
|
|
|
mylane.lane.color = mylane.lane.color.copy();
|
2014-12-21 18:33:33 +00:00
|
|
|
|
|
|
|
if (mylane.inactive >= 0)
|
|
|
|
{
|
|
|
|
mylane.inactive = 0;
|
|
|
|
}
|
2014-06-11 12:58:55 +00:00
|
|
|
|
2013-05-16 10:35:53 +00:00
|
|
|
d_lanes.remove(container);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
container.from = myoid;
|
2014-12-21 18:33:33 +00:00
|
|
|
|
|
|
|
if (!hidden)
|
|
|
|
{
|
|
|
|
container.lane.from.append(pos);
|
|
|
|
}
|
|
|
|
|
2013-05-16 10:36:17 +00:00
|
|
|
container.lane.color = container.lane.color.copy();
|
2014-12-21 18:33:33 +00:00
|
|
|
|
|
|
|
if (!hidden)
|
|
|
|
{
|
|
|
|
container.is_hidden = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (container.inactive >= 0)
|
|
|
|
{
|
|
|
|
container.inactive = 0;
|
|
|
|
}
|
2013-05-16 10:35:53 +00:00
|
|
|
}
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (mylane != null && mylane.to == null)
|
|
|
|
{
|
|
|
|
// there is no parent yet which can proceed on the current
|
|
|
|
// commit lane, so set it now
|
|
|
|
mylane.to = poid;
|
|
|
|
|
2013-05-16 10:36:17 +00:00
|
|
|
mylane.lane.color = mylane.lane.color.copy();
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
2014-12-21 18:33:33 +00:00
|
|
|
else if (!hidden)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
// generate a new lane for this parent
|
2014-06-11 12:58:55 +00:00
|
|
|
var newlane = new LaneContainer(myoid, poid);
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
newlane.lane.from.prepend(pos);
|
2014-06-11 12:58:55 +00:00
|
|
|
d_lanes.add(newlane);
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mylane != null && mylane.to == null)
|
|
|
|
{
|
|
|
|
// remove current lane if no longer needed (i.e. merged)
|
|
|
|
d_lanes.remove(mylane);
|
|
|
|
}
|
|
|
|
|
|
|
|
// store new commit in track list
|
|
|
|
if (d_previous.length() == inactive_collapse + inactive_gap + 1)
|
|
|
|
{
|
|
|
|
d_previous.delete_link(d_previous.last());
|
|
|
|
}
|
|
|
|
|
|
|
|
d_previous.prepend(next);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void add_collapsed(LaneContainer container,
|
|
|
|
int index)
|
|
|
|
{
|
|
|
|
var collapsed = new CollapsedLane(container);
|
|
|
|
collapsed.index = index;
|
|
|
|
|
|
|
|
d_collapsed.insert(container.to, (owned)collapsed);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void collapse_lane(LaneContainer container,
|
|
|
|
int index)
|
|
|
|
{
|
|
|
|
add_collapsed(container, index);
|
|
|
|
|
2014-06-11 12:58:31 +00:00
|
|
|
unowned SList<weak Commit> item = d_previous;
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
while (item != null)
|
|
|
|
{
|
|
|
|
var commit = item.data;
|
2012-04-24 22:01:27 +00:00
|
|
|
unowned SList<Lane> lns = commit.get_lanes();
|
2012-04-14 11:46:39 +00:00
|
|
|
|
2015-09-27 12:59:39 +00:00
|
|
|
if (lns != null)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
2015-09-27 12:59:39 +00:00
|
|
|
unowned Lane lane = lns.nth_data(index);
|
2012-04-14 11:46:39 +00:00
|
|
|
|
2015-09-27 12:59:39 +00:00
|
|
|
if (item.next != null)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
2015-09-27 12:59:39 +00:00
|
|
|
var newindex = lane.from.data;
|
|
|
|
|
|
|
|
lns = commit.remove_lane(lane);
|
|
|
|
|
|
|
|
if (item.next.next != null)
|
|
|
|
{
|
|
|
|
update_merge_indices(lns, newindex, -1);
|
|
|
|
}
|
2012-04-14 11:46:39 +00:00
|
|
|
|
2015-09-27 12:59:39 +00:00
|
|
|
var mylane = commit.mylane;
|
2012-04-14 11:46:39 +00:00
|
|
|
|
2015-09-27 12:59:39 +00:00
|
|
|
if (mylane > index)
|
|
|
|
{
|
|
|
|
--commit.mylane;
|
|
|
|
}
|
|
|
|
|
|
|
|
index = newindex;
|
|
|
|
}
|
|
|
|
else
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
2015-09-27 12:59:39 +00:00
|
|
|
lane.tag |= LaneTag.END;
|
|
|
|
lane.boundary_id = container.to;
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
item = item.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void collapse_lanes()
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
|
2014-06-11 12:58:55 +00:00
|
|
|
var iter = d_lanes.iterator();
|
|
|
|
|
|
|
|
while (iter.next())
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
2014-06-11 12:58:55 +00:00
|
|
|
var container = iter.get();
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
if (container.inactive != inactive_max + inactive_gap)
|
|
|
|
{
|
|
|
|
++index;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
collapse_lane(container, container.lane.from.data);
|
|
|
|
update_current_lane_merge_indices(index, -1);
|
|
|
|
|
2014-06-11 12:58:55 +00:00
|
|
|
iter.remove();
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private int ensure_correct_index(Commit commit,
|
|
|
|
int index)
|
|
|
|
{
|
2012-04-24 22:01:27 +00:00
|
|
|
var len = commit.get_lanes().length();
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
if (index > len)
|
|
|
|
{
|
|
|
|
return (int)len;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void update_lane_merge_indices(SList<int> from,
|
|
|
|
int index,
|
|
|
|
int direction)
|
|
|
|
{
|
|
|
|
while (from != null)
|
|
|
|
{
|
|
|
|
int idx = from.data;
|
|
|
|
|
|
|
|
if (idx > index || (direction > 0 && idx == index))
|
|
|
|
{
|
|
|
|
from.data = idx + direction;
|
|
|
|
}
|
|
|
|
|
|
|
|
from = from.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void update_merge_indices(SList<Lane> lanes,
|
|
|
|
int index,
|
|
|
|
int direction)
|
|
|
|
{
|
|
|
|
foreach (unowned Lane lane in lanes)
|
|
|
|
{
|
|
|
|
update_lane_merge_indices(lane.from, index, direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void update_current_lane_merge_indices(int index,
|
|
|
|
int direction)
|
|
|
|
{
|
2014-06-11 12:58:55 +00:00
|
|
|
foreach (var container in d_lanes)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
update_lane_merge_indices(container.lane.from,
|
|
|
|
index,
|
|
|
|
direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void expand_lane(CollapsedLane lane)
|
|
|
|
{
|
|
|
|
var index = lane.index;
|
|
|
|
var ln = new Lane.with_color(lane.color);
|
2014-06-11 12:58:55 +00:00
|
|
|
var len = d_lanes.size;
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
if (index > len)
|
|
|
|
{
|
|
|
|
index = len;
|
|
|
|
}
|
|
|
|
|
|
|
|
var next = ensure_correct_index(d_previous.data, (int)index);
|
|
|
|
|
|
|
|
var container = new LaneContainer.with_color(lane.from,
|
|
|
|
lane.to,
|
|
|
|
lane.color);
|
|
|
|
|
|
|
|
update_current_lane_merge_indices((int)index, 1);
|
|
|
|
|
|
|
|
container.lane.from.prepend(next);
|
2014-06-11 12:58:55 +00:00
|
|
|
d_lanes.insert((int)index, container);
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
index = next;
|
|
|
|
uint cnt = 0;
|
|
|
|
|
|
|
|
unowned SList<Commit> ptr = d_previous;
|
|
|
|
|
|
|
|
while (ptr != null)
|
|
|
|
{
|
|
|
|
var commit = ptr.data;
|
|
|
|
|
|
|
|
if (cnt == inactive_collapse)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Insert new lane at the index
|
|
|
|
Lane copy = ln.copy();
|
2012-04-24 22:01:27 +00:00
|
|
|
unowned SList<Lane> lns = commit.get_lanes();
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
if (ptr.next == null || cnt + 1 == inactive_collapse)
|
|
|
|
{
|
|
|
|
copy.boundary_id = lane.from;
|
2012-04-22 13:11:07 +00:00
|
|
|
copy.tag |= LaneTag.START;
|
2012-04-14 11:46:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
next = ensure_correct_index(ptr.next.data, (int)index);
|
|
|
|
copy.from.prepend(next);
|
|
|
|
|
|
|
|
update_merge_indices(lns, (int)index, 1);
|
|
|
|
}
|
|
|
|
|
2012-04-24 22:01:27 +00:00
|
|
|
commit.insert_lane(copy, (int)index);
|
2012-04-14 11:46:39 +00:00
|
|
|
|
|
|
|
var mylane = commit.mylane;
|
|
|
|
|
|
|
|
if (mylane >= index)
|
|
|
|
{
|
|
|
|
++commit.mylane;
|
|
|
|
}
|
|
|
|
|
|
|
|
index = next;
|
|
|
|
++cnt;
|
|
|
|
|
|
|
|
ptr = ptr.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void expand_lane_from_oid(Ggit.OId id)
|
|
|
|
{
|
|
|
|
unowned CollapsedLane? collapsed = d_collapsed.lookup(id);
|
|
|
|
|
|
|
|
if (collapsed != null)
|
|
|
|
{
|
|
|
|
expand_lane(collapsed);
|
|
|
|
d_collapsed.remove(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void expand_lanes(Commit commit)
|
|
|
|
{
|
|
|
|
expand_lane_from_oid(commit.get_id());
|
|
|
|
|
|
|
|
var parents = commit.get_parents();
|
|
|
|
|
2014-12-14 18:16:41 +00:00
|
|
|
for (uint i = 0; i < parents.size; ++i)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
expand_lane_from_oid(parents.get_id(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void init_next_layer()
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
|
2014-06-11 12:58:55 +00:00
|
|
|
foreach (var container in d_lanes)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
container.next(index++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-11 12:58:55 +00:00
|
|
|
private LaneContainer? find_lane_by_oid(Ggit.OId id,
|
|
|
|
out int pos)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
int p = 0;
|
|
|
|
|
2014-06-11 12:58:55 +00:00
|
|
|
foreach (var container in d_lanes)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
if (container != null &&
|
|
|
|
id.equal(container.to))
|
|
|
|
{
|
|
|
|
pos = p;
|
|
|
|
return container;
|
|
|
|
}
|
|
|
|
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
|
|
|
|
pos = -1;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private SList<Lane> lanes_list()
|
|
|
|
{
|
|
|
|
var ret = new SList<Lane>();
|
|
|
|
|
2014-06-11 12:58:55 +00:00
|
|
|
foreach (var container in d_lanes)
|
2012-04-14 11:46:39 +00:00
|
|
|
{
|
|
|
|
ret.prepend(container.lane.copy());
|
|
|
|
}
|
|
|
|
|
|
|
|
ret.reverse();
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// ex:set ts=4 noet
|