mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
changectx() method was dropped in mercurial 4.6
in favour of `__getitem__()`.
This commit is contained in:
@@ -994,7 +994,7 @@ class MetadataGenerator(object):
|
||||
# The received changeset_revision may be None since defining it in the dependency definition is optional.
|
||||
# If this is the case, the default will be to set its value to the repository dependency tip revision.
|
||||
# This probably occurs only when handling circular dependency definitions.
|
||||
tip_ctx = repo.changectx(repo.changelog.tip())
|
||||
tip_ctx = repo[repo.changelog.tip()]
|
||||
# Make sure the repo.changlog includes at least 1 revision.
|
||||
if changeset_revision is None and tip_ctx.rev() >= 0:
|
||||
changeset_revision = str(tip_ctx)
|
||||
@@ -1009,7 +1009,7 @@ class MetadataGenerator(object):
|
||||
# Find the specified changeset revision in the repository's changelog to see if it's valid.
|
||||
found = False
|
||||
for changeset in repo.changelog:
|
||||
changeset_hash = str(repo.changectx(changeset))
|
||||
changeset_hash = str(repo[changeset])
|
||||
if changeset_hash == changeset_revision:
|
||||
found = True
|
||||
break
|
||||
|
||||
@@ -39,7 +39,7 @@ def copy_file_from_manifest(repo, changeset_revision, filename, dir):
|
||||
to which dir refers.
|
||||
"""
|
||||
for changeset in reversed_upper_bounded_changelog(repo, changeset_revision):
|
||||
changeset_ctx = repo.changectx(changeset)
|
||||
changeset_ctx = repo[changeset]
|
||||
fctx = get_file_context_from_ctx(changeset_ctx, filename)
|
||||
if fctx and fctx not in ['DELETED']:
|
||||
file_path = os.path.join(dir, filename)
|
||||
@@ -53,7 +53,7 @@ def copy_file_from_manifest(repo, changeset_revision, filename, dir):
|
||||
def get_changectx_for_changeset(repo, changeset_revision, **kwd):
|
||||
"""Retrieve a specified changectx from a repository."""
|
||||
for changeset in repo.changelog:
|
||||
ctx = repo.changectx(changeset)
|
||||
ctx = repo[changeset]
|
||||
if str(ctx) == changeset_revision:
|
||||
return ctx
|
||||
return None
|
||||
@@ -75,7 +75,7 @@ def get_ctx_file_path_from_manifest(filename, repo, changeset_revision):
|
||||
"""
|
||||
stripped_filename = basic_util.strip_path(filename)
|
||||
for changeset in reversed_upper_bounded_changelog(repo, changeset_revision):
|
||||
manifest_ctx = repo.changectx(changeset)
|
||||
manifest_ctx = repo[changeset]
|
||||
for ctx_file in manifest_ctx.files():
|
||||
ctx_file_name = basic_util.strip_path(ctx_file)
|
||||
if ctx_file_name == stripped_filename:
|
||||
@@ -146,7 +146,7 @@ def reversed_lower_upper_bounded_changelog(repo, excluded_lower_bounds_changeset
|
||||
appending_started = False
|
||||
reversed_changelog = []
|
||||
for changeset in repo.changelog:
|
||||
changeset_hash = str(repo.changectx(changeset))
|
||||
changeset_hash = str(repo[changeset])
|
||||
if appending_started:
|
||||
reversed_changelog.insert(0, changeset)
|
||||
if changeset_hash == excluded_lower_bounds_changeset_revision and not appending_started:
|
||||
|
||||
@@ -113,7 +113,7 @@ def get_latest_downloadable_repository_metadata(trans, repository):
|
||||
"""
|
||||
encoded_repository_id = trans.security.encode_id(repository.id)
|
||||
repo = hg_util.get_repo_for_repository(trans.app, repository=repository)
|
||||
tip_ctx = str(repo.changectx(repo.changelog.tip()))
|
||||
tip_ctx = str(repo[repo.changelog.tip()])
|
||||
repository_metadata = None
|
||||
try:
|
||||
repository_metadata = metadata_util.get_repository_metadata_by_changeset_revision(trans.app, encoded_repository_id, tip_ctx)
|
||||
@@ -152,7 +152,7 @@ def get_latest_repository_metadata(trans, repository):
|
||||
"""
|
||||
encoded_repository_id = trans.security.encode_id(repository.id)
|
||||
repo = hg_util.get_repo_for_repository(trans.app, repository=repository)
|
||||
tip_ctx = str(repo.changectx(repo.changelog.tip()))
|
||||
tip_ctx = str(repo[repo.changelog.tip()])
|
||||
try:
|
||||
repository_metadata = metadata_util.get_repository_metadata_by_changeset_revision(trans.app, encoded_repository_id, tip_ctx)
|
||||
return repository_metadata
|
||||
|
||||
@@ -748,12 +748,12 @@ class RepositoryMetadataManager(metadata_generator.MetadataGenerator):
|
||||
ancestor_metadata_dict = None
|
||||
for changeset in self.repository.get_changesets_for_setting_metadata(self.app):
|
||||
work_dir = tempfile.mkdtemp(prefix="tmp-toolshed-ramorits")
|
||||
ctx = repo.changectx(changeset)
|
||||
ctx = repo[changeset]
|
||||
log.debug("Cloning repository changeset revision: %s", str(ctx.rev()))
|
||||
cloned_ok, error_message = hg_util.clone_repository(self.repository_clone_url, work_dir, str(ctx.rev()))
|
||||
if cloned_ok:
|
||||
log.debug("Generating metadata for changset revision: %s", str(ctx.rev()))
|
||||
self.set_changeset_revision(str(repo.changectx(changeset)))
|
||||
self.set_changeset_revision(str(ctx))
|
||||
self.set_repository_files_dir(work_dir)
|
||||
self.generate_metadata_for_changeset_revision()
|
||||
if self.metadata_dict:
|
||||
@@ -812,7 +812,7 @@ class RepositoryMetadataManager(metadata_generator.MetadataGenerator):
|
||||
encoded_repository_id = self.app.security.encode_id(self.repository.id)
|
||||
changeset_revisions_that_contain_tools = []
|
||||
for changeset in repo.changelog:
|
||||
changeset_revision = str(repo.changectx(changeset))
|
||||
changeset_revision = str(repo[changeset])
|
||||
repository_metadata = metadata_util.get_repository_metadata_by_changeset_revision(self.app,
|
||||
encoded_repository_id,
|
||||
changeset_revision)
|
||||
@@ -969,7 +969,7 @@ class RepositoryMetadataManager(metadata_generator.MetadataGenerator):
|
||||
# critical, so we use the repo's changelog.
|
||||
changeset_revisions = []
|
||||
for changeset in repo.changelog:
|
||||
changeset_revision = str(repo.changectx(changeset))
|
||||
changeset_revision = str(repo[changeset])
|
||||
if metadata_util.get_repository_metadata_by_changeset_revision(self.app, encoded_id, changeset_revision):
|
||||
changeset_revisions.append(changeset_revision)
|
||||
self.add_tool_versions(encoded_id, repository_metadata, changeset_revisions)
|
||||
|
||||
@@ -29,7 +29,7 @@ class RepositorySuiteDefinition(TipOnly):
|
||||
else:
|
||||
changeset_revisions = repo.changelog
|
||||
for changeset in changeset_revisions:
|
||||
ctx = repo.changectx(changeset)
|
||||
ctx = repo[changeset]
|
||||
# Inspect all files in the changeset (in sorted order) to make sure there is only one and it
|
||||
# is named repository_dependencies.xml.
|
||||
files_changed_in_changeset = ctx.files()
|
||||
|
||||
@@ -29,7 +29,7 @@ class ToolDependencyDefinition(TipOnly):
|
||||
else:
|
||||
changeset_revisions = repo.changelog
|
||||
for changeset in changeset_revisions:
|
||||
ctx = repo.changectx(changeset)
|
||||
ctx = repo[changeset]
|
||||
# Inspect all files in the changeset (in sorted order) to make sure there is only one and it is named tool_dependencies.xml.
|
||||
files_changed_in_changeset = ctx.files()
|
||||
for file_path in files_changed_in_changeset:
|
||||
|
||||
@@ -1074,8 +1074,8 @@ class ShedTwillTestCase(FunctionalTestCase):
|
||||
repo = self.get_hg_repo(self.get_repo_path(repository))
|
||||
changelog_tuples = []
|
||||
for changeset in repo.changelog:
|
||||
ctx = repo.changectx(changeset)
|
||||
changelog_tuples.append((ctx.rev(), repo.changectx(changeset)))
|
||||
ctx = repo[changeset]
|
||||
changelog_tuples.append((ctx.rev(), ctx))
|
||||
return changelog_tuples
|
||||
|
||||
def get_repository_datatypes_count(self, repository):
|
||||
@@ -1128,7 +1128,7 @@ class ShedTwillTestCase(FunctionalTestCase):
|
||||
|
||||
def get_repository_tip(self, repository):
|
||||
repo = self.get_hg_repo(self.get_repo_path(repository))
|
||||
return str(repo.changectx(repo.changelog.tip()))
|
||||
return str(repo[repo.changelog.tip()])
|
||||
|
||||
def get_sniffers_count(self):
|
||||
url = '/api/datatypes/sniffers'
|
||||
@@ -1423,7 +1423,7 @@ class ShedTwillTestCase(FunctionalTestCase):
|
||||
|
||||
def repository_is_new(self, repository):
|
||||
repo = self.get_hg_repo(self.get_repo_path(repository))
|
||||
tip_ctx = repo.changectx(repo.changelog.tip())
|
||||
tip_ctx = repo[repo.changelog.tip()]
|
||||
return tip_ctx.rev() < 0
|
||||
|
||||
def reset_installed_repository_metadata(self, repository):
|
||||
|
||||
@@ -77,7 +77,7 @@ class ToolValidator(GalaxyToolValidator):
|
||||
"""
|
||||
stripped_filename = basic_util.strip_path(filename)
|
||||
for changeset in hg_util.reversed_upper_bounded_changelog(repo, changeset_revision):
|
||||
manifest_ctx = repo.changectx(changeset)
|
||||
manifest_ctx = repo[changeset]
|
||||
for ctx_file in manifest_ctx.files():
|
||||
ctx_file_name = basic_util.strip_path(ctx_file)
|
||||
if ctx_file_name == stripped_filename:
|
||||
@@ -109,7 +109,7 @@ class ToolValidator(GalaxyToolValidator):
|
||||
deleted_sample_files = []
|
||||
sample_files = []
|
||||
for changeset in hg_util.reversed_upper_bounded_changelog(repo, changeset_revision):
|
||||
changeset_ctx = repo.changectx(changeset)
|
||||
changeset_ctx = repo[changeset]
|
||||
for ctx_file in changeset_ctx.files():
|
||||
ctx_file_name = basic_util.strip_path(ctx_file)
|
||||
# If we decide in the future that files deleted later in the changelog should
|
||||
|
||||
@@ -44,7 +44,7 @@ class ToolVersionManager(object):
|
||||
# Get all ancestor guids of the received guid.
|
||||
current_child_guid = guid
|
||||
for changeset in hg_util.reversed_upper_bounded_changelog(repo, repository_metadata.changeset_revision):
|
||||
ctx = repo.changectx(changeset)
|
||||
ctx = repo[changeset]
|
||||
rm = metadata_util.get_repository_metadata_by_changeset_revision(self.app, repository_id, str(ctx))
|
||||
if rm:
|
||||
parent_guid = rm.tool_versions.get(current_child_guid, None)
|
||||
@@ -56,7 +56,7 @@ class ToolVersionManager(object):
|
||||
for changeset in hg_util.reversed_lower_upper_bounded_changelog(repo,
|
||||
repository_metadata.changeset_revision,
|
||||
repository.tip(self.app)):
|
||||
ctx = repo.changectx(changeset)
|
||||
ctx = repo[changeset]
|
||||
rm = metadata_util.get_repository_metadata_by_changeset_revision(self.app, repository_id, str(ctx))
|
||||
if rm:
|
||||
tool_versions = rm.tool_versions
|
||||
|
||||
@@ -155,7 +155,7 @@ def get_next_downloadable_changeset_revision(app, repository, after_changeset_re
|
||||
found_after_changeset_revision = False
|
||||
repo = get_repo_for_repository(app, repository=repository)
|
||||
for changeset in repo.changelog:
|
||||
changeset_revision = str(repo.changectx(changeset))
|
||||
changeset_revision = str(repo[changeset])
|
||||
if found_after_changeset_revision:
|
||||
if changeset_revision in changeset_revisions:
|
||||
return changeset_revision
|
||||
@@ -293,7 +293,7 @@ def get_updated_changeset_revisions(app, name, owner, changeset_revision):
|
||||
for changeset in reversed_lower_upper_bounded_changelog(repo, changeset_revision, upper_bound_changeset_revision):
|
||||
# Make sure to exclude upper_bound_changeset_revision.
|
||||
if changeset != upper_bound_changeset_revision:
|
||||
changeset_hashes.append(str(repo.changectx(changeset)))
|
||||
changeset_hashes.append(str(repo[changeset]))
|
||||
if changeset_hashes:
|
||||
changeset_hashes_str = ','.join(changeset_hashes)
|
||||
return changeset_hashes_str
|
||||
|
||||
@@ -76,7 +76,7 @@ def get_previous_repository_reviews(app, repository, changeset_revision):
|
||||
reviewed_revision_hashes = [review.changeset_revision for review in repository.reviews]
|
||||
previous_reviews_dict = OrderedDict()
|
||||
for changeset in hg_util.reversed_upper_bounded_changelog(repo, changeset_revision):
|
||||
previous_changeset_revision = str(repo.changectx(changeset))
|
||||
previous_changeset_revision = str(repo[changeset])
|
||||
if previous_changeset_revision in reviewed_revision_hashes:
|
||||
previous_rev, previous_changeset_revision_label = \
|
||||
hg_util.get_rev_label_from_changeset_revision(repo, previous_changeset_revision)
|
||||
@@ -125,7 +125,7 @@ def has_previous_repository_reviews(app, repository, changeset_revision):
|
||||
repo = hg_util.get_repo_for_repository(app, repository=repository)
|
||||
reviewed_revision_hashes = [review.changeset_revision for review in repository.reviews]
|
||||
for changeset in hg_util.reversed_upper_bounded_changelog(repo, changeset_revision):
|
||||
previous_changeset_revision = str(repo.changectx(changeset))
|
||||
previous_changeset_revision = str(repo[changeset])
|
||||
if previous_changeset_revision in reviewed_revision_hashes:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -332,8 +332,7 @@ def handle_email_alerts(app, host, repository, content_alert_str='', new_repo_al
|
||||
email_from = 'galaxy-no-reply@' + socket.getfqdn()
|
||||
else:
|
||||
email_from = 'galaxy-no-reply@' + host.split(':')[0]
|
||||
tip_changeset = repo.changelog.tip()
|
||||
ctx = repo.changectx(tip_changeset)
|
||||
ctx = repo[repo.changelog.tip()]
|
||||
try:
|
||||
username = ctx.user().split()[0]
|
||||
except Exception:
|
||||
|
||||
@@ -646,7 +646,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
# to which we need to update.
|
||||
update_to_changeset_hash = None
|
||||
for changeset in repo.changelog:
|
||||
changeset_hash = str(repo.changectx(changeset))
|
||||
changeset_hash = str(repo[changeset])
|
||||
hg_util.get_changectx_for_changeset(repo, changeset_hash)
|
||||
if update_to_changeset_hash:
|
||||
if changeset_hash == repository.tip(trans.app):
|
||||
@@ -1114,8 +1114,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
includes_tools = False
|
||||
has_repository_dependencies = False
|
||||
has_repository_dependencies_only_if_compiling_contained_td = False
|
||||
changeset_hash = str(repo.changectx(changeset))
|
||||
hg_util.get_changectx_for_changeset(repo, changeset_hash)
|
||||
changeset_hash = str(repo[changeset])
|
||||
if update_to_changeset_hash:
|
||||
update_to_repository_metadata = metadata_util.get_repository_metadata_by_changeset_revision(trans.app,
|
||||
trans.security.encode_id(repository.id),
|
||||
@@ -1376,7 +1375,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
repo = hg_util.get_repo_for_repository(trans.app, repository=repository)
|
||||
tool_version_dicts = []
|
||||
for changeset in repo.changelog:
|
||||
current_changeset_revision = str(repo.changectx(changeset))
|
||||
current_changeset_revision = str(repo[changeset])
|
||||
repository_metadata = metadata_util.get_repository_metadata_by_changeset_revision(trans.app,
|
||||
trans.security.encode_id(repository.id),
|
||||
current_changeset_revision)
|
||||
@@ -2050,7 +2049,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
for changeset in hg_util.reversed_lower_upper_bounded_changelog(repo,
|
||||
lower_bound_changeset_revision,
|
||||
changeset_revision):
|
||||
changeset_hashes.append(str(repo.changectx(changeset)))
|
||||
changeset_hashes.append(str(repo[changeset]))
|
||||
if changeset_hashes:
|
||||
changeset_hashes_str = ','.join(changeset_hashes)
|
||||
return changeset_hashes_str
|
||||
@@ -2437,7 +2436,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
repo = hg_util.get_repo_for_repository(trans.app, repository=repository)
|
||||
changesets = []
|
||||
for changeset in repo.changelog:
|
||||
ctx = repo.changectx(changeset)
|
||||
ctx = repo[changeset]
|
||||
if metadata_util.get_repository_metadata_by_changeset_revision(trans.app, id, str(ctx)):
|
||||
has_metadata = True
|
||||
else:
|
||||
|
||||
@@ -488,8 +488,7 @@ class RepositoryReviewController(BaseUIController, ratings_util.ItemRatings):
|
||||
reviewed_revision_hashes = [review.changeset_revision for review in repository.reviews]
|
||||
reviews_dict = OrderedDict()
|
||||
for changeset in hg_util.get_reversed_changelog_changesets(repo):
|
||||
ctx = repo.changectx(changeset)
|
||||
changeset_revision = str(ctx)
|
||||
changeset_revision = str(repo[changeset])
|
||||
if changeset_revision in metadata_revision_hashes or changeset_revision in reviewed_revision_hashes:
|
||||
rev, changeset_revision_label = hg_util.get_rev_label_from_changeset_revision(repo, changeset_revision)
|
||||
if changeset_revision in reviewed_revision_hashes:
|
||||
|
||||
@@ -260,16 +260,16 @@ class Repository(Dictifiable):
|
||||
|
||||
def is_new(self, app):
|
||||
repo = hg_util.get_repo_for_repository(app, repository=self)
|
||||
tip_ctx = repo.changectx(repo.changelog.tip())
|
||||
return tip_ctx.rev() < 0
|
||||
tip_rev = repo.changelog.tiprev()
|
||||
return tip_rev < 0
|
||||
|
||||
def repo_path(self, app):
|
||||
return app.hgweb_config_manager.get_entry(os.path.join("repos", self.user.username, self.name))
|
||||
|
||||
def revision(self, app):
|
||||
repo = hg_util.get_repo_for_repository(app, repository=self)
|
||||
tip_ctx = repo.changectx(repo.changelog.tip())
|
||||
return "%s:%s" % (str(tip_ctx.rev()), str(repo.changectx(repo.changelog.tip())))
|
||||
tip_ctx = repo[repo.changelog.tip()]
|
||||
return "%s:%s" % (str(tip_ctx.rev()), str(tip_ctx))
|
||||
|
||||
def set_allow_push(self, app, usernames, remove_auth=''):
|
||||
allow_push = util.listify(self.allow_push(app))
|
||||
@@ -294,7 +294,7 @@ class Repository(Dictifiable):
|
||||
|
||||
def tip(self, app):
|
||||
repo = hg_util.get_repo_for_repository(app, repository=self)
|
||||
return str(repo.changectx(repo.changelog.tip()))
|
||||
return str(repo[repo.changelog.tip()])
|
||||
|
||||
def to_dict(self, view='collection', value_mapper=None):
|
||||
rval = super(Repository, self).to_dict(view=view, value_mapper=value_mapper)
|
||||
|
||||
@@ -193,7 +193,7 @@ def get_repos(sa_session, file_path, hgweb_config_dir, **kwargs):
|
||||
hg_repo = hg.repository(ui.ui(), repo_path)
|
||||
lineage = []
|
||||
for changeset in hg_repo.changelog:
|
||||
lineage.append(str(changeset) + ":" + str(hg_repo.changectx(changeset)))
|
||||
lineage.append(str(changeset) + ":" + str(hg_repo[changeset]))
|
||||
repo_lineage = str(lineage)
|
||||
|
||||
# Parse all the tools within repo for a separate index.
|
||||
|
||||
Reference in New Issue
Block a user