From 519236490dad3851e0047790b123902f30e343a8 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Thu, 29 Mar 2018 16:13:59 +1300 Subject: rrs_maintainer_history: avoid unnecessary checkouts We don't actually need to check out the repository until we actually analyse a commit, so avoid doing so. Additionally, there's not much point in checking out master at the end, let the next script invocation do that if needed (if it needs to, it should since otherwise there's no guarantee what state the repository is in). Signed-off-by: Paul Eggleton --- rrs/tools/rrs_maintainer_history.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rrs/tools/rrs_maintainer_history.py b/rrs/tools/rrs_maintainer_history.py index 72681be107..6585f5bf55 100755 --- a/rrs/tools/rrs_maintainer_history.py +++ b/rrs/tools/rrs_maintainer_history.py @@ -94,14 +94,14 @@ def maintainer_history(options, logger): repodir = os.path.join(fetchdir, urldir) layerdir = os.path.join(repodir, layerbranch.vcs_subdir) - utils.runcmd("git checkout master -f", layerdir, logger=logger) maintainers_full_path = os.path.join(layerdir, MAINTAINERS_INCLUDE_PATH) if not os.path.exists(maintainers_full_path): logger.debug('No maintainers.inc for %s, skipping' % layerbranch) continue - commits = utils.runcmd("git log --format='%H' --reverse --date=rfc " + - os.path.join(layerbranch.vcs_subdir, MAINTAINERS_INCLUDE_PATH), repodir, logger=logger) + commits = utils.runcmd("git log --format='%%H' --reverse --date=rfc origin/master %s" + % os.path.join(layerbranch.vcs_subdir, MAINTAINERS_INCLUDE_PATH), + repodir, logger=logger) try: with transaction.atomic(): @@ -156,8 +156,6 @@ def maintainer_history(options, logger): logger.debug("%s: Not found maintainer in commit %s set to 'No maintainer'." % \ (recipe.pn, rms.sha1)) - utils.runcmd("git checkout master -f", repodir, logger=logger) - # set new recipes to no maintainer if don't have one rms = RecipeMaintainerHistory.get_last() for recipe in layerbranch.recipe_set.all(): -- cgit 1.2.3-korg