git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Osterlund <petero2@telia.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: GIT <git@vger.kernel.org>
Subject: Re: Stacked GIT 0.3 (now more Quilt-like)
Date: 08 Jul 2005 03:10:02 +0200	[thread overview]
Message-ID: <m31x6acdcl.fsf@telia.com> (raw)
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

  parent reply	other threads:[~2005-07-08  1:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-28 21:26 Stacked GIT 0.3 (now more Quilt-like) Catalin Marinas
2005-07-03  8:38 ` Peter Osterlund
2005-07-03 10:08   ` Catalin Marinas
2005-07-03 12:38     ` Peter Osterlund
2005-07-03 21:14       ` Catalin Marinas
2005-07-04  1:10         ` Horst von Brand
2005-07-04  6:27         ` Martin Langhoff
2005-07-04 12:32         ` Peter Osterlund
2005-07-04 17:09           ` randy_dunlap
2005-07-04 20:42           ` Catalin Marinas
2005-07-06 20:54           ` Catalin Marinas
2005-07-07 19:17             ` Peter Osterlund
2005-07-07 21:22               ` Catalin Marinas
2005-07-08  1:10 ` Peter Osterlund [this message]
2005-07-08  1:24   ` Junio C Hamano
2005-07-08  8:14     ` Peter Osterlund
2005-07-08  9:32       ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m31x6acdcl.fsf@telia.com \
    --to=petero2@telia.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).