This is an archive of the discontinued Mercurial Phabricator instance.

log: respect graphshorten on terminal nodes (collapsing o-~ to just o~)
ClosedPublic

Authored by spectral on Aug 23 2018, 4:33 PM.

Details

Summary

Internally we have a custom template that's inspired by ones that we have seen
in the community. Normally, this looks something like:

o  0834ec17 spectral tip
|  crecord: support x to toggle single, X to toggle a range
o  ee932990 spectral @
|  filemerge: allow specifying $hgeditor as merge-tools.X.executable
@  66f04611 matt_harbison
|  cext: fix truncation warnings in revlog on Windows
o  42cc76d0 matt_harbison
|  cext: fix revlog compiler error on Windows
~
o  bd63ada7 stable boris
|  phases: drop dead code in `newheads`
~

With graphshorten on, and the descriptions of the public nodes hidden, it looks
like this, note that the commits right before the ~ are still "full height":

o  0834ec17 spectral tip
|  crecord: support x to toggle single, X to toggle a range
o  ee932990 spectral @
|  filemerge: allow specifying $hgeditor as merge-tools.X.executable
@  66f04611 matt_harbison
o  42cc76d0 matt_harbison
|
~
o  bd63ada7 stable boris
|
~

This patch makes them look like this, removing the | but keeping the ~:

o  0834ec17 spectral tip
|  crecord: support x to toggle single, X to toggle a range
o  ee932990 spectral @
|  filemerge: allow specifying $hgeditor as merge-tools.X.executable
@  66f04611 matt_harbison
o  42cc76d0 matt_harbison
~
o  bd63ada7 stable boris
~

This originally removed the ~s entirely, but this was determined to be too much
information loss and potentially confusing. This would have looked like the
following (note that the last commit is on a different branch than all of the
ones above it, and they are *not* linearly related):

o  0834ec17 spectral tip
|  crecord: support x to toggle single, X to toggle a range
o  ee932990 spectral @
|  filemerge: allow specifying $hgeditor as merge-tools.X.executable
@  66f04611 matt_harbison
o  42cc76d0 matt_harbison
o  bd63ada7 stable boris

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

spectral created this revision.Aug 23 2018, 4:33 PM
spectral updated this revision to Diff 10539.Aug 23 2018, 4:37 PM

Since this touches hg show work test output, I've added indygreg as an explicit reviewer.

Can we have a test for this?

mercurial/graphmod.py
301–302

Since it's just the single | line that goes away with this patch, why does minlines change by 2 and not by 1?

Can we have a test for this?

Oh, sorry, there are updated tests (my browser tab was stale when I reviewed this). That also explains why two minlines changed by 2: the ~ is also removed, which I didn't expect. I think I would like to have the ~ in there. Without them, it may look like two independent branches come in sequence, no?

Can we have a test for this?

Oh, sorry, there are updated tests (my browser tab was stale when I reviewed this). That also explains why two minlines changed by 2: the ~ is also removed, which I didn't expect. I think I would like to have the ~ in there. Without them, it may look like two independent branches come in sequence, no?

Yes, it might. I kinda went back and forth on this, as you probably saw on the FR from our users; I came to the conclusion that those using graphshorten are already losing : vs | distinctions, so seems to already be opting in to potentially misleading graphs. When I realized that hg show work also used graphshorten and this wasn't an explicit choice by the user, I was less sure on this and requested input from indygreg. If we agree that we need the ~ by default, I can easily add it back. Having never used hg show work, doing most of my changes in a repo where we don't really have branches that would cause this to be confusing, and that we have the branch name in the compact log format that I showed in the commit description, I don't think I'm a good judge of the importance of the ~ in these cases :)

Can we have a test for this?

Oh, sorry, there are updated tests (my browser tab was stale when I reviewed this). That also explains why two minlines changed by 2: the ~ is also removed, which I didn't expect. I think I would like to have the ~ in there. Without them, it may look like two independent branches come in sequence, no?

Yes, it might. I kinda went back and forth on this, as you probably saw on the FR from our users; I came to the conclusion that those using graphshorten are already losing : vs | distinctions, so seems to already be opting in to potentially misleading graphs. When I realized that hg show work also used graphshorten and this wasn't an explicit choice by the user, I was less sure on this and requested input from indygreg. If we agree that we need the ~ by default, I can easily add it back. Having never used hg show work, doing most of my changes in a repo where we don't really have branches that would cause this to be confusing, and that we have the branch name in the compact log format that I showed in the commit description, I don't think I'm a good judge of the importance of the ~ in these cases :)

I feel pretty strongly that making a non-linear graph appear linear is much more misleading than eliding intermediate nodes, so I'd really like the ~ back.

spectral edited the summary of this revision. (Show Details)Aug 23 2018, 8:50 PM
spectral retitled this revision from log: respect graphshorten on terminal nodes (collapsing o-~ to just o) to log: respect graphshorten on terminal nodes (collapsing o-~ to just o~).
spectral updated this revision to Diff 10540.

Can we have a test for this?

Oh, sorry, there are updated tests (my browser tab was stale when I reviewed this). That also explains why two minlines changed by 2: the ~ is also removed, which I didn't expect. I think I would like to have the ~ in there. Without them, it may look like two independent branches come in sequence, no?

Yes, it might. I kinda went back and forth on this, as you probably saw on the FR from our users; I came to the conclusion that those using graphshorten are already losing : vs | distinctions, so seems to already be opting in to potentially misleading graphs. When I realized that hg show work also used graphshorten and this wasn't an explicit choice by the user, I was less sure on this and requested input from indygreg. If we agree that we need the ~ by default, I can easily add it back. Having never used hg show work, doing most of my changes in a repo where we don't really have branches that would cause this to be confusing, and that we have the branch name in the compact log format that I showed in the commit description, I don't think I'm a good judge of the importance of the ~ in these cases :)

I feel pretty strongly that making a non-linear graph appear linear is much more misleading than eliding intermediate nodes, so I'd really like the ~ back.

I tried to find a sane way of determining if we were at the end of the graph and eliding that ~, at least, but couldn't figure it out. Done: all of the ~s are back.

spectral updated this revision to Diff 10541.Aug 23 2018, 9:12 PM
martinvonz accepted this revision.Aug 24 2018, 1:11 PM

LGTM, but I'll let a non-Googler queue it in case it seems controversial to others.

pulkit accepted this revision.Aug 27 2018, 9:42 AM
This revision was automatically updated to reflect the committed changes.