aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)