[codeface] [PATCH] When revisions are not specified use date ranges

  • From: Mitchell Joblin <joblin.m@xxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Fri, 15 Aug 2014 10:49:30 +0200

commit 7d532f5a6eac1cb61f930ff3407b3f437d5cb3d1
Author: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx>
Date:   Thu Aug 14 18:16:48 2014 +0200

    When revisions are not specified use date ranges

    - In the case of no revisions in the configuration file we
      automatically generate the revision windows but the
      follow analysis needs to be performed in terms of dates
      not using the double dot (i.e. rev1..rev2) range

    Signed-off-by: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx>

diff --git a/codeface/cluster/cluster.py b/codeface/cluster/cluster.py
index d52d92e..f781247 100755
--- a/codeface/cluster/cluster.py
+++ b/codeface/cluster/cluster.py
@@ -51,7 +51,8 @@ class LinkType:
     file             = "file"


-def createDB(filename, git_repo, revrange, subsys_descr, link_type,
rcranges=None):
+def createDB(filename, git_repo, revrange, subsys_descr, link_type,
+             range_by_date, rcranges=None):
     #------------------
     #configuration
     #------------------
@@ -59,6 +60,7 @@ def createDB(filename, git_repo, revrange, subsys_descr,
link_type, rcranges=Non
     git.setRepository(git_repo)
     git.setRevisionRange(revrange[0], revrange[1])
     git.setSubsysDescription(subsys_descr)
+    git.setRangeByDate(range_by_date)

     if rcranges != None:
         git.setRCRanges(rcranges)
@@ -1221,15 +1223,15 @@ def computeSimilarity(cmtlist):
 # Main part
 ###########################################################################
 def performAnalysis(conf, dbm, dbfilename, git_repo, revrange,
subsys_descr,
-                    create_db, outdir, rcranges=None,
-                    limit_history=False):
+                    create_db, outdir, limit_history,
+                    range_by_date, rcranges=None):
     link_type = conf["tagging"]

     if create_db == True:
         log.devinfo("Creating data base for {0}..{1}".format(revrange[0],
                                                         revrange[1]))
         createDB(dbfilename, git_repo, revrange, subsys_descr, \
-                 link_type, rcranges)
+                 link_type, range_by_date, rcranges)

     projectID = dbm.getProjectID(conf["project"], conf["tagging"])
     revisionIDs = (dbm.getRevisionID(projectID, revrange[0]),
@@ -1282,7 +1284,7 @@ def performAnalysis(conf, dbm, dbfilename, git_repo,
revrange, subsys_descr,

 ##################################################################
 def doProjectAnalysis(conf, from_rev, to_rev, rc_start, outdir,
-                      git_repo, create_db, limit_history=False):
+                      git_repo, create_db, limit_history, range_by_date):
     #--------------
     #folder setup
     #--------------
@@ -1305,9 +1307,8 @@ def doProjectAnalysis(conf, from_rev, to_rev,
rc_start, outdir,
     filename = os.path.join(outdir, "vcs_analysis.db")
     dbm = DBManager(conf)
     performAnalysis(conf, dbm, filename, git_repo, [from_rev, to_rev],
-#                        kerninfo.subsysDescrLinux,
-                        None,
-                        create_db, outdir, rc_range, limit_history)
+                    None, create_db, outdir, limit_history, range_by_date,
+                    rc_range)

 ##################################
 #         TESTING CODE
diff --git a/codeface/project.py b/codeface/project.py
index ca3ab1e..a311fb7 100644
--- a/codeface/project.py
+++ b/codeface/project.py
@@ -57,12 +57,14 @@ def project_analyse(resdir, gitdir, codeface_conf,
project_conf,
     project, tagging = conf["project"], conf["tagging"]
     repo = pathjoin(gitdir, conf["repo"], ".git")
     project_resdir = pathjoin(resdir, project, tagging)
+    range_by_date = False

     # When revisions are not provided by the configuration file
     # generate the analysis window automatically
     if len(conf["revisions"]) < 2:
-    window_size_months = 3 # Window size in months
-    conf["revisions"], conf["rcs"] = generate_analysis_windows(repo,
window_size_months)
+        window_size_months = 3 # Window size in months
+        conf["revisions"], conf["rcs"] = generate_analysis_windows(repo,
window_size_months)
+        range_by_date = True

     # TODO: Sanity checks (ensure that git repo dir exists)
     if 'proximity' == conf["tagging"]:
@@ -86,7 +88,7 @@ def project_analyse(resdir, gitdir, codeface_conf,
project_conf,
         s1 = pool.add(
                 doProjectAnalysis,
                 (conf, start_rev, end_rev, rc_rev, range_resdir, repo,
-                    True, True),
+                    True, True, range_by_date),
                 startmsg=prefix + "Analysing commits...",
                 endmsg=prefix + "Commit analysis done."
             )

Other related posts:

  • » [codeface] [PATCH] When revisions are not specified use date ranges - Mitchell Joblin