chiark / gitweb /
Add support for branch in the patch id
[stgit] / stgit / git.py
index 293d4213f1e2e4c03201efffa4b5aedf0adbc410..a45671b2f1d9e0c9ec7e823eb99d9d2f6328beb3 100644 (file)
@@ -113,7 +113,10 @@ def get_conflicts():
 
 def _input(cmd, file_desc):
     p = popen2.Popen3(cmd)
-    for line in file_desc:
+    while True:
+        line = file_desc.readline()
+        if not line:
+            break
         p.tochild.write(line)
     p.tochild.close()
     if p.wait():
@@ -230,6 +233,11 @@ def __set_head(val):
     """
     write_string(head_link, val)
 
+def rev_parse(git_id):
+    """Parse the string and return an SHA1 id
+    """
+    return _output(['git-rev-parse', git_id]).strip()
+
 def add(names):
     """Add the files or recursively add the directory contents
     """