D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Thanks for the assist, @smf ! I appreciate it.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral, indygreg
Cc: quark, spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  朗
  
  Next patch, emoji!

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral, indygreg
Cc: quark, spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Thanks for the concrete feedback. I've uploaded a new diff. The 
(EXPERIMENTAL) tag has been added and I am now using `hg export` to generate 
the diff.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral, indygreg
Cc: quark, spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  I don’t disagree with your premise, but the comments section of this patch 
are not really the right venue for this discussion.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: quark, spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Looks like your font is missing the dashed vertical line, and has an oddly 
small regular-circle glyph. I don't recognize the font at all so I can't really 
speak much more to that. Fortunately though...
  
  (a) it's an extension which isn't on by default
  (b) your font choices are your own. That doesn't look like any default font 
I've ever seen, so this is unlikely to affect many others
  
  I cannot possibly promise that this extension will look good in every OS, 
font and terminal. That's not a reasonable goal. If I thought looking perfect 
everywhere was an option, I'd be patching the mainline graph view instead of 
making an extension that opts-out by default.
  
  Do you have any ideas to improve the situation? There has been plenty of font 
discussion in the thread already; this is not really covering any new ground.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: quark, spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  For what it's worth, it works great on Linux, so no need to feel sad. That's 
my primary dev environment.  If you aren't interested in actually testing the 
extension itself I'm not sure why you are posting here, but thank you for the 
feedback about `type con` issues with UTF8 on Windows.  It was very elucidating.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: quark, spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Can you provide a screenshot of the actual Windows behavior?

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: quark, spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Are you capable of running the extension?
  
  The output of `type` is irrelevant to me. The behavior of python.exe when 
outputting to the Windows shell is all that really matters here. If 
`encoding.encoding` reports UTF8, it should work or there's an Hg issue. If it 
reports something else, the extension will disable itself anyway.
  
  In https://phab.mercurial-scm.org/D3665#58863, @quark wrote:
  
  > In https://phab.mercurial-scm.org/D3665#58862, @johnstiles wrote:
  >
  > > Without more context I have no idea what you are trying to show. Windows 
is
  > >  certainly capable of rendering Unicode characters in the console. It is
  > >  also very possible to get ? characters if you're running a
  > >  non-Unicode-aware tool or if there are encoding mix-up issues. "type con"
  > >  and pasting in text from a text editor doesn't really prove anything one
  > >  way or the other. (What editor? What encoding did it think the data was?
  > >  How does "type con" handle Unicode text? etc.)
  > >
  > > Run the actual hgext and take a screenshot of what it generates if you 
want
  > >  to give a more useful data point for us.
  >
  >
  > Copy-pasting would render utf-8 characters correctly if the font supports 
them. It does not seem to be related to the current codepage.
  >
  > I edited the screenshot to show an explicit `type a-utf-8-file` with 
"utf-8" (65001) codepage, with different fonts.
  >
  > Note: Mercurial will raise "unknown encoding: cp65001" in this case so it's 
probably safe if you have the `encoding.encoding != 'utf8'` check. But anything 
rendered using the utf-8 characters (be it from "git bash hg -G ... > a.txt" or 
whatever POSIX-like shells) will render sub-optimally in cmd.exe.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: quark, spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  What are you trying to demonstrate here? I'm lost.
  
  In https://phab.mercurial-scm.org/D3665#58858, @quark wrote:
  
  > Maybe I should change cmd.exe font. But here's what I got pasting the text 
into the console:
  >
  > F103261: cmd.png 

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: quark, spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-15 Thread johnstiles (John Stiles)
johnstiles added a comment.


  In https://phab.mercurial-scm.org/D3665#58828, @smf wrote:
  
  > I've looked this over today and have queued this up :-) Unfortunately, 
though, the metadata doesn't seem right? I'm not getting your name or email 
(nor timestamp) for the patch. Do you want me to use the same name from 
https://phab.mercurial-scm.org/rHG24e517600b2986a3d5855456b3cdf0830ea0a79e 
(John Stiles )?
  
  
  That's perfect, thanks!
  The diff came from `hg diff --git` so maybe hg's git-diff emulation mode is 
lacking those fields.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-14 Thread johnstiles (John Stiles)
johnstiles added a comment.


  I have put together an album of various fonts from my discussions with @yuja 
earlier in the thread: https://imgur.com/a/xFkj4zv
  
  I'm a Menlo or DejaVu guy myself.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-14 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Side note: I'm unfamiliar with the lingo here, what's +0 on a feature? 
Indifference?

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-14 Thread johnstiles (John Stiles)
johnstiles added a comment.


  It all depends on your terminal font. It looks like the font you're using now 
has issues with U+2506 ┆ and is otherwise working as expected.
  
  Most likely it is rendering ┆ as full-width instead of narrow-width. I'm 
almost positive this issue is fixable if you are willing to experiment with a 
different font or Terminal settings, because I've never seen that particular 
artifact. Usually it's been the circle glyphs that want to render over-wide. :)
  
  If you are willing to experiment with it, there are a bunch of very similar 
glyphs that we could swap out and use instead if you think it would help the 
general case. (https://unicode-search.net/unicode-namesearch.pl?term=DASH) I'm 
certainly willing to explore it, but it would help to know a little more detail 
about your current setup (Terminal? Font? OS?) to see if I can repro the issue 
locally and see whether this would actually be widespread.
  
  Broader picture: on the whole I think we can pick a really good starting 
point that works for the vast majority of users' setups, but we are unlikely to 
land on a 100% solution for all fonts and terminals. Some fonts just look bad 
or won't align perfectly. Some layouts will still have little gaps in them 
where Unicode doesn't provide the box characters we need for a perfect layout. 
On the other hand, the existing ASCII mode looks unaligned and goofy on all 
machines all of the time, so having an optional mode that looks better for most 
users is still a step in the right direction :)
  
  Additional thoughts: I would love to add features to this patch, such as 
glyph customizability or even color coding. I can certainly get it done in a 
followup. On the other hand, I don't want to sink tons of free time into the 
process it if I can't get this simple version through review. This is a 
spare-time project for me and I don't need to add flexibility options if it's 
only ever going to exist on my PC. I'd like to at least get a foothold in, then 
work on improvements once this has landed, instead of working for weeks just to 
risk having the feature rejected at the end of the process and having nothing 
to show for it.
  
  In https://phab.mercurial-scm.org/D3665#58616, @smf wrote:
  
  > johnstiles (John Stiles)  writes:
  >
  > > johnstiles added a comment.
  > > 
  > >   Hi there @indygreg and @yuja  -- are you happy with the diff as it 
currently stands? Do you think this needs any additional work?
  >
  > Sorry for the late reply; was having email filtering issues (hopefully
  >  fixed now).
  >
  > Overall, I'm +0 on it because I think the "real" solution to this is to
  >  templatize the graph glpyhs so any user could use whatever unicode they
  >  desire. However, that's a tall order I wouldn't put on you so I'm fine
  >  with putting this in and adding a note along the lines of, "the path to
  >  get this in core is to get the graph log templated."
  >
  > The only hiccup I keep having is the misalignment of graphs like these:
  >
  > Do you think there's any way to fix those? I suspect the answer is "no"
  >  unless someone wants to write their own font?
  >
  > - F102394: signature.asc <https://phab.mercurial-scm.org/F102394>
  >
  >   F102393: Screen Shot 2018-06-14 at 4.01.03 PM.png 
<https://phab.mercurial-scm.org/F102393>
  >
  >   F102392: Screen Shot 2018-06-14 at 4.01.17 PM.png 
<https://phab.mercurial-scm.org/F102392>
  >
  >   F102391: Screen Shot 2018-06-14 at 4.01.25 PM.png 
<https://phab.mercurial-scm.org/F102391>
  >
  >   F102390: Screen Shot 2018-06-14 at 4.00.57 PM.png 
<https://phab.mercurial-scm.org/F102390>
  >
  >   F102389: Screen Shot 2018-06-14 at 4.00.50 PM.png 
<https://phab.mercurial-scm.org/F102389>

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers, spectral
Cc: spectral, indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-08 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Hi there @indygreg and @yuja  -- are you happy with the diff as it currently 
stands? Do you think this needs any additional work?

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-03 Thread johnstiles (John Stiles)
johnstiles added a comment.


  How do the new glyphs look in PuTTY with Deja Vu?
  Is there anything else that you need me to look at in this patch?
  
  Just let me know if there's anything I need to do to keep things progressing. 
:)

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-31 Thread johnstiles (John Stiles)
johnstiles added a comment.


  OK, I've fixed the latest nits in this diff, as well as changing the circle 
characters as discussed to:
  
  U+25CB○ <- changeset
  U+25CC◌ <- obsolete (as before)
  U+25CD◍ <- active

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-30 Thread johnstiles (John Stiles)
johnstiles added a comment.


  I experimented some more in Linux and got some surprisingly different 
outcomes. Fallback rules definitely vary! Anyway, I think these glyphs are 
going to work the best across the widest variety of fonts. They are in the same 
character group so they should all be roughly the same size and shape, and in 
most monospace fonts they are large enough to be visually distinct.
  
  U+25CB○  <- changeset
  U+25CC◌  <- obsolete
  U+25CD◍  <- active
  
  I hope these look good on Windows! :)

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-30 Thread johnstiles (John Stiles)
johnstiles added a comment.


  I'm finding that on OS X, the following two glyphs get good results in almost 
every font, and great results in Menlo and DejaVu Sans Mono. I wish they popped 
a little more in Ubuntu Mono but they are still better than the current 
choices. I'll switch over to Linux now to verify there.
  U+235F⍟
  U+25CB○

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-30 Thread johnstiles (John Stiles)
johnstiles added a comment.


  In https://phab.mercurial-scm.org/D3665#57735, @indygreg wrote:
  
  > I think this is a cool idea! I could nitpick some of the glyph choices 
(e.g. U+233E ⌾ is really small and harder to read than `@` and U+25CC ◌ looks 
like a circle and therefore the standard node type). But overall I like it!
  >
  > We //could// roll this functionality into core pretty easily and put it 
behind an e.g. `ui.graph-unicode` config setting. Or we could find some way to 
templatize the graph characters so people could modify them more easily. Having 
all the edge and node characters hard-coded feels a bit awkward. But I think 
this is scope bloat and shouldn't block this feature from landing. Others may 
have different opinions...
  
  
  The glyphs can vary pretty significantly depending on your OS and font of 
choice. Here's an album of how things render in OS X Terminal: 
https://imgur.com/a/xFkj4zv
  
  I generally use Menlo so it looked great for me during testing, but some of 
the results are underwhelming for sure. Also, I'm not actually convinced my 
terminal is rendering Roboto Mono properly as the box characters don't even 
come close to full height.
  
  That being said, having done this test, I would totally be open to replacing 
⌾ and ◯ . I don't like how large the hollow circle can get relative to the 
double-circle. Please pop this list into your text editor of choice and 
experiment with various monospace fonts to see what works well on your system. 
I will experiment as well.
  
  A few circle choices:
  U+25EF◯   <- today's o
  U+233E⌾   <- today's @
  U+25CC◌   <- today's x
  U+235F⍟
  U+26AC⚬   
  U+25CB○
  U+274D❍   
  U+2689⚉   
  U+23E3⏣
  U+25CF●
  U+29BB⦻
  U+2A37⨷
  U+FFEE○

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-30 Thread johnstiles (John Stiles)
johnstiles added a comment.


  In https://phab.mercurial-scm.org/D3665#57678, @indygreg wrote:
  
  > I installed Dejavu Sans Mono from https://dejavu-fonts.github.io/ and it 
works great!
  
  
  That's great to hear!
  
  How do you like it? It's a pretty simple extension but it definitely 
scratches an itch for me.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-30 Thread johnstiles (John Stiles)
johnstiles added a comment.


  In https://phab.mercurial-scm.org/D3665#57675, @indygreg wrote:
  
  > FWIW, this isn't rendering nicely with PuTTY on Windows 10. The U+25EF ◯ 
glyph is being truncated on the right side. I'm also seeing empty squares for 
U+233E ⌾ and other code points. Using Courier New as the terminal font. 
`LANG=en_US.UTF-8` and `TERM=xterm-256color`, so Mercurial detects the encoding 
as UTF-8.
  >
  > Not a show stopper. But a bit disappointing. I can probably safely blame 
PuTTY/Windows here.
  
  
  I haven't tested in Windows, unfortunately! I've run the extension in OS X 
Terminal and on Linux in xfce4-terminal and it's been fine, but Windows text 
rendering is obviously going to be different :(
  
  Have you experimented with different fonts?

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: indygreg, smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-30 Thread johnstiles (John Stiles)
johnstiles added a comment.


  A proper warning is now issued when the encoding is not UTF-8, or when 
East-Asian ambiguous characters will be rendered as wide characters.
  The tests have been updated to check these warnings.
  Yuya, I believe this should address everything we discussed. Let me know if 
you see a need for any further changes.

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-29 Thread johnstiles (John Stiles)
johnstiles added a comment.


  In https://phab.mercurial-scm.org/D3665#57649, @smf wrote:
  
  > johnstiles (John Stiles)  writes:
  >
  > > johnstiles added a comment.
  > > 
  > >   yuya, I believe these patches should address all of your concerns 
except for `encoding._wide`. I am not sure what your expectation is for that. I 
don't think it would make sense to silently disable the extension if 
`encoding._wide` is set; IMO that would cause user confusion. If a user sees 
that the log lines are not lining up properly, that is easy to understand, 
diagnose and fix (change your Terminal font). If the extension just silently 
doesn't work, that is much harder to fix.
  > >   
  > >   Let me know if you see anything else that you would like addressed! 
Thanks :)
  >
  > Oh, crazy. I just started hacking something like this up last week. I'll
  >  have to check this out.
  >
  > - F93615: signature.asc <https://phab.mercurial-scm.org/F93615>
  
  
  Awesome! Great minds think alike ;)
  
  If you figure out a way to improve the look of diagonal lines transitioning 
into a straight vertical line, let me know... I'm still not in love with those. 
We need more box characters!

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: smf, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-29 Thread johnstiles (John Stiles)
johnstiles added a comment.


  yuya, I believe these patches should address all of your concerns except for 
`encoding._wide`. I am not sure what your expectation is for that. I don't 
think it would make sense to silently disable the extension if `encoding._wide` 
is set; IMO that would cause user confusion. If a user sees that the log lines 
are not lining up properly, that is easy to understand, diagnose and fix 
(change your Terminal font). If the extension just silently doesn't work, that 
is much harder to fix.
  
  Let me know if you see anything else that you would like addressed! Thanks :)

REPOSITORY
  rHG Mercurial

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

To: johnstiles, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-28 Thread johnstiles (John Stiles)
johnstiles updated this revision to Diff 8920.
johnstiles added a comment.


  Corrected indenting issue. (In converting from 2-space to 4-space indents, I 
misaligned this block.)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3665?vs=8919=8920

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

AFFECTED FILES
  hgext/beautifygraph.py

CHANGE DETAILS

diff --git a/hgext/beautifygraph.py b/hgext/beautifygraph.py
--- a/hgext/beautifygraph.py
+++ b/hgext/beautifygraph.py
@@ -34,13 +34,13 @@
 return '\xE2\x94\x9C' # U+251C ├
 if after  == ' ' and not before == ' ':
 return '\xE2\x94\xA4' # U+2524 ┤
-return '\xE2\x94\xBC' # U+253C ┼
-return edge
-line = ' %s ' % line
-pretty = []
-for idx in xrange(len(line) - 2):
-pretty.append(prettyedge(line[idx], line[idx + 1], line[idx + 2]))
-return ''.join(pretty)
+return '\xE2\x94\xBC' # U+253C ┼
+return edge
+line = ' %s ' % line
+pretty = []
+for idx in xrange(len(line) - 2):
+pretty.append(prettyedge(line[idx], line[idx + 1], line[idx + 2]))
+return ''.join(pretty)
 
 def getprettygraphnode(orig, *args, **kwargs):
 node = orig(*args, **kwargs)



To: johnstiles, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-28 Thread johnstiles (John Stiles)
johnstiles updated this revision to Diff 8919.
johnstiles added a comment.


  Addressed warnings found by test-check-code.t.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3665?vs=8918=8919

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

AFFECTED FILES
  hgext/beautifygraph.py

CHANGE DETAILS

diff --git a/hgext/beautifygraph.py b/hgext/beautifygraph.py
--- a/hgext/beautifygraph.py
+++ b/hgext/beautifygraph.py
@@ -2,7 +2,7 @@
 # beautifygraph.py - improve graph output by using Unicode characters
 
 '''This extension beautifies log -G output by using Unicode characters.
-  
+
A terminal with UTF-8 support and a monospace Unicode font are required.
 '''
 
@@ -20,40 +20,42 @@
 testedwith = 'ships-with-hg-core'
 
 def extsetup(ui):
-  def convertedges(line):
-def prettyedge(before, edge, after):
-  if edge == '~':  return '\xE2\x95\xA7' # U+2567 ╧
-  if edge == 'X':  return '\xE2\x95\xB3' # U+2573 ╳
-  if edge == '/':  return '\xE2\x95\xB1' # U+2571 ╱
-  if edge == '-':  return '\xE2\x94\x80' # U+2500 ─
-  if edge == '|':  return '\xE2\x94\x82' # U+2502 │
-  if edge == ':':  return '\xE2\x94\x86' # U+2506 ┆
-  if edge == '\\': return '\xE2\x95\xB2' # U+2572 ╲
-  if edge == '+':
-if before == ' ' and not after  == ' ': return '\xE2\x94\x9C' # U+251C 
├
-if after  == ' ' and not before == ' ': return '\xE2\x94\xA4' # U+2524 
┤
-return '\xE2\x94\xBC' # U+253C ┼
-  return edge
+def convertedges(line):
+def prettyedge(before, edge, after):
+if edge == '~':  return '\xE2\x95\xA7' # U+2567 ╧
+if edge == 'X':  return '\xE2\x95\xB3' # U+2573 ╳
+if edge == '/':  return '\xE2\x95\xB1' # U+2571 ╱
+if edge == '-':  return '\xE2\x94\x80' # U+2500 ─
+if edge == '|':  return '\xE2\x94\x82' # U+2502 │
+if edge == ':':  return '\xE2\x94\x86' # U+2506 ┆
+if edge == '\\': return '\xE2\x95\xB2' # U+2572 ╲
+if edge == '+':
+if before == ' ' and not after  == ' ':
+return '\xE2\x94\x9C' # U+251C ├
+if after  == ' ' and not before == ' ':
+return '\xE2\x94\xA4' # U+2524 ┤
+return '\xE2\x94\xBC' # U+253C ┼
+return edge
 line = ' %s ' % line
-pretty = [];
+pretty = []
 for idx in xrange(len(line) - 2):
-  pretty.append(prettyedge(line[idx], line[idx+1], line[idx+2]))
+pretty.append(prettyedge(line[idx], line[idx + 1], line[idx + 2]))
 return ''.join(pretty)
-  
-  def getprettygraphnode(orig, *args, **kwargs):
-node = orig(*args, **kwargs)
-if node == 'o': return '\xE2\x97\xAF' # U+25EF ◯
-if node == '@': return '\xE2\x8C\xBE' # U+233E ⌾
-if node == '*': return '\xE2\x88\x97' # U+2217 ∗
-if node == 'x': return '\xE2\x97\x8C' # U+25CC ◌
-if node == '_': return '\xE2\x95\xA4' # U+2564 ╤
-return node
 
-  def outputprettygraph(orig, ui, graph, *args, **kwargs):
-if not ui.plain('graph') and encoding.encoding == "UTF-8":
-  (edges, text) = zip(*graph)
-  graph = zip([convertedges(e) for e in edges], text)
-return orig(ui, graph, *args, **kwargs)
+def getprettygraphnode(orig, *args, **kwargs):
+node = orig(*args, **kwargs)
+if node == 'o': return '\xE2\x97\xAF' # U+25EF ◯
+if node == '@': return '\xE2\x8C\xBE' # U+233E ⌾
+if node == '*': return '\xE2\x88\x97' # U+2217 ∗
+if node == 'x': return '\xE2\x97\x8C' # U+25CC ◌
+if node == '_': return '\xE2\x95\xA4' # U+2564 ╤
+return node
 
-  extensions.wrapfunction(graphmod, 'outputgraph', outputprettygraph)
-  extensions.wrapfunction(templatekw, 'getgraphnode', getprettygraphnode)
+def outputprettygraph(orig, ui, graph, *args, **kwargs):
+if not ui.plain('graph') and encoding.encoding == "UTF-8":
+(edges, text) = zip(*graph)
+graph = zip([convertedges(e) for e in edges], text)
+return orig(ui, graph, *args, **kwargs)
+
+extensions.wrapfunction(graphmod, 'outputgraph', outputprettygraph)
+extensions.wrapfunction(templatekw, 'getgraphnode', getprettygraphnode)



To: johnstiles, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-28 Thread johnstiles (John Stiles)
johnstiles updated this revision to Diff 8918.
johnstiles added a comment.


  Converted non-ASCII characters to `\xNN' form for Python 3 compatibility.
  Converted sys.stdout.encoding to encoding.encoding.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3665?vs=8910=8918

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

AFFECTED FILES
  hgext/beautifygraph.py

CHANGE DETAILS

diff --git a/hgext/beautifygraph.py b/hgext/beautifygraph.py
--- a/hgext/beautifygraph.py
+++ b/hgext/beautifygraph.py
@@ -8,7 +8,7 @@
 
 from __future__ import absolute_import
 
-import sys
+from mercurial import encoding
 from mercurial import extensions
 from mercurial import templatekw
 from mercurial import graphmod
@@ -22,17 +22,17 @@
 def extsetup(ui):
   def convertedges(line):
 def prettyedge(before, edge, after):
-  if edge == '~':  return '╧'
-  if edge == 'X':  return '╳'
-  if edge == '/':  return '╱'
-  if edge == '-':  return '─'
-  if edge == '|':  return '│'
-  if edge == ':':  return '┆'
-  if edge == '\\': return '╲'
+  if edge == '~':  return '\xE2\x95\xA7' # U+2567 ╧
+  if edge == 'X':  return '\xE2\x95\xB3' # U+2573 ╳
+  if edge == '/':  return '\xE2\x95\xB1' # U+2571 ╱
+  if edge == '-':  return '\xE2\x94\x80' # U+2500 ─
+  if edge == '|':  return '\xE2\x94\x82' # U+2502 │
+  if edge == ':':  return '\xE2\x94\x86' # U+2506 ┆
+  if edge == '\\': return '\xE2\x95\xB2' # U+2572 ╲
   if edge == '+':
-if before == ' ' and not after  == ' ': return '├'
-if after  == ' ' and not before == ' ': return '┤'
-return '┼'
+if before == ' ' and not after  == ' ': return '\xE2\x94\x9C' # U+251C 
├
+if after  == ' ' and not before == ' ': return '\xE2\x94\xA4' # U+2524 
┤
+return '\xE2\x94\xBC' # U+253C ┼
   return edge
 line = ' %s ' % line
 pretty = [];
@@ -42,15 +42,15 @@
   
   def getprettygraphnode(orig, *args, **kwargs):
 node = orig(*args, **kwargs)
-if node == 'o': return '◯'
-if node == '@': return '⌾'
-if node == '*': return '∗'
-if node == 'x': return '◌'
-if node == '_': return '╤'
+if node == 'o': return '\xE2\x97\xAF' # U+25EF ◯
+if node == '@': return '\xE2\x8C\xBE' # U+233E ⌾
+if node == '*': return '\xE2\x88\x97' # U+2217 ∗
+if node == 'x': return '\xE2\x97\x8C' # U+25CC ◌
+if node == '_': return '\xE2\x95\xA4' # U+2564 ╤
 return node
 
   def outputprettygraph(orig, ui, graph, *args, **kwargs):
-if not ui.plain('graph') and sys.stdout.encoding == "UTF-8":
+if not ui.plain('graph') and encoding.encoding == "UTF-8":
   (edges, text) = zip(*graph)
   graph = zip([convertedges(e) for e in edges], text)
 return orig(ui, graph, *args, **kwargs)



To: johnstiles, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-05-26 Thread johnstiles (John Stiles)
johnstiles created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This extension beautifies log -G output by using Unicode characters.
  
  A terminal with UTF-8 support and a monospace Unicode font are required.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/beautifygraph.py

CHANGE DETAILS

diff --git a/hgext/beautifygraph.py b/hgext/beautifygraph.py
new file mode 100644
--- /dev/null
+++ b/hgext/beautifygraph.py
@@ -0,0 +1,59 @@
+# -*- coding: UTF-8 -*-
+# beautifygraph.py - improve graph output by using Unicode characters
+
+'''This extension beautifies log -G output by using Unicode characters.
+  
+   A terminal with UTF-8 support and a monospace Unicode font are required.
+'''
+
+from __future__ import absolute_import
+
+import sys
+from mercurial import extensions
+from mercurial import templatekw
+from mercurial import graphmod
+
+# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
+# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
+# be specifying the version(s) of Mercurial they are tested with, or
+# leave the attribute unspecified.
+testedwith = 'ships-with-hg-core'
+
+def extsetup(ui):
+  def convertedges(line):
+def prettyedge(before, edge, after):
+  if edge == '~':  return '╧'
+  if edge == 'X':  return '╳'
+  if edge == '/':  return '╱'
+  if edge == '-':  return '─'
+  if edge == '|':  return '│'
+  if edge == ':':  return '┆'
+  if edge == '\\': return '╲'
+  if edge == '+':
+if before == ' ' and not after  == ' ': return '├'
+if after  == ' ' and not before == ' ': return '┤'
+return '┼'
+  return edge
+line = ' %s ' % line
+pretty = [];
+for idx in xrange(len(line) - 2):
+  pretty.append(prettyedge(line[idx], line[idx+1], line[idx+2]))
+return ''.join(pretty)
+  
+  def getprettygraphnode(orig, *args, **kwargs):
+node = orig(*args, **kwargs)
+if node == 'o': return '◯'
+if node == '@': return '⌾'
+if node == '*': return '∗'
+if node == 'x': return '◌'
+if node == '_': return '╤'
+return node
+
+  def outputprettygraph(orig, ui, graph, *args, **kwargs):
+if not ui.plain('graph') and sys.stdout.encoding == "UTF-8":
+  (edges, text) = zip(*graph)
+  graph = zip([convertedges(e) for e in edges], text)
+return orig(ui, graph, *args, **kwargs)
+
+  extensions.wrapfunction(graphmod, 'outputgraph', outputprettygraph)
+  extensions.wrapfunction(templatekw, 'getgraphnode', getprettygraphnode)



To: johnstiles, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3655: graph: add outputgraph() function, called by ascii() to printthe graph to the ui.

2018-05-25 Thread johnstiles (John Stiles)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG24e517600b29: graph: add outputgraph() function, called by 
ascii() to print (authored by johnstiles, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3655?vs==8895

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

AFFECTED FILES
  mercurial/graphmod.py

CHANGE DETAILS

diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
--- a/mercurial/graphmod.py
+++ b/mercurial/graphmod.py
@@ -341,6 +341,22 @@
 'graphshorten': False,
 }
 
+def outputgraph(ui, graph):
+"""outputs an ASCII graph of a DAG
+
+this is a helper function for 'ascii' below.
+
+takes the following arguments:
+
+- ui to write to
+- graph data: list of { graph nodes/edges, text }
+
+this function can be monkey-patched by extensions to alter graph display
+without needing to mimic all of the edge-fixup logic in ascii()
+"""
+for (ln, logstr) in graph:
+ui.write((ln + logstr).rstrip() + "\n")
+
 def ascii(ui, state, type, char, text, coldata):
 """prints an ASCII graph of the DAG
 
@@ -469,9 +485,8 @@
 
 # print lines
 indentation_level = max(ncols, ncols + coldiff)
-for (line, logstr) in zip(lines, text):
-ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr)
-ui.write(ln.rstrip() + '\n')
+lines = ["%-*s " % (2 * indentation_level, "".join(line)) for line in 
lines]
+outputgraph(ui, zip(lines, text))
 
 # ... and start over
 state['lastcoldiff'] = coldiff



To: johnstiles, #hg-reviewers, spectral, pulkit
Cc: spectral, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3655: graph: add outputgraph() function, called by ascii() to printthe graph to the ui.

2018-05-25 Thread johnstiles (John Stiles)
johnstiles created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This allows a cleaner entrypoint for extensions to tweak the
  graph output without needing to rewrite all of ascii(), or needing
  to manually guess where the graph nodes/edges end and the rev
  note portion begins.
  
  This patch does not affect graph output or behavior in any way.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/graphmod.py

CHANGE DETAILS

diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
--- a/mercurial/graphmod.py
+++ b/mercurial/graphmod.py
@@ -341,6 +341,22 @@
 'graphshorten': False,
 }
 
+def outputgraph(ui, graph):
+"""outputs an ASCII graph of a DAG
+
+this is a helper function for 'ascii' below.
+
+takes the following arguments:
+
+- ui to write to
+- graph data: list of { graph nodes/edges, text }
+
+this function can be monkey-patched by extensions to alter graph display
+without needing to mimic all of the edge-fixup logic in ascii()
+"""
+for (ln, logstr) in graph:
+ui.write((ln + logstr).rstrip() + "\n")
+
 def ascii(ui, state, type, char, text, coldata):
 """prints an ASCII graph of the DAG
 
@@ -469,9 +485,8 @@
 
 # print lines
 indentation_level = max(ncols, ncols + coldiff)
-for (line, logstr) in zip(lines, text):
-ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr)
-ui.write(ln.rstrip() + '\n')
+lines = ["%-*s " % (2 * indentation_level, "".join(line)) for line in 
lines]
+outputgraph(ui, zip(lines, text))
 
 # ... and start over
 state['lastcoldiff'] = coldiff



To: johnstiles, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel