def get_rev_label_changeset_revision_from_repository_metadata( app, repository_metadata, repository=None, include_date=True, include_hash=True): if repository is None: repository = repository_metadata.repository repo = get_repo_for_repository(app, repository=repository) changeset_revision = repository_metadata.changeset_revision ctx = get_changectx_for_changeset(repo, changeset_revision) if ctx: rev = '%04d' % ctx.rev() if include_date: changeset_revision_date = get_readable_ctx_date(ctx) if include_hash: label = "%s:%s (%s)" % (str( ctx.rev()), changeset_revision, changeset_revision_date) else: label = "%s (%s)" % (str(ctx.rev()), changeset_revision_date) else: if include_hash: label = "%s:%s" % (str(ctx.rev()), changeset_revision) else: label = "%s" % str(ctx.rev()) else: rev = '-1' if include_hash: label = "-1:%s" % changeset_revision else: label = "-1" return rev, label, changeset_revision
def get_rev_label_changeset_revision_from_repository_metadata( app, repository_metadata, repository=None, include_date=True, include_hash=True): if repository is None: repository = repository_metadata.repository repo = repository.hg_repo changeset_revision = repository_metadata.changeset_revision ctx = get_changectx_for_changeset(repo, changeset_revision) if ctx: rev = '%04d' % ctx.rev() if include_date: changeset_revision_date = get_readable_ctx_date(ctx) if include_hash: label = f"{str(ctx.rev())}:{changeset_revision} ({changeset_revision_date})" else: label = f"{str(ctx.rev())} ({changeset_revision_date})" else: if include_hash: label = f"{str(ctx.rev())}:{changeset_revision}" else: label = f"{str(ctx.rev())}" else: rev = '-1' if include_hash: label = f"-1:{changeset_revision}" else: label = "-1" return rev, label, changeset_revision
def get_rev_label_from_changeset_revision(repo, changeset_revision, include_date=True, include_hash=True): """ Given a changeset revision hash, return two strings, the changeset rev and the changeset revision hash which includes the revision date if the receive include_date is True. """ ctx = get_changectx_for_changeset(repo, changeset_revision) if ctx: rev = '%04d' % ctx.rev() label = get_revision_label_from_ctx(ctx, include_date=include_date) else: rev = '-1' label = "-1:%s" % changeset_revision return rev, label
def get_revision_label(app, repository, changeset_revision, include_date=True, include_hash=True): """ Return a string consisting of the human readable changeset rev and the changeset revision string which includes the revision date if the receive include_date is True. """ repo = get_repo_for_repository(app, repository=repository) ctx = get_changectx_for_changeset(repo, changeset_revision) if ctx: return get_revision_label_from_ctx(ctx, include_date=include_date, include_hash=include_hash) else: if include_hash: return "-1:%s" % changeset_revision else: return "-1"