Add empty-commit flag when creating a project with no commits

When creating a new project, if you pass the --empty-commit
flag, a sha is created for the master branch allowing for
cloning and other subsequent actions on the repo. If the project
has no commits and is created without the --empty-commit flag,
the repo is created with no sha for the master branch creating
problems with any subsequent actions on the repo.

Change-Id: Ic233057c2503b7fd9fc234d97d71431520ea70b8
This commit is contained in:
Anita Kuno 2014-03-26 12:12:45 -04:00
parent 5c85312837
commit ed6a6c2b67
1 changed files with 3 additions and 1 deletions

View File

@ -205,10 +205,12 @@ class Gerrit(object):
out, err = self._ssh(cmd)
return err
def createProject(self, project, require_change_id=True):
def createProject(self, project, require_change_id=True, empty_repo=False):
cmd = 'gerrit create-project'
if require_change_id:
cmd = '%s --require-change-id' % cmd
if empty_repo:
cmd = '%s --empty-commit' % cmd
cmd = '%s --name %s' % (cmd, project)
out, err = self._ssh(cmd)
return err