#1120 Show inheritance flags in list-tag-inheritance output
Merged 4 years ago by tkopecek. Opened 5 years ago by mikem.

file modified
+4 -13
@@ -40,7 +40,7 @@ 

          _unique_path, _running_in_bg, _progress_callback, watch_tasks, \

          arg_filter, linked_upload, list_task_output_all_volumes, \

          print_task_headers, print_task_recurse, download_file, watch_logs, \

-         error, greetings, _list_tasks, unique_path

+         error, greetings, _list_tasks, unique_path, format_inheritance_flags

  

  

  def _printable_unicode(s):
@@ -3767,6 +3767,7 @@ 

              sys.stdout.write(_printable_unicode(u'\u2502'))

              outdepth = depth

  

+     sys.stdout.write(format_inheritance_flags(currtag))

      sys.stdout.write(' ' * ((currtag['currdepth'] - outdepth) * 3 - 1))

      if siblings:

          sys.stdout.write(_printable_unicode(u'\u251c'))
@@ -3839,7 +3840,7 @@ 

              parser.error(_("Unknown tag: %s" % options.stop))

          opts['stops'] = {str(tag1): 1}

  

-     sys.stdout.write('%s (%i)\n' % (tag['name'], tag['id']))

+     sys.stdout.write('     %s (%i)\n' % (tag['name'], tag['id']))

      data = session.getFullInheritance(tag['id'], **opts)

      _printInheritance(data, None, opts['reverse'])

  
@@ -4670,17 +4671,7 @@ 

                  print("  %(priority)3i %(external_repo_name)s (%(url)s)" % rinfo)

          print("Inheritance:")

          for parent in session.getInheritanceData(tag, **event_opts):

-             flags = ''

-             for code,expr in (

-                     ('M',parent['maxdepth'] is not None),

-                     ('F',parent['pkg_filter']),

-                     ('I',parent['intransitive']),

-                     ('N',parent['noconfig']),):

-                 if expr:

-                     flags += code

-                 else:

-                     flags += '.'

-             parent['flags'] = flags

+             parent['flags'] = format_inheritance_flags(parent)

              print("  %(priority)-4d %(flags)s %(name)s [%(parent_id)s]" % parent)

              if parent['maxdepth'] is not None:

                  print("    maxdepth: %(maxdepth)s" % parent)

file modified
+15
@@ -649,3 +649,18 @@ 

                  t['sub'] = True

  

      return tasklist

+ 

+ 

+ def format_inheritance_flags(parent):

+     """Return a human readable string of inheritance flags"""

+     flags = ''

+     for code,expr in (

+             ('M', parent['maxdepth'] is not None),

+             ('F', parent['pkg_filter']),

+             ('I', parent['intransitive']),

+             ('N', parent['noconfig']),):

+         if expr:

+             flags += code

+         else:

+             flags += '.'

+     return flags

While not often used, tag inheritance can be modified with a few different options (e.g. maxdepth). These options are shown in the taginfo display, but not the list-tag-inheritance display. This patch adds basic indicators to the latter.

Users can be easily confused when these options are in use, so better to make things more visible.

I'm not set on the exact display. I tried a few variations. The 4 character flag display is concise, but doesn't look all that great without alignment. Also, most inheritance lines have no options, so the dots seem repetitive and noisy.

Metadata Update from @mikem:
- Pull-request tagged with: usability

5 years ago

Let me show an example so that folks can see that this looks like

Original (without these changes)

$ koji list-tag-inheritance tag_y
tag_y (198)
  └─tag_a (53)

With current changes:

$ koji list-tag-inheritance tag_y
tag_y (198)
  └─tag_a (53)  M...

(indicates the presence of maxdepth option on the inheritance line)

Another example. No inheritance options in the chain.

$ koji list-tag-inheritance tag_a
tag_a (53)
  ├─tag_b (52)  ....
  └─tag_c (193)  ....
     └─tag_d (194)  ....

I'm not loving the way this looks, but I've so far been unable to come up with a better option that is still compact.

should priority be shown?

should priority be shown?

That would make the display even busier, and the ordering already reflects relative priority.

I guess it could be useful, but I don't think it needs to be part of this PR

Does this look better?

$ koji list-tag-inheritance tag_a_foo
     tag_a_foo (223)
....  └─tag_a (53)
....     ├─tag_b (52)
....     └─tag_c (193)
....        └─tag_d (194)
$ koji list-tag-inheritance tag_y
     tag_y (198)
M...  └─tag_a (53)

Maybe be, it is better. But both approaches work for me.

1 new commit added

  • move flags to front
4 years ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

4 years ago

I prefer having flags at the start as well.

:thumbsup:

Commit 8e54896 fixes this pull-request

Pull-Request has been merged by tkopecek

4 years ago