[MERGE] Tweak log -n UI to support +/- as fully expanded/collapsed

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Jan 30 07:25:43 GMT 2009


>>>>> "Ian" == Ian Clatworthy <ian.clatworthy at internode.on.net> writes:

    Ian> As the most common use cases for log's new -n option are:
    Ian> * show me all levels of nested revisions
    Ian> * show me just the top level

    Ian> I think it's worth having the + and - symbols as aliases
    Ian> for 0 and 1 respectively.

Can you elaborate on that ?

I have several problems with that syntactic sugar:

- '+' and '-' are not shorter than '0' and '1',

- for me they carry a 'relative' meaning (give me a bit more or a
  bit less levels) but you use them as an absolute meaning (give
  me the end of the level range),

- they freak my internal parser '-n+' '-n-' eerk, what does that
  mean ?

BB:comment


    Ian> A small patch enabling this is attached.

    Ian> Ian C.

    Ian> # Bazaar merge directive format 2 (Bazaar 0.90)
    Ian> # revision_id: ian.clatworthy at canonical.com-20090129115707-\
    Ian> #   e41asliblokracye
    Ian> # target_branch: http://people.ubuntu.com/~ianc/bzr/ianc-integration
    Ian> # testament_sha1: a0ea9937e1c7c98d710663e326c494dfe9a0f2a1
    Ian> # timestamp: 2009-01-29 22:06:42 +1000
    Ian> # base_revision_id: pqm at pqm.ubuntu.com-20090129071857-l3ikkrm6b1rx96bx
    Ian> # 
    Ian> # Begin patch
    Ian> === modified file 'NEWS'
    Ian> --- NEWS	2009-01-29 06:31:22 +0000
    Ian> +++ NEWS	2009-01-29 11:57:07 +0000
    Ian> @@ -31,14 +31,14 @@
    Ian>        (Ian Clatworthy, #202331, #227335)
 
    Ian>      * ``bzr log`` supports a new option called ``-n N`` or ``--level N``.
    Ian> -      A value of 0 (zero) means "show all nested merge revisions" while
    Ian> -      a value of 1 (one) means "show just the top level". Values above
    Ian> +      A value of + (or 0) means "show all nested merge revisions" while
    Ian> +      a value of - (or 1) means "show just the top level". Values above
    Ian>        1 can be used to see a limited amount of nesting. That can be
    Ian>        useful for seeing the level or two below PQM submits for example.
    Ian>        To force the ``--short`` and ``--line`` formats to display all nested
    Ian>        merge revisions just like ``--long`` does by default, use a command
    Ian> -      like ``bzr log --short -n0``. To display just the mainline using
    Ian> -      ``--long`` format, ``bzr log --long -n1``.
    Ian> +      like ``bzr log --short -n+``. To display just the mainline using
    Ian> +      ``--long`` format, ``bzr log --long -n-``.
    Ian>        (Ian Clatworthy)
 
    Ian>    IMPROVEMENTS:

    Ian> === modified file 'bzrlib/builtins.py'
    Ian> --- bzrlib/builtins.py	2009-01-29 06:31:22 +0000
    Ian> +++ bzrlib/builtins.py	2009-01-29 11:57:07 +0000
    Ian> @@ -1819,6 +1819,10 @@
 
 
    Ian>  def _parse_levels(s):
    Ian> +    if s == '-':
    Ian> +        return 1
    Ian> +    if s == '+':
    Ian> +        return 0
    Ian>      try:
    Ian>          return int(s)
    Ian>      except ValueError:

You still don't trap negative values so I still think you'd
better use type=int in the option declaration.

    Ian> @@ -1868,7 +1872,7 @@
    Ian>              'log-format',
    Ian>              Option('levels',
    Ian>                     short_name='n',
    Ian> -                   help='Number of levels to display - 0 for all, 1 for flat.',
    Ian> +                   help='Number of levels to display (+ for all, - for flat).',

Ouch, don't hide the meaning for 0 and 1, especially the 0 one.

      Vincent



More information about the bazaar mailing list