summaryrefslogtreecommitdiff
path: root/packages/management
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-14 22:02:39 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-14 22:02:39 -0500
commita2db6164a890d91307cbfed6794776f4f17c4955 (patch)
tree610deaae4780da796aa6b466c4b20868306926b8 /packages/management
parent4c22dbf07b12b172d9662c8d809fe0fb7b616a2f (diff)
parentd198137d718a5dfcaacedc3e2e3adf86c3192cd7 (diff)
Merge commit 'd198137' (update)
Diffstat (limited to 'packages/management')
-rw-r--r--packages/management/commands/populate_signoffs.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/packages/management/commands/populate_signoffs.py b/packages/management/commands/populate_signoffs.py
index ce5ec734..42496e9d 100644
--- a/packages/management/commands/populate_signoffs.py
+++ b/packages/management/commands/populate_signoffs.py
@@ -44,6 +44,9 @@ class Command(NoArgsCommand):
return add_signoff_comments()
def svn_log(pkgbase, repo):
+ '''Retrieve the most recent SVN log entry for the given pkgbase and
+ repository. The configured setting SVN_BASE_URL is used along with the
+ svn_root for each repository to form the correct URL.'''
path = '%s%s/%s/trunk/' % (settings.SVN_BASE_URL, repo.svn_root, pkgbase)
cmd = ['svn', 'log', '--limit=1', '--xml', path]
log_data = subprocess.check_output(cmd)
@@ -59,6 +62,17 @@ def svn_log(pkgbase, repo):
'message': xml.findtext('logentry/msg'),
}
+def cached_svn_log(pkgbase, repo):
+ '''Retrieve the cached version of the SVN log if possible, else delegate to
+ svn_log() to do the work and cache the result.'''
+ key = (pkgbase, repo)
+ if key in cached_svn_log.cache:
+ return cached_svn_log.cache[key]
+ log = svn_log(pkgbase, repo)
+ cached_svn_log.cache[key] = log
+ return log
+cached_svn_log.cache = {}
+
def create_specification(package, log, finder):
trimmed_message = log['message'].strip()
spec = SignoffSpecification(pkgbase=package.pkgbase,
@@ -80,7 +94,7 @@ def add_signoff_comments():
continue
logger.debug("getting SVN log for %s (%s)", group.pkgbase, group.repo)
- log = svn_log(group.pkgbase, group.repo)
+ log = cached_svn_log(group.pkgbase, group.repo)
logger.info("creating spec with SVN message for %s", group.pkgbase)
spec = create_specification(group.packages[0], log, finder)
spec.save()