aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-01-09 11:35:15 +0000
committerPaul Eggleton <paul.eggleton@linux.intel.com>2015-01-14 11:34:11 +0000
commit3e432100b1233ded3936ceb1ff76db7959d37479 (patch)
tree1881459f140e83adb0d3fbac033c2aff4491fd44
parent686ac0b9d41c2b1c6a5b9777934e27a9e0c810d8 (diff)
downloadbuildhistory-web-3e432100b1233ded3936ceb1ff76db7959d37479.tar.gz
buildhistory-web-3e432100b1233ded3936ceb1ff76db7959d37479.tar.bz2
buildhistory-web-3e432100b1233ded3936ceb1ff76db7959d37479.zip
Add the concept of a branch
Support branches in the buildhistory repository. If the branch is specified at import time, check out that branch before proceeding. Also record the branch against the build. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-xwarningmgr/import.py8
-rw-r--r--warningmgr/models.py1
2 files changed, 8 insertions, 1 deletions
diff --git a/warningmgr/import.py b/warningmgr/import.py
index 8fc632b..524aea9 100755
--- a/warningmgr/import.py
+++ b/warningmgr/import.py
@@ -29,6 +29,7 @@ def main():
parser.add_argument('torevision', nargs='?', default='HEAD', help='Ending revision in buildhistory repo (defaults to HEAD)')
parser.add_argument('-m', '--build-name', help='Associated name for the build')
parser.add_argument('-u', '--build-url', help='Associated URL for the build')
+ parser.add_argument('-b', '--branch', help='Branch in the buildhistory repository to use (defaults to currently checked out branch)')
args = parser.parse_args()
# Get access to our Django model
@@ -70,14 +71,19 @@ def main():
repo = git.Repo(args.buildhistorypath)
assert repo.bare == False
- # Import items
+ if args.branch:
+ repo.git.checkout(args.branch)
+
+ # Create a build
b = Build()
b.created_date = datetime.now()
+ b.vcs_branch = repo.head.reference
if args.build_name:
b.name = args.build_name
if args.build_url:
b.build_url = args.build_url
b.save()
+ # Import items
for commit in repo.iter_commits("%s..%s" % (args.sincerevision, args.torevision)):
print("Processing revision %s..." % commit.hexsha)
changes = oe.buildhistory_analysis.process_changes(args.buildhistorypath, "%s^" % commit, commit)
diff --git a/warningmgr/models.py b/warningmgr/models.py
index 6cc155a..9aadedd 100644
--- a/warningmgr/models.py
+++ b/warningmgr/models.py
@@ -12,6 +12,7 @@ class Build(models.Model):
name = models.CharField(max_length=200, blank=True)
created_date = models.DateTimeField('Created')
build_url = models.URLField(blank=True)
+ vcs_branch = models.CharField(max_length=200)
def __unicode__(self):
return self.name or str(self.created_date)