#2405 remove deprecated list-tag-history / tagHistory
Merged 2 years ago by tkopecek. Opened 2 years ago by tkopecek.
tkopecek/koji issue2215  into  master

file modified
-67
@@ -4159,73 +4159,6 @@ 

              print('')

  

  

- def anon_handle_list_tag_history(goptions, session, args):

-     "[info] Print a history of tag operations"

-     usage = _("usage: %prog list-tag-history [options]")

-     parser = OptionParser(usage=get_usage_str(usage))

-     # Don't use local debug option, this one stays here for backward compatibility

-     # https://pagure.io/koji/issue/2084

-     parser.add_option("--debug", action="store_true", default=goptions.debug, help=SUPPRESS_HELP)

-     parser.add_option("--build", help=_("Only show data for a specific build"))

-     parser.add_option("--package", help=_("Only show data for a specific package"))

-     parser.add_option("--tag", help=_("Only show data for a specific tag"))

-     parser.add_option("--all", action="store_true",

-                       help=_("Allows listing the entire global history"))

-     (options, args) = parser.parse_args(args)

-     koji.util.deprecated("list-tag-history is deprecated and will be removed in a future version. "

-                          "See: https://pagure.io/koji/issue/836")

- 

-     if len(args) != 0:

-         parser.error(_("This command takes no arguments"))

-     kwargs = {}

-     limited = False

-     if options.package:

-         kwargs['package'] = options.package

-         limited = True

-     if options.tag:

-         kwargs['tag'] = options.tag

-         limited = True

-     if options.build:

-         kwargs['build'] = options.build

-         limited = True

-     if not limited and not options.all:

-         parser.error(_("Please specify an option to limit the query"))

- 

-     ensure_connection(session)

- 

-     hist = session.tagHistory(**kwargs)

-     timeline = []

-     for x in hist:

-         event_id = x['revoke_event']

-         if event_id is not None:

-             timeline.append((event_id, x))

-         event_id = x['create_event']

-         timeline.append((event_id, x))

-     timeline.sort(key=lambda entry: entry[0])

- 

-     def _histline(event_id, x):

-         if event_id == x['revoke_event']:

-             ts = x['revoke_ts']

-             fmt = "%(name)s-%(version)s-%(release)s untagged from %(tag_name)s"

-             if 'revoker_name' in x:

-                 fmt += " by %(revoker_name)s"

-         elif event_id == x['create_event']:

-             ts = x['create_ts']

-             fmt = "%(name)s-%(version)s-%(release)s tagged into %(tag_name)s"

-             if 'creator_name' in x:

-                 fmt += " by %(creator_name)s"

-             if x['active']:

-                 fmt += " [still active]"

-         else:

-             raise koji.GenericError("unknown event: (%r, %r)" % (event_id, x))

-         time_str = time.asctime(time.localtime(ts))

-         return "%s: %s" % (time_str, fmt % x)

-     for event_id, x in timeline:

-         if options.debug:

-             print("%r" % x)

-         print(_histline(event_id, x))

- 

- 

  def _print_histline(entry, **kwargs):

      options = kwargs['options']

      event_id, table, create, x = entry

file modified
-57
@@ -7818,62 +7818,6 @@ 

      return ret

  

  

- def tag_history(build=None, tag=None, package=None, active=None, queryOpts=None):

-     """Returns historical tag data

- 

-     package: only for given package

-     build: only for given build

-     tag: only for given tag

- 

-     Deprecated; will be removed in a future version

-     See: https://pagure.io/koji/issue/836

-     """

-     logger.warning("The tag_history call is deprecated and will be removed in a future version.")

-     fields = ('build.id', 'package.name', 'build.version', 'build.release',

-               'tag.id', 'tag.name', 'tag_listing.active',

-               'tag_listing.create_event', 'tag_listing.revoke_event',

-               'tag_listing.creator_id', 'tag_listing.revoker_id',

-               'creator.name', 'revoker.name',

-               'EXTRACT(EPOCH FROM ev1.time)', 'EXTRACT(EPOCH FROM ev2.time)',

-               'maven_builds.build_id', 'win_builds.build_id')

-     aliases = ('build_id', 'name', 'version', 'release',

-                'tag_id', 'tag_name', 'active',

-                'create_event', 'revoke_event',

-                'creator_id', 'revoker_id',

-                'creator_name', 'revoker_name',

-                'create_ts', 'revoke_ts',

-                'maven_build_id', 'win_build_id')

-     st_complete = koji.BUILD_STATES['COMPLETE']

-     tables = ['tag_listing']

-     joins = ["tag ON tag.id = tag_listing.tag_id",

-              "build ON build.id = tag_listing.build_id",

-              "package ON package.id = build.pkg_id",

-              "events AS ev1 ON ev1.id = tag_listing.create_event",

-              "LEFT OUTER JOIN events AS ev2 ON ev2.id = tag_listing.revoke_event",

-              "users AS creator ON creator.id = tag_listing.creator_id",

-              "LEFT OUTER JOIN users AS revoker ON revoker.id = tag_listing.revoker_id",

-              "LEFT OUTER JOIN maven_builds ON maven_builds.build_id = build.id",

-              "LEFT OUTER JOIN win_builds ON win_builds.build_id = build.id"]

-     clauses = []

-     if tag is not None:

-         tag_id = get_tag_id(tag, strict=True)

-         clauses.append("tag.id = %(tag_id)i")

-     if build is not None:

-         build_id = get_build(build, strict=True)['id']

-         clauses.append("build.id = %(build_id)i")

-     if package is not None:

-         pkg_id = get_package_id(package, strict=True)

-         clauses.append("package.id = %(pkg_id)i")

-     if active is True:

-         clauses.append("tag_listing.active is true")

-     elif active is False:

-         clauses.append("tag_listing.active is not true")

-     query = QueryProcessor(columns=fields, aliases=aliases, tables=tables,

-                            joins=joins, clauses=clauses, values=locals(),

-                            opts=queryOpts)

-     return query.iterate()

- 

- 

  def untagged_builds(name=None, queryOpts=None):

      """Returns the list of untagged builds"""

      fields = ('build.id', 'package.name', 'build.version', 'build.release')
@@ -10620,7 +10564,6 @@ 

      CGImport = staticmethod(cg_import)

  

      untaggedBuilds = staticmethod(untagged_builds)

-     tagHistory = staticmethod(tag_history)

      queryHistory = staticmethod(query_history)

  

      deleteBuild = staticmethod(delete_build)

@@ -104,7 +104,6 @@ 

          list-hosts                Print the host listing

          list-permissions          List user permissions

          list-pkgs                 Print the package listing for tag or for owner

-         list-tag-history          Print a history of tag operations

          list-tag-inheritance      Print the inheritance information for a tag

          list-tagged               List the builds or rpms in a tag

          list-tags                 Print the list of tags

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

2 years ago

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

2 years ago

Commit cb751f7 fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago