Add patch editing command
[stgit] / stgit / git.py
index 4b4c626..6c55127 100644 (file)
@@ -628,7 +628,8 @@ def apply_diff(rev1, rev2, check_index = True, files = None):
     diff_str = diff(files, rev1, rev2)
     if diff_str:
         try:
-            GRun('git-apply', *index_opt).raw_input(diff_str).no_output()
+            GRun('git-apply', *index_opt).raw_input(
+                diff_str).discard_stderr().no_output()
         except GitRunException:
             return False
 
@@ -761,9 +762,11 @@ def diff(files = None, rev1 = 'HEAD', rev2 = None, diff_flags = []):
     else:
         return ''
 
+# TODO: take another parameter representing a diff string as we
+# usually invoke git.diff() form the calling functions
 def diffstat(files = None, rev1 = 'HEAD', rev2 = None):
     """Return the diffstat between rev1 and rev2."""
-    return GRun('git-apply', '--stat'
+    return GRun('git-apply', '--stat', '--summary'
                 ).raw_input(diff(files, rev1, rev2)).raw_output()
 
 def files(rev1, rev2, diff_flags = []):
@@ -953,7 +956,7 @@ def __remotes_from_dir(dir):
     if os.path.exists(d):
         return os.listdir(d)
     else:
-        return None
+        return []
 
 def remotes_list():
     """Return the list of remotes in the repository