[codeface] [PATCH 6/7] PatchStack: implement calculation of upstream hashes

  • From: Ralf Ramsauer <ralf.ramsauer@xxxxxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx, Manuel Donaubauer <Manuel.Donaubauer@xxxxxxxxxxxxx>
  • Date: Fri, 11 Aug 2017 16:00:37 +0200

This was done by the prepare_projects before and had to be manually
triggered.

Now PaStA performs sanity checks on every startup and recalculates the
upstream commit hash list if something changed in the configuration
file.

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@xxxxxxxxxxxxxxxxx>
---
 PaStA/PatchStack.py | 19 +++++++++++++++++--
 README.md           | 26 +++++++-------------------
 pasta-prepare       | 12 ------------
 3 files changed, 24 insertions(+), 33 deletions(-)
 delete mode 100755 pasta-prepare

diff --git a/PaStA/PatchStack.py b/PaStA/PatchStack.py
index 0b17a28..6206b0a 100644
--- a/PaStA/PatchStack.py
+++ b/PaStA/PatchStack.py
@@ -246,8 +246,23 @@ class PatchStackDefinition:
 
             patch_stack_groups.append((group_name, this_group))
 
-        # get upstream commit hashes
-        upstream = load_commit_hashes(config.f_upstream_hashes)
+        # check if upstream commit hashes are existent. If not, create them
+        upstream = None
+        if (os.path.isfile(config.f_upstream_hashes)):
+            upstream = load_commit_hashes(config.f_upstream_hashes)
+
+            # check if upstream range in the config file is in sync
+            upstream_range = tuple(upstream.pop(0).split(' '))
+            if upstream_range != config.upstream_range:
+                print('Upstream range changed. Recalculating.')
+                upstream = None
+
+        if not upstream:
+            print('Calculating missing upstream commit hashes')
+            upstream = repo.get_commithash_range(config.upstream_range)
+            persist_commit_hashes(config.f_upstream_hashes,
+                                  [' '.join(config.upstream_range)] + upstream)
+
         if config.upstream_blacklist:
             blacklist = load_commit_hashes(config.upstream_blacklist, 
ordered=False)
             # filter blacklistes commit hashes
diff --git a/README.md b/README.md
index a5f2183..a95ff78 100644
--- a/README.md
+++ b/README.md
@@ -28,28 +28,19 @@ Getting started
 ---------------
 - Select the project to analyse by linking the config:
   `ln -sf PaStA-resources/PreemptRT/PreemptRT.conf ./config`
-- Run `./pasta-prepare`
 - Run PaStA `./pasta -h`
 
 Running PaStA
 -------------
 
-### Preparing PaStA PaStA configuration files and source code repositories of
-projects are stored in a separate repository `PaStA-resources`
-
-Running
-```
-$ ./pasta-prepare
-```
-will initialize and clone PaStA-resources (all preconfigured projects for
-analysation) as git submodules. Inside PaStA-resources, the project code
-repositories are submodules as well.
-
-### Create commit cache
-For some projects and repositories, PaStA has to compare tenthousands of
-diffs. Creating those diffs on-the-fly is possible but very slow. Because of
-this, PaStA is able to use a fast commit that can be reused.
+### PaStA Cache
+Many projects contain thousands of commits. It is time-consuming to determine
+and load commits. To increase overall performance, PaStA persists lists of
+commit hashes and creates pkl-based commit caches. Those lists will be created
+when needed. PaStA detects changes in the configuration file and automatically
+updates those lists.
 
+The commit cache has to be created manually:
 ```
 $ ./pasta cache -stack # Creates cache file for commits on the patch stacks
 $ ./pasta cache -upstream # Create cache file for upstream commits
@@ -124,9 +115,6 @@ gives you further detailed information about subcommands.
 `./pasta compare` analyses a list of commit hashes given as command line
 arguments and displays the evaluation result as well as the original commits.
 
-#### pasta-prepare
-Initialises git submodules
-
 Creating a new PaStA project
 ----------------------------
 ### Preparing the repository
diff --git a/pasta-prepare b/pasta-prepare
deleted file mode 100755
index e5db7af..0000000
--- a/pasta-prepare
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) OTH Regensburg, 2016
-#
-# Author:
-#   Ralf Ramsauer <ralf.ramsauer@xxxxxxx>
-#
-# This work is licensed under the terms of the GNU GPL, version 2.  See
-# the COPYING file in the top-level directory.
-
-cd PaStA-resources
-./prepare_projects $1
-- 
2.14.1


Other related posts:

  • » [codeface] [PATCH 6/7] PatchStack: implement calculation of upstream hashes - Ralf Ramsauer