-
-
Save nmcspadden/b1de506fa935c54e7996 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_commit(imported_item): | |
'''Creates a new feature branch, commits the changes, | |
switches back to master''' | |
# print "Changing location to %s" % autopkglib.get_pref('MUNKI_REPO') | |
os.chdir(autopkglib.get_pref('MUNKI_REPO')) | |
# Now, we need to create a feature branch | |
print "Creating feature branch." | |
branch = '%s-%s' % (str(imported_item['name']), | |
str(imported_item["version"])) | |
print change_feature_branch(branch) | |
# Now add all items to git staging | |
print "Adding items..." | |
gitaddcmd = ['add', '--all'] | |
gitaddcmd.append(autopkglib.get_pref("MUNKI_REPO")) | |
print git_run(gitaddcmd) | |
# Create the commit | |
print "Creating commit..." | |
gitcommitcmd = ['commit', '-m'] | |
message = "Updating %s to version %s" % (str(imported_item['name']), | |
str(imported_item["version"])) | |
gitcommitcmd.append(message) | |
print git_run(gitcommitcmd) | |
# Switch back to master | |
print change_feature_branch('master') | |
# Merge into master first | |
gitmergecmd = ['merge', branch] | |
print git_run(gitmergecmd) | |
# Now push to remote master | |
gitpushcmd = ['push', 'origin', 'master'] | |
print git_run(gitpushcmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment