本文整理匯總了Python中webkitpy.common.checkout.changelog.ChangeLog類的典型用法代碼示例。如果您正苦於以下問題:Python ChangeLog類的具體用法?Python ChangeLog怎麽用?Python ChangeLog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ChangeLog類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _ensure_bug_url
def _ensure_bug_url(self, state):
if not state.get("bug_id"):
return
bug_id = state.get("bug_id")
changelogs = self.cached_lookup(state, "changelogs")
for changelog_path in changelogs:
changelog = ChangeLog(changelog_path)
if not changelog.latest_entry().bug_id():
changelog.set_short_description_and_bug_url(
self.cached_lookup(state, "bug_title"),
self._tool.bugs.bug_url_for_bug_id(bug_id))
示例2: _assert_message_for_revert_output
def _assert_message_for_revert_output(self, args, expected_entry):
changelog_contents = u"%s\n%s" % (changelog_unittest.ChangeLogTest._new_entry_boilerplate, changelog_unittest.ChangeLogTest._example_changelog)
changelog_path = self._write_tmp_file_with_contents(changelog_contents.encode("utf-8"))
changelog = ChangeLog(changelog_path)
changelog.update_with_unreviewed_message(PrepareChangeLogForRevert._message_for_revert(*args))
actual_entry = changelog.latest_entry()
os.remove(changelog_path)
self.assertEqual(actual_entry.contents(), expected_entry)
self.assertEqual(actual_entry.reviewer_text(), None)
# These checks could be removed to allow this to work on other entries:
self.assertEqual(actual_entry.author_name(), "Eric Seidel")
self.assertEqual(actual_entry.author_email(), "[email protected]")
示例3: 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)
示例4: _latest_entry_for_changelog_at_revision
def _latest_entry_for_changelog_at_revision(self, changelog_path, revision):
changelog_contents = self._scm.contents_at_revision(changelog_path, revision)
# contents_at_revision returns a byte array (str()), but we know
# that ChangeLog files are utf-8. parse_latest_entry_from_file
# expects a file-like object which vends unicode(), so we decode here.
changelog_file = StringIO.StringIO(changelog_contents.decode("utf-8"))
return ChangeLog.parse_latest_entry_from_file(changelog_file)
示例5: 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)
示例6: commit_message_for_this_commit
def commit_message_for_this_commit(self, git_commit, changed_files=None):
changelog_paths = self.modified_changelogs(git_commit, changed_files)
if not len(changelog_paths):
raise ScriptError(message="Found no modified ChangeLogs, cannot create a commit message.\n"
"All changes require a ChangeLog. See:\n %s" % urls.contribution_guidelines)
changelog_messages = []
for changelog_path in changelog_paths:
log("Parsing ChangeLog: %s" % changelog_path)
changelog_entry = ChangeLog(changelog_path).latest_entry()
if not changelog_entry:
raise ScriptError(message="Failed to parse ChangeLog: %s" % os.path.abspath(changelog_path))
changelog_messages.append(changelog_entry.contents())
# FIXME: We should sort and label the ChangeLog messages like commit-log-editor does.
return CommitMessage("".join(changelog_messages).splitlines())
示例7: _latest_entry_for_changelog_at_revision
def _latest_entry_for_changelog_at_revision(self, changelog_path, revision):
changelog_contents = self._scm.contents_at_revision(changelog_path, revision)
# contents_at_revision returns a byte array (str()), but we know
# that ChangeLog files are utf-8. parse_latest_entry_from_file
# expects a file-like object which vends unicode(), so we decode here.
# Old revisions of Sources/WebKit/wx/ChangeLog have some invalid utf8 characters.
changelog_file = StringIO.StringIO(changelog_contents.decode("utf-8", "ignore"))
return ChangeLog.parse_latest_entry_from_file(changelog_file)
示例8: analyze
def analyze(self):
for path in self._changelog_paths:
self._set_filename(self._filesystem.relpath(path, self._scm.checkout_root))
with self._filesystem.open_text_file_for_reading(path) as changelog:
self._print_status('Parsing entries...')
number_of_parsed_entries = self._analyze_entries(ChangeLog.parse_entries_from_file(changelog), path)
self._print_status('Done (%d entries)' % number_of_parsed_entries)
print
self._summary['contributors'] = len(self._contributors_statistics)
self._summary['contributors_with_reviews'] = sum([1 for contributor in self._contributors_statistics.values() if contributor['reviews']['total']])
self._summary['contributors_without_reviews'] = self._summary['contributors'] - self._summary['contributors_with_reviews']
示例9: _resolve_existing_entry
def _resolve_existing_entry(self, changelog_path):
# When this is called, the top entry in the ChangeLog was just created
# by prepare-ChangeLog, as an clean updated version of the one below it.
with self._tool.filesystem.open_text_file_for_reading(changelog_path) as changelog_file:
entries_gen = ChangeLog.parse_entries_from_file(changelog_file)
entries = zip(entries_gen, range(2))
if not len(entries):
raise Exception("Expected to find at least two ChangeLog entries in %s but found none." % changelog_path)
if len(entries) == 1:
# If we get here, it probably means we've just rolled over to a
# new CL file, so we don't have anything to resolve.
return
(new_entry, _), (old_entry, _) = entries
final_entry = self._merge_entries(old_entry, new_entry)
changelog = ChangeLog(changelog_path, self._tool.filesystem)
changelog.delete_entries(2)
changelog.prepend_text(final_entry)
示例10: _latest_entry_for_changelog_at_revision
def _latest_entry_for_changelog_at_revision(self, changelog_path, revision):
changelog_contents = self._scm.contents_at_revision(changelog_path, revision)
return ChangeLog.parse_latest_entry_from_file(StringIO.StringIO(changelog_contents))