Fix sync to push the popped patches back after sync'ing
[stgit] / stgit / git.py
index 4cc35c9..deb5efc 100644 (file)
@@ -767,11 +767,14 @@ def merge(base, head1, head2, recursive = False):
     if errors:
         raise GitException, 'GIT index merging failed (possible conflicts)'
 
-def diff(files = None, rev1 = 'HEAD', rev2 = None, diff_flags = []):
+def diff(files = None, rev1 = 'HEAD', rev2 = None, diff_flags = [],
+         binary = True):
     """Show the diff between rev1 and rev2
     """
     if not files:
         files = []
+    if binary and '--binary' not in diff_flags:
+        diff_flags = diff_flags + ['--binary']
 
     if rev1 and rev2:
         return GRun('diff-tree', '-p',
@@ -815,13 +818,10 @@ def barefiles(rev1, rev2):
 
     return '\n'.join(result)
 
-def pretty_commit(commit_id = 'HEAD', diff_flags = []):
+def pretty_commit(commit_id = 'HEAD', flags = []):
     """Return a given commit (log + diff)
     """
-    return GRun('diff-tree',
-                *(diff_flags
-                  + ['--cc', '--always', '--pretty', '-r', commit_id])
-                ).raw_output()
+    return GRun('show', *(flags + [commit_id])).raw_output()
 
 def checkout(files = None, tree_id = None, force = False):
     """Check out the given or all files