本文整理汇总了Python中webkitpy.common.system.deprecated_logging.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: begin_work_queue
def begin_work_queue(self):
log("CAUTION: %s will discard all local changes in \"%s\"" % (self.name, self.tool.scm().checkout_root))
if self.options.confirm:
response = self.tool.user.prompt("Are you sure? Type \"yes\" to continue: ")
if (response != "yes"):
error("User declined.")
log("Running WebKit %s." % self.name)
示例2: execute
def execute(self, options, args, tool):
bug_id = options.bug_id
svn_revision = args and args[0]
if svn_revision:
if re.match("^r[0-9]+$", svn_revision, re.IGNORECASE):
svn_revision = svn_revision[1:]
if not re.match("^[0-9]+$", svn_revision):
error("Invalid svn revision: '%s'" % svn_revision)
needs_prompt = False
if not bug_id or not svn_revision:
needs_prompt = True
(bug_id, svn_revision) = self._determine_bug_id_and_svn_revision(tool, bug_id, svn_revision)
log("Bug: <%s> %s" % (tool.bugs.bug_url_for_bug_id(bug_id), tool.bugs.fetch_bug_dictionary(bug_id)["title"]))
log("Revision: %s" % svn_revision)
if options.open_bug:
tool.user.open_url(tool.bugs.bug_url_for_bug_id(bug_id))
if needs_prompt:
if not tool.user.confirm("Is this correct?"):
self._exit(1)
bug_comment = bug_comment_from_svn_revision(svn_revision)
if options.comment:
bug_comment = "%s\n\n%s" % (options.comment, bug_comment)
if options.update_only:
log("Adding comment to Bug %s." % bug_id)
tool.bugs.post_comment_to_bug(bug_id, bug_comment)
else:
log("Adding comment to Bug %s and marking as Resolved/Fixed." % bug_id)
tool.bugs.close_bug_as_fixed(bug_id, bug_comment)
示例3: create_bug_from_commit
def create_bug_from_commit(self, options, args, tool):
commit_ids = tool.scm().commit_ids_from_commitish_arguments(args)
if len(commit_ids) > 3:
error("Are you sure you want to create one bug with %s patches?" % len(commit_ids))
commit_id = commit_ids[0]
bug_title = ""
comment_text = ""
if options.prompt:
(bug_title, comment_text) = self.prompt_for_bug_title_and_comment()
else:
commit_message = tool.scm().commit_message_for_local_commit(commit_id)
bug_title = commit_message.description(lstrip=True, strip_url=True)
comment_text = commit_message.body(lstrip=True)
comment_text += "---\n"
comment_text += tool.scm().files_changed_summary_for_commit(commit_id)
diff = tool.scm().create_patch(git_commit=commit_id)
bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
if bug_id and len(commit_ids) > 1:
options.bug_id = bug_id
options.obsolete_patches = False
# FIXME: We should pass through --no-comment switch as well.
PostCommits.execute(self, options, commit_ids[1:], tool)
示例4: run
def run(self, state):
if not self._options.check_builders:
return
red_builders_names = self._tool.buildbot.red_core_builders_names()
if not red_builders_names:
return
red_builders_names = map(lambda name: "\"%s\"" % name, red_builders_names) # Add quotes around the names.
error("Builders [%s] are red, please do not commit.\nSee http://%s.\nPass --ignore-builders to bypass this check." % (", ".join(red_builders_names), self._tool.buildbot.buildbot_host))
示例5: _validate_revisions
def _validate_revisions(self, current_chromium_revision, new_chromium_revision):
if new_chromium_revision < current_chromium_revision:
log("Current Chromium DEPS revision %s is newer than %s." % (current_chromium_revision, new_chromium_revision))
new_chromium_revision = self._tool.user.prompt("Enter new chromium revision (enter nothing to cancel):\n")
try:
new_chromium_revision = int(new_chromium_revision)
except ValueError, TypeError:
new_chromium_revision = None
if not new_chromium_revision:
error("Unable to update Chromium DEPS")
示例6: run
def run(self, state):
if self.cached_lookup(state, "changelogs"):
return
os.chdir(self._tool.scm().checkout_root)
args = [self.port().script_path("prepare-ChangeLog")]
if state["bug_id"]:
args.append("--bug=%s" % state["bug_id"])
if self._options.email:
args.append("--email=%s" % self._options.email)
try:
self._tool.executive.run_and_throw_if_fail(args, self._options.quiet)
except ScriptError, e:
error("Unable to prepare ChangeLogs.")
示例7: _validate_revisions
def _validate_revisions(self, current_chromium_revision, new_chromium_revision):
if new_chromium_revision < current_chromium_revision:
message = "Current Chromium DEPS revision %s is newer than %s." % (current_chromium_revision, new_chromium_revision)
if self._options.non_interactive:
error(message) # Causes the process to terminate.
log(message)
new_chromium_revision = self._tool.user.prompt("Enter new chromium revision (enter nothing to cancel):\n")
try:
new_chromium_revision = int(new_chromium_revision)
except ValueError, TypeError:
new_chromium_revision = None
if not new_chromium_revision:
error("Unable to update Chromium DEPS")
示例8: run
def run(self, state):
# FIXME: For now we disable this check when a user is driving the script
# this check is too draconian (and too poorly tested) to foist upon users.
if not self._options.non_interactive:
return
for changelog_path in self.cached_lookup(state, "changelogs"):
changelog_entry = ChangeLog(changelog_path).latest_entry()
if self._has_valid_reviewer(changelog_entry):
continue
reviewer_text = changelog_entry.reviewer_text()
if reviewer_text:
log("%s found in %s does not appear to be a valid reviewer according to committers.py." % (reviewer_text, changelog_path))
error('%s neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).' % changelog_path)
示例9: run
def run(self, state):
changed_files = self.cached_lookup(state, "changed_files")
for filename in changed_files:
if not self._tool.checkout().is_path_to_changelog(filename):
continue
# Diff ChangeLogs directly because svn-create-patch will move
# ChangeLog entries to the # top automatically, defeating our
# validation here.
# FIXME: Should we diff all the ChangeLogs at once?
diff = self._tool.scm().diff_for_file(filename)
parsed_diff = DiffParser(diff.splitlines())
for filename, diff_file in parsed_diff.files.items():
if not self._check_changelog_diff(diff_file):
error("ChangeLog entry in %s is not at the top of the file." % diff_file.filename)
示例10: run
def run(self, state):
# FIXME: For now we disable this check when a user is driving the script
# this check is too draconian (and too poorly tested) to foist upon users.
if not self._options.non_interactive:
return
# FIXME: We should figure out how to handle the current working
# directory issue more globally.
os.chdir(self._tool.scm().checkout_root)
for changelog_path in self._tool.checkout().modified_changelogs(self._options.git_commit, self._options.squash):
changelog_entry = ChangeLog(changelog_path).latest_entry()
if self._has_valid_reviewer(changelog_entry):
continue
reviewer_text = changelog_entry.reviewer_text()
if reviewer_text:
log("%s found in %s does not appear to be a valid reviewer according to committers.py." % (reviewer_text, changelog_path))
error('%s neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).' % changelog_path)
示例11: run
def run(self, state):
if self.cached_lookup(state, "changelogs"):
self._ensure_bug_url(state)
return
os.chdir(self._tool.scm().checkout_root)
args = [self._tool.port().script_path("prepare-ChangeLog")]
if state.get("bug_id"):
args.append("--bug=%s" % state["bug_id"])
if self._options.email:
args.append("--email=%s" % self._options.email)
if self._tool.scm().supports_local_commits():
args.append("--merge-base=%s" % self._tool.scm().merge_base(self._options.git_commit))
try:
self._tool.executive.run_and_throw_if_fail(args, self._options.quiet)
except ScriptError, e:
error("Unable to prepare ChangeLogs.")
示例12: default_scm
def default_scm(patch_directories=None):
"""Return the default SCM object as determined by the CWD and running code.
Returns the default SCM object for the current working directory; if the
CWD is not in a checkout, then we attempt to figure out if the SCM module
itself is part of a checkout, and return that one. If neither is part of
a checkout, None is returned.
"""
cwd = os.getcwd()
scm_system = detect_scm_system(cwd, patch_directories)
if not scm_system:
script_directory = os.path.dirname(os.path.abspath(__file__))
scm_system = detect_scm_system(script_directory, patch_directories)
if scm_system:
log("The current directory (%s) is not a WebKit checkout, using %s" % (cwd, scm_system.checkout_root))
else:
error("FATAL: Failed to determine the SCM system for either %s or %s" % (cwd, script_directory))
return scm_system
示例13: _determine_bug_id_and_svn_revision
def _determine_bug_id_and_svn_revision(self, tool, bug_id, svn_revision):
commit_log = self._fetch_commit_log(tool, svn_revision)
if not bug_id:
bug_id = parse_bug_id_from_changelog(commit_log)
if not svn_revision:
match = re.search("^r(?P<svn_revision>\d+) \|", commit_log, re.MULTILINE)
if match:
svn_revision = match.group('svn_revision')
if not bug_id or not svn_revision:
not_found = []
if not bug_id:
not_found.append("bug id")
if not svn_revision:
not_found.append("svn revision")
error("Could not find %s on command-line or in %s."
% (" or ".join(not_found), "r%s" % svn_revision if svn_revision else "last commit"))
return (bug_id, svn_revision)
示例14: _prepare_state
def _prepare_state(self, options, args, tool):
state = {}
state["bug_id"] = self._bug_id(options, args, tool, state)
if not state["bug_id"]:
error("No bug id passed and no bug url found in ChangeLogs.")
return state
示例15: create_patch_since_local_commit
def create_patch_since_local_commit(self, commit_id):
error("Your source control manager does not support creating a patch from a local commit.")