chiark / gitweb /
Create a new utility function in git.py for setting the HEAD link
authorChuck Lever <cel@netapp.com>
Thu, 6 Oct 2005 10:12:44 +0000 (11:12 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 6 Oct 2005 10:12:44 +0000 (11:12 +0100)
Add a new method in git.py for switching the HEAD link to point to a
different ref.

Signed-off-by: Chuck Lever <cel@netapp.com>
stgit/git.py

index 5dcb90db33249a80adb4d532a48f57510bb1aac5..a118140a01efb0efc7f39281169664d85f75116f 100644 (file)
@@ -233,6 +233,12 @@ def get_head_file():
     """
     return os.path.basename(_output_one_line('git-symbolic-ref HEAD'))
 
+def set_head_file(ref):
+    """Resets HEAD to point to a new ref
+    """
+    if __run('git-symbolic-ref HEAD', [ref]) != 0:
+        raise GitException, 'Could not set head to "%s"' % ref
+
 def __set_head(val):
     """Sets the HEAD value
     """