D360: log: add a "graphwidth" template variable

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Thu Aug 17 09:16:55 EDT 2017


yuja accepted this revision.
yuja added a comment.
This revision is now accepted and ready to land.


  Slightly adjusted the commit message for new version, and queued, thanks.

INLINE COMMENTS

> hooper wrote in cmdutil.py:2557
> There can be many of them.  E.g. in the hg repo it looks like a couple hundred with "hg log --graph -r 'tag()'". It just seems easy enough to hedge against it being expensive, though you might argue premature optimization.

Okay, I guess using a list would be slightly faster in common scenario, but I
have no strong opinion about this.

> graphmod.py:212
>          char = '\\'
>          lines = []
>          nodeidx += 1

Removed this `lines` in flight.

> graphmod.py:227
>      state['edges'].pop(rev, None)
> -    yield (type, char, lines, (nodeidx, edges, ncols, nmorecols))
> +    yield (type, char, width, (nodeidx, edges, ncols, nmorecols))
>  

Perhaps the `width` can be computed from the `coldata` afterwards, but
that wouldn't make much difference.

`width = indentation_level * 2 + 1`

  # graphmod.ascii()
      indentation_level = max(ncols, ncols + coldiff)
      for (line, logstr) in zip(lines, text):
          ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D360

To: hooper, #hg-reviewers, yuja
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list