Discussion:
[thg-dev] [PATCH 2 of 3] graph: own style for line to obsolescence parents
Simon Heimberg
2013-11-19 00:35:51 UTC
Permalink
# HG changeset patch
# User Simon Heimberg <***@besonet.ch>
# Date 1383675098 -3600
# Node ID af575fc2cc609800e5e8ba5df45d2e91a04cecc5
# Parent b74cc1842025ad42fab3f45cbccb0dca432f733c
graph: own style for line to obsolescence parents

diff -r b74cc1842025 -r af575fc2cc60 tortoisehg/hgqt/graph.py
--- a/tortoisehg/hgqt/graph.py Die Nov 05 17:55:49 2013 +0100
+++ b/tortoisehg/hgqt/graph.py Die Nov 05 19:11:38 2013 +0100
@@ -34,6 +34,7 @@

LINE_TYPE_PARENT = 0
LINE_TYPE_GRAFT = 1
+LINE_TYPE_OBSOLETE = 2

def revision_grapher(repo, **opts):
"""incremental revision grapher
@@ -143,7 +144,7 @@
for octx in obsoleteutil.first_known_precursors(ctx):
src_rev = octx.rev()
if stop_rev <= src_rev < curr_rev and not hidden(src_rev):
- parents.append((src_rev, LINE_TYPE_GRAFT))
+ parents.append((src_rev, LINE_TYPE_OBSOLETE))
parents_to_add = []
links_to_add = []
children_to_add = []
diff -r b74cc1842025 -r af575fc2cc60 tortoisehg/hgqt/repomodel.py
--- a/tortoisehg/hgqt/repomodel.py Die Nov 05 17:55:49 2013 +0100
+++ b/tortoisehg/hgqt/repomodel.py Die Nov 05 19:11:38 2013 +0100
@@ -23,7 +23,7 @@
from tortoisehg.util import hglib
from tortoisehg.hgqt.graph import Graph
from tortoisehg.hgqt.graph import revision_grapher
-from tortoisehg.hgqt.graph import LINE_TYPE_GRAFT
+from tortoisehg.hgqt.graph import LINE_TYPE_GRAFT, LINE_TYPE_OBSOLETE
from tortoisehg.hgqt import qtlib

from tortoisehg.hgqt.i18n import _
@@ -77,10 +77,12 @@
def get_style(line_type, active):
if line_type == LINE_TYPE_GRAFT:
return Qt.DashLine
+ if line_type == LINE_TYPE_OBSOLETE:
+ return Qt.DotLine
return Qt.SolidLine

def get_width(line_type, active):
- if line_type == LINE_TYPE_GRAFT or not active:
+ if line_type >= LINE_TYPE_GRAFT or not active:
return 1
return 2
Simon Heimberg
2013-11-19 00:35:50 UTC
Permalink
# HG changeset patch
# User Simon Heimberg <***@besonet.ch>
# Date 1383670549 -3600
# Node ID b74cc1842025ad42fab3f45cbccb0dca432f733c
# Parent 4f552e6b42f86264d9a47030e1ac17caf2d00390
graph: graph can show a line to obsolescence parents

diff -r 4f552e6b42f8 -r b74cc1842025 tortoisehg/hgqt/graph.py
--- a/tortoisehg/hgqt/graph.py Sam Nov 02 15:32:17 2013 +0900
+++ b/tortoisehg/hgqt/graph.py Die Nov 05 17:55:49 2013 +0100
@@ -30,6 +30,8 @@

from mercurial import repoview

+from tortoiseh.util import obsoleteutil
+
LINE_TYPE_PARENT = 0
LINE_TYPE_GRAFT = 1

@@ -132,12 +134,16 @@
# Add parents to next_revs.
parents = [(p.rev(), LINE_TYPE_PARENT) for p in getparents(ctx)
if not hidden(p.rev())]
- if showgraftsource and 'source' in ctx.extra():
- src_rev_str = ctx.extra()['source']
- if src_rev_str in repo:
+ if showgraftsource:
+ src_rev_str = ctx.extra().get('source')
+ if src_rev_str is not None and src_rev_str in repo:
src_rev = repo[src_rev_str].rev()
if stop_rev <= src_rev < curr_rev and not hidden(src_rev):
parents.append((src_rev, LINE_TYPE_GRAFT))
+ for octx in obsoleteutil.first_known_precursors(ctx):
+ src_rev = octx.rev()
+ if stop_rev <= src_rev < curr_rev and not hidden(src_rev):
+ parents.append((src_rev, LINE_TYPE_GRAFT))
parents_to_add = []
links_to_add = []
children_to_add = []
Yuya Nishihara
2013-11-19 16:20:14 UTC
Permalink
Post by Simon Heimberg
# HG changeset patch
# Date 1383670549 -3600
# Node ID b74cc1842025ad42fab3f45cbccb0dca432f733c
# Parent 4f552e6b42f86264d9a47030e1ac17caf2d00390
graph: graph can show a line to obsolescence parents
diff -r 4f552e6b42f8 -r b74cc1842025 tortoisehg/hgqt/graph.py
--- a/tortoisehg/hgqt/graph.py Sam Nov 02 15:32:17 2013 +0900
+++ b/tortoisehg/hgqt/graph.py Die Nov 05 17:55:49 2013 +0100
@@ -30,6 +30,8 @@
from mercurial import repoview
+from tortoiseh.util import obsoleteutil
+ "g" ;)
Yuya Nishihara
2014-01-11 06:48:43 UTC
Permalink
Post by Yuya Nishihara
Post by Simon Heimberg
# HG changeset patch
# Date 1383670549 -3600
# Node ID b74cc1842025ad42fab3f45cbccb0dca432f733c
# Parent 4f552e6b42f86264d9a47030e1ac17caf2d00390
graph: graph can show a line to obsolescence parents
diff -r 4f552e6b42f8 -r b74cc1842025 tortoisehg/hgqt/graph.py
--- a/tortoisehg/hgqt/graph.py Sam Nov 02 15:32:17 2013 +0900
+++ b/tortoisehg/hgqt/graph.py Die Nov 05 17:55:49 2013 +0100
@@ -30,6 +30,8 @@
from mercurial import repoview
+from tortoiseh.util import obsoleteutil
+ "g" ;)
Pushed the fixed version to default.
Yuya Nishihara
2014-01-11 06:57:33 UTC
Permalink
(resend with CC: thg-dev)
Post by Yuya Nishihara
Post by Simon Heimberg
# HG changeset patch
# Date 1383670549 -3600
# Node ID b74cc1842025ad42fab3f45cbccb0dca432f733c
# Parent 4f552e6b42f86264d9a47030e1ac17caf2d00390
graph: graph can show a line to obsolescence parents
diff -r 4f552e6b42f8 -r b74cc1842025 tortoisehg/hgqt/graph.py
--- a/tortoisehg/hgqt/graph.py Sam Nov 02 15:32:17 2013 +0900
+++ b/tortoisehg/hgqt/graph.py Die Nov 05 17:55:49 2013 +0100
@@ -30,6 +30,8 @@
from mercurial import repoview
+from tortoiseh.util import obsoleteutil
+ "g" ;)
Pushed the fixed version to default.

Simon Heimberg
2013-11-19 00:35:52 UTC
Permalink
# HG changeset patch
# User Simon Heimberg <***@besonet.ch>
# Date 1384204372 -3600
# Node ID 9ef9dd7033d5d0248fa59cfb7d41a6f11dd42864
# Parent af575fc2cc609800e5e8ba5df45d2e91a04cecc5
graph: only draw one line to one parent

Because the parents originate from multiple soucres it is theoretically possible
that several point to the same revision. Only take the first of this (which is
graftsource because it is added before).

diff -r af575fc2cc60 -r 9ef9dd7033d5 tortoisehg/hgqt/graph.py
--- a/tortoisehg/hgqt/graph.py Die Nov 05 19:11:38 2013 +0100
+++ b/tortoisehg/hgqt/graph.py Mon Nov 11 22:12:52 2013 +0100
@@ -154,6 +154,8 @@
preferred_color = curcolor
for parent, link_type in parents:
if parent not in next_revs:
+ if parent in parents_to_add:
+ continue
parents_to_add.append(parent)
links_to_add.append(link_type)
children_to_add.append((curr_rev,))
Yuya Nishihara
2013-11-19 16:20:37 UTC
Permalink
Post by Simon Heimberg
# HG changeset patch
# Date 1383675098 -3600
# Node ID af575fc2cc609800e5e8ba5df45d2e91a04cecc5
# Parent b74cc1842025ad42fab3f45cbccb0dca432f733c
graph: own style for line to obsolescence parents
diff -r b74cc1842025 -r af575fc2cc60 tortoisehg/hgqt/graph.py
--- a/tortoisehg/hgqt/graph.py Die Nov 05 17:55:49 2013 +0100
+++ b/tortoisehg/hgqt/graph.py Die Nov 05 19:11:38 2013 +0100
@@ -34,6 +34,7 @@
LINE_TYPE_PARENT = 0
LINE_TYPE_GRAFT = 1
+LINE_TYPE_OBSOLETE = 2
"""incremental revision grapher
@@ -143,7 +144,7 @@
src_rev = octx.rev()
- parents.append((src_rev, LINE_TYPE_GRAFT))
+ parents.append((src_rev, LINE_TYPE_OBSOLETE))
parents_to_add = []
links_to_add = []
children_to_add = []
diff -r b74cc1842025 -r af575fc2cc60 tortoisehg/hgqt/repomodel.py
--- a/tortoisehg/hgqt/repomodel.py Die Nov 05 17:55:49 2013 +0100
+++ b/tortoisehg/hgqt/repomodel.py Die Nov 05 19:11:38 2013 +0100
@@ -23,7 +23,7 @@
from tortoisehg.util import hglib
from tortoisehg.hgqt.graph import Graph
from tortoisehg.hgqt.graph import revision_grapher
-from tortoisehg.hgqt.graph import LINE_TYPE_GRAFT
+from tortoisehg.hgqt.graph import LINE_TYPE_GRAFT, LINE_TYPE_OBSOLETE
Maybe it's time to "import graph" ?
Post by Simon Heimberg
from tortoisehg.hgqt import qtlib
from tortoisehg.hgqt.i18n import _
@@ -77,10 +77,12 @@
return Qt.DashLine
+ return Qt.DotLine
I didn't follow the discussion about the rendering of the obsolete changes.
I guess Angel and Peer know a lot about it.

Regards,
Loading...