[PATCH 2 of 3] graphlog: make functions private, fix names

Patrick Mezard patrick at mezard.eu
Wed Jul 11 11:42:18 CDT 2012


# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1342019421 -7200
# Node ID 63669b770c3bc8fcea6e11d0d2747ff8fe21e7c0
# Parent  43fde8e57caecc71e0b566d32f8531810f446ab7
graphlog: make functions private, fix names

diff --git a/hgext/graphlog.py b/hgext/graphlog.py
--- a/hgext/graphlog.py
+++ b/hgext/graphlog.py
@@ -66,12 +66,12 @@
     seen[:] = nextseen
     yield (type, char, lines, (nodeidx, edges, ncols, nmorecols))
 
-def fix_long_right_edges(edges):
+def _fixlongrightedges(edges):
     for (i, (start, end)) in enumerate(edges):
         if end > start:
             edges[i] = (start, end + 1)
 
-def get_nodeline_edges_tail(
+def _getnodelineedgestail(
         node_index, p_node_index, n_columns, n_columns_diff, p_diff, fix_tail):
     if fix_tail and n_columns_diff == p_diff and n_columns_diff != 0:
         # Still going in the same non-vertical direction.
@@ -85,7 +85,7 @@
     else:
         return ["|", " "] * (n_columns - node_index - 1)
 
-def draw_edges(edges, nodeline, interline):
+def _drawedges(edges, nodeline, interline):
     for (start, end) in edges:
         if start == end + 1:
             interline[2 * end + 1] = "/"
@@ -103,7 +103,7 @@
                 if nodeline[i] != "+":
                     nodeline[i] = "-"
 
-def get_padding_line(ni, n_columns, edges):
+def _getpaddingline(ni, n_columns, edges):
     line = []
     line.extend(["|", " "] * ni)
     if (ni, ni - 1) in edges or (ni, ni) in edges:
@@ -154,7 +154,7 @@
         #     o | |  into  o---+
         #     |X /         |/ /
         #     | |          | |
-        fix_long_right_edges(edges)
+        _fixlongrightedges(edges)
 
     # add_padding_line says whether to rewrite
     #
@@ -180,8 +180,8 @@
     nodeline.extend([char, " "])
 
     nodeline.extend(
-        get_nodeline_edges_tail(idx, state[1], ncols, coldiff,
-                                state[0], fix_nodeline_tail))
+        _getnodelineedgestail(idx, state[1], ncols, coldiff,
+                              state[0], fix_nodeline_tail))
 
     # shift_interline is the line containing the non-vertical
     # edges between this entry and the next
@@ -199,12 +199,12 @@
     shift_interline.extend([edge_ch, " "] * (ncols - idx - 1))
 
     # draw edges from the current node to its parents
-    draw_edges(edges, nodeline, shift_interline)
+    _drawedges(edges, nodeline, shift_interline)
 
     # lines is the list of all graph lines to print
     lines = [nodeline]
     if add_padding_line:
-        lines.append(get_padding_line(idx, ncols, edges))
+        lines.append(_getpaddingline(idx, ncols, edges))
     lines.append(shift_interline)
 
     # make sure that there are as many graph lines as there are
@@ -226,7 +226,7 @@
     state[0] = coldiff
     state[1] = idx
 
-def check_unsupported_flags(pats, opts):
+def _checkunsupportedflags(pats, opts):
     for op in ["newest_first"]:
         if op in opts and opts[op]:
             raise util.Abort(_("-G/--graph option is incompatible with --%s")
@@ -536,7 +536,7 @@
     directory.
     """
 
-    check_unsupported_flags([], opts)
+    _checkunsupportedflags([], opts)
     o = hg._outgoing(ui, repo, dest, opts)
     if o is None:
         return
@@ -558,7 +558,7 @@
     def subreporecurse():
         return 1
 
-    check_unsupported_flags([], opts)
+    _checkunsupportedflags([], opts)
     def display(other, chlist, displayer):
         revdag = graphrevs(other, chlist, opts)
         showparents = [ctx.node() for ctx in repo[None].parents()]


More information about the Mercurial-devel mailing list