mercurial/graphmod.py
changeset 28891 ac30adb260ea
parent 28627 d7af9b4ae7dd
child 28998 f303b569134c
equal deleted inserted replaced
28890:468339891670 28891:ac30adb260ea
   541         'seen': [],
   541         'seen': [],
   542         'edges': {},
   542         'edges': {},
   543         'lastcoldiff': 0,
   543         'lastcoldiff': 0,
   544         'lastindex': 0,
   544         'lastindex': 0,
   545         'styles': EDGES.copy(),
   545         'styles': EDGES.copy(),
       
   546         'graphshorten': False,
   546     }
   547     }
   547 
   548 
   548 def ascii(ui, state, type, char, text, coldata):
   549 def ascii(ui, state, type, char, text, coldata):
   549     """prints an ASCII graph of the DAG
   550     """prints an ASCII graph of the DAG
   550 
   551 
   628 
   629 
   629     # lines is the list of all graph lines to print
   630     # lines is the list of all graph lines to print
   630     lines = [nodeline]
   631     lines = [nodeline]
   631     if add_padding_line:
   632     if add_padding_line:
   632         lines.append(_getpaddingline(echars, idx, ncols, edges))
   633         lines.append(_getpaddingline(echars, idx, ncols, edges))
   633     lines.append(shift_interline)
   634 
       
   635     # If 'graphshorten' config, only draw shift_interline
       
   636     # when there is any non vertical flow in graph.
       
   637     if state['graphshorten']:
       
   638         if any(c in '\/' for c in shift_interline if c):
       
   639             lines.append(shift_interline)
       
   640     # Else, no 'graphshorten' config so draw shift_interline.
       
   641     else:
       
   642         lines.append(shift_interline)
   634 
   643 
   635     # make sure that there are as many graph lines as there are
   644     # make sure that there are as many graph lines as there are
   636     # log strings
   645     # log strings
   637     extra_interline = echars[:(ncols + coldiff) * 2]
   646     extra_interline = echars[:(ncols + coldiff) * 2]
   638     if len(lines) < len(text):
   647     if len(lines) < len(text):