summaryrefslogtreecommitdiff
path: root/morphlib/git.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-12-05 17:51:47 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-12-13 14:30:35 +0000
commit51e4bbb4dffde9574404df9c5e947f518dc49a41 (patch)
tree208d2826e88932f2442c44b4268bdda76346206f /morphlib/git.py
parentd63c97a0bef1cd2f03ca266acda67cad065632df (diff)
downloadmorph-51e4bbb4dffde9574404df9c5e947f518dc49a41.tar.gz
Add an initial implementation of "morph tag"
In order to make releases and freeze system branches entirely, we need to be able to 100% petrify a system branch (that is, resolve ALL refs into SHA1s) and tag this state to be able to check it out again later. This is essentially what "morph tag" does. It takes a tag name and an arbitrary amount of arguments to "git tag", petrifies all morphologies of the current system branch behind the scenes, creates a dangling commit and attaches an annotated tag to it. Petrifying in this case means that all refs used for chunks are resolved into commit SHA1s. For stratum and system morphologies, the refs are replaced by the name of the tag that's being created. The "tag" command also supports tagging when stratum morphologies are spread across multiple repositories. In this case, it will include all statum morphologies from other repos in the tag commi in the branch root repo. The references to these morphologies are updated so that they point to the branch root repo and the tag being created. This commit also adds a few tests for "morph tag" to verify that all this works.
Diffstat (limited to 'morphlib/git.py')
-rw-r--r--morphlib/git.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/morphlib/git.py b/morphlib/git.py
index 7985b815..a37b6675 100644
--- a/morphlib/git.py
+++ b/morphlib/git.py
@@ -170,6 +170,19 @@ def get_user_name(runcmd):
' git config --global user.email "me@example.com"\n')
+def get_user_email(runcmd):
+ '''Get user.email configuration setting. Complain if none was found.'''
+ if 'GIT_AUTHOR_EMAIL' in os.environ:
+ return os.environ['GIT_AUTHOR_EMAIL'].strip()
+ try:
+ return runcmd(['git', 'config', 'user.email']).strip()
+ except cliapp.AppException:
+ raise cliapp.AppException(
+ 'No git user info found. Please set your identity, using: \n'
+ ' git config --global user.email "My Name"\n'
+ ' git config --global user.email "me@example.com"\n')
+
+
def set_remote(runcmd, gitdir, name, url):
'''Set remote with name 'name' use a given url at gitdir'''
return runcmd(['git', 'remote', 'set-url', name, url], cwd=gitdir)