git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Stacked GIT 0.3 (now more Quilt-like)

From
POPeter Osterlund <petero2@telia.com>
Date
Jul 8, 2005, 01:10 UTC
Message-ID
<m31x6acdcl.fsf@telia.com>
In-Reply-To
<1119994003.9631.6.camel@localhost.localdomain>
Catalin Marinas <catalin.marinas@gmail.com> writes:
> A new StGIT release is available from http://procode.org/stgit/

I think it would be good if it was possible to include diffstat output in exported patches, something like this:

Added possibility to include diffstat output in exported patches.
Signed-off-by: Peter Osterlund <petero2@telia.com>
---
 b/stgit/git.py  |   22 ++++++++++++++++++++++
 b/stgit/main.py |    2 ++
 2 files changed, 24 insertions(+)
diff --git a/stgit/git.py b/stgit/git.py
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -345,6 +345,28 @@ def diff(files = [], rev1 = 'HEAD', rev2
                      % (rev1, files_str, extra_args)) != 0:
             raise GitException, 'git-diff-cache failed'
 
+def diffstat(files = [], rev1 = 'HEAD', rev2 = None):
+    """Return the diffstat between rev1 and rev2
+    """
+    files_str = reduce(lambda x, y: x + ' ' + y, files, '')
+
+    os.system('git-update-cache --refresh > /dev/null')
+
+    if rev2:
+        f = os.popen('git-diff-tree -p %s %s %s | diffstat -p0'
+                     % (rev1, rev2, files_str), 'r')
+        str = f.read()
+        if f.close():
+            raise GitException, 'git-diff-tree failed'
+        return str
+    else:
+        f = os.popen('git-diff-cache -p %s %s | diffstat -p0'
+                     % (rev1, files_str), 'r')
+        str = f.read()
+        if f.close():
+            raise GitException, 'git-diff-cache failed'
+        return str
+
 def checkout(files = [], force = False):
     """Check out the given or all files
     """
diff --git a/stgit/main.py b/stgit/main.py
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -659,6 +659,8 @@ def export(parser, options, args):
         patch = crt_series.get_patch(p)
 
         tmpl_dict = {'description': patch.get_description().rstrip(),
+                     'diffstat': git.diffstat(rev1 = __git_id('%s/bottom' % p),
+                                              rev2 = __git_id('%s/top' % p)),
                      'authname': patch.get_authname(),
                      'authemail': patch.get_authemail(),
                      'authdate': patch.get_authdate(),
-- 
Peter Osterlund - petero2@telia.com
http://web.telia.com/~u89404340
Previous: Catalin MarinasNext: Junio C Hamano
Message 13 of 16 in “Stacked GIT 0.3 (now more Quilt-like)”
  1. Catalin MarinasJun 28, 2005
  2. Peter OsterlundJul 3, 2005
  3. Catalin MarinasJul 3, 2005
  4. Peter OsterlundJul 3, 2005
  5. Catalin MarinasJul 3, 2005
  6. Martin LanghoffJul 4, 2005
  7. Peter OsterlundJul 4, 2005
  8. randy_dunlapJul 4, 2005
  9. Catalin MarinasJul 4, 2005
  10. Catalin MarinasJul 6, 2005
  11. Peter OsterlundJul 7, 2005
  12. Catalin MarinasJul 7, 2005
  13. Peter OsterlundJul 8, 2005
  14. Junio C HamanoJul 8, 2005
  15. Peter OsterlundJul 8, 2005
  16. Catalin MarinasJul 8, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.