[gitg] Respect the mainline of the merges
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Respect the mainline of the merges
- Date: Fri, 17 May 2013 11:23:51 +0000 (UTC)
commit d3cb803007aa5e36de8fe6442a202d5142514091
Author: Techlive Zheng <techlivezheng gmail com>
Date: Thu May 16 18:35:53 2013 +0800
Respect the mainline of the merges
Normally the 1st parent of a commit is the branch we're merging _into_,
so if you keep this on the left then you can always read a merge as
right-to-left. Previous it seems to be a bit random.
By comparing the position a 'lane' in the 'lanes', the earier a lane is
created, the more priority it has.
Signed-off-by: Ignacio Casal Quinteiro <icq gnome org>
libgitg/gitg-lanes.vala | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/libgitg/gitg-lanes.vala b/libgitg/gitg-lanes.vala
index da725ad..b96acd0 100644
--- a/libgitg/gitg-lanes.vala
+++ b/libgitg/gitg-lanes.vala
@@ -157,14 +157,27 @@ public class Lanes : Object
if (container != null)
{
// there is already a lane for this parent. This means that
- // we add pos as a merge for the lane, also this means the
- // color of this lane incluis the merge should change to
- // one color
- container.lane.from.append(pos);
- container.lane.color.next_index();
-
- container.inactive = 0;
- container.from = myoid;
+ // 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;
+ mylane.lane.from.append(lnpos);
+ mylane.lane.color = Color.next();
+ mylane.inactive = 0;
+ d_lanes.remove(container);
+ }
+ else
+ {
+ container.from = myoid;
+ container.lane.from.append(pos);
+ container.lane.color.next_index();
+ container.inactive = 0;
+ }
continue;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]