#2589 history query by key
Merged 4 years ago by tkopecek. Opened 4 years ago by mikem.
mikem/koji extra-history  into  master

file modified
+2 -1
@@ -4476,6 +4476,7 @@ 

      parser.add_option("--group", help=_("Only show entries relating to a given group"))

      parser.add_option("--host", help=_("Only show entries related to given host"))

      parser.add_option("--channel", help=_("Only show entries related to given channel"))

+     parser.add_option("--xkey", help=_("Only show entries related to given tag extra key"))

      parser.add_option("--before", type="time",

                        help=_("Only show entries before this time, ") + TimeOption.get_help())

      parser.add_option("--after", type="time",
@@ -4502,7 +4503,7 @@ 

      limited = False

      for opt in ('package', 'tag', 'build', 'editor', 'user', 'permission',

                  'cg', 'external_repo', 'build_target', 'group', 'before',

-                 'after', 'host', 'channel'):

+                 'after', 'host', 'channel', 'xkey'):

          val = getattr(options, opt)

          if val:

              kwargs[opt] = val

file modified
+6
@@ -7847,6 +7847,12 @@ 

                  clauses.append(' OR '.join([c_test, r_test]))

                  fields[c_test] = '_created_before_event'

                  fields[r_test] = '_revoked_before_event'

+             elif arg == 'xkey':

+                 if 'key' not in table_fields[table]:

+                     skip = True

+                     break

+                 data['key'] = str(value)

+                 clauses.append("%s.key = %%(key)s" % table)

          if skip:

              continue

          fields, aliases = zip(*fields.items())

At times I've wanted to query history only for a specific tag extra key (e.g. rpm.macro.dist). This enables that.

I'm a little confused by the help text about "related to given key". Can we say "related to a given tag extra key"?

(Ie, no other "keys" on other tables, and not GPG "keys")

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

4 years ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

4 years ago

I'm a little confused by the help text about "related to given key". Can we say "related to a given tag extra key"?

good point. Perhaps it is even worth using --xkey instead?

1 new commit added

  • rename arg
4 years ago

rebased onto c3a4f08

4 years ago

Any strong opinions on --key vs --xkey?

ok, let's go with xkey to reduce chance of confusion

Metadata Update from @mikem:
- Pull-request untagged with: testing-done

4 years ago

Sounds good to me. I think as long as --help makes it clear, it will help new users

Please modify also command help string and not only option help string, thanks.

@mfilip What do you mean here? There is no mention of this option in command help string? (https://pagure.io/koji/blob/master/f/cli/koji_cli/commands.py#_4458)

@tkopecek Sorry I overlooked it, it's ok

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

4 years ago

Commit 26ea01a fixes this pull-request

Pull-Request has been merged by tkopecek

4 years ago