This function gets the changelog directly from the git repository instead of from the current checkout. The function is not used yet. --- gbp/deb.py | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/gbp/deb.py b/gbp/deb.py index 0b94386..3a8f6c1 100644 --- a/gbp/deb.py +++ b/gbp/deb.py @@ -13,6 +13,7 @@ import sys import glob import command_wrappers as gbpc from errors import GbpError +from gbp.git import GitRepositoryError # When trying to parse a version-number from a dsc or changes file, these are # the valid characters. @@ -124,6 +125,23 @@ def parse_dsc(dscfile): return dsc +def parse_changelog_repo(repo, branch, filename): + """ + Parse the changelog file from given branch in the git + repository. + """ + try: + # Note that we could just pass in the branch:filename notation + # to show as well, but we want to check if the branch / filename + # exists first, so we can give a separate error from other + # repository errors. + sha = repo.rev_parse("%s:%s" % (branch, filename), quiet=True) + except GitRepositoryError: + raise NoChangelogError, "Changelog %s not found in branch %s" % (filename, branch) + + lines = repo.show(sha) + return parse_changelog('\n'.join(lines)) + def parse_changelog_file(filename): """ -- 1.7.1 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org