[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] change meaning of option values of generate_diff in mailer.py

From: Mathias Weinert <mathias.weinert_at_gfa-net.de>
Date: 2006-08-22 13:15:09 CEST

Hi,

I want to change the interpretation of the generate_diffs option in
mailer.py. 'copy' will then mean 'path is copied and not changed
afterwards' and 'modify' will mean 'path is modified or a copy of
another path that was modified after copying'.

IMO this makes more sense than the way it is now. Today diffs for
'copied and changed' paths are shown with 'copy' and diffs for 'copied
and unchanged' paths can't be produced at all. With this change 'modify'
will show *all* modified paths and 'copy' allows to see diffs for
copied paths (which is the whole path like it is for 'add'). If I'm
e. g. only interested in the trunk a path copied from a branch is as
interesting for me as any newly added path.

Any objections against this change?

Mathias

[[[
Change the interpretation of the generate_diffs option in mailer.py.
'copy' now means 'path is copied and not changed afterwards' and
'modify' now means 'path is modified or a copy of another path that
was modified after copying'.
With this change 'modify' shows *all* modified paths and 'copy'
now allows to see diffs for copied paths (which is the whole path like
it is for 'add').

* tools/hook-scripts/mailer/mailer.py
  Interpret the values 'modify' and 'copy' of the generate_diffs option
  as described above. Therefor introduce a new diff kind 'CM' for paths
  that were copied and modified afterwards.

* tools/hook-scripts/mailer/mailer.conf.example
  - Add explanation of the possible values of the generate_diffs option
    according to the change described above.
  - Minor corrections in text.

* tools/hook-scripts/mailer/tests/mailer-t1.output
  Reflect change described above.
]]]

--- tools/hook-scripts/mailer/mailer.conf.example.orig 2006-08-22 11:09:54.068882900 +0200
+++ tools/hook-scripts/mailer/mailer.conf.example 2006-08-22 11:24:59.413774300 +0200
@@ -177,13 +177,20 @@
 reply_to =
 
 # Specify which types of repository changes mailer.py will create
-# diffs for. Valid options are any combination of
+# diffs for. Valid options are any combination of
 # 'add copy modify delete', or 'none' to never create diffs.
 # If the generate_diffs option is empty, the selection is controlled
 # by the deprecated options suppress_deletes and suppress_adds.
-# Note that only affects the display of diffs - all changes are
+# Note that this only affects the display of diffs - all changes are
 # mentioned in the summary of changed paths at the top of the message,
 # regardless of this option's value.
+# Meaning of the possible values:
+# add: generates diffs for all added paths
+# copy: generates diffs for all copied paths
+# which were not changed after copying
+# modify: generates diffs for all modified paths, including paths that were
+# copied and modified afterwards (within the same commit)
+# delete: generates diffs for all removed paths
 generate_diffs = add copy modify
 
 # Diff URL construction. For the configured diff URL types, the diff
--- tools/hook-scripts/mailer/mailer.py.orig 2006-08-22 11:09:29.584507900 +0200
+++ tools/hook-scripts/mailer/mailer.py 2006-08-22 12:33:00.431727900 +0200
@@ -750,17 +750,17 @@
 
       elif change.added:
         if change.base_path and (change.base_rev != -1):
- # this file was copied.
- kind = 'C'
 
           # any diff of interest?
           if change.text_changed:
+ # this file was copied and modified.
+ kind = 'W'
 
             # get the diff url, if any is specified
             diff_url = self.diffurls.get_copy_url(self.repos.rev, change)
 
             # show the diff?
- if self.diffsels.copy:
+ if self.diffsels.modify:
               diff = svn.fs.FileDiff(self.repos.get_root(change.base_rev),
                                      change.base_path,
                                      self.repos.root_this, change.path,
@@ -768,6 +768,15 @@
               label1 = change.base_path + '\t(original)'
               label2 = '%s\t%s' % (change.path, self.date)
               singular = False
+ else:
+ # this file was copied.
+ kind = 'C'
+ if self.diffsels.copy:
+ diff = svn.fs.FileDiff(None, None, self.repos.root_this,
+ change.path, self.pool)
+ label1 = change.base_path + '\t(original)'
+ label2 = '%s\t%s' % (change.path, self.date)
+ singular = False
         else:
           # the file was added.
           kind = 'A'
@@ -963,11 +972,14 @@
         section_header_printed = True
       if diff.kind == 'D':
         w('\nDeleted: %s\n' % diff.base_path)
+ elif diff.kind == 'A':
+ w('\nAdded: %s\n' % diff.path)
       elif diff.kind == 'C':
         w('\nCopied: %s (from r%d, %s)\n'
           % (diff.path, diff.base_rev, diff.base_path))
- elif diff.kind == 'A':
- w('\nAdded: %s\n' % diff.path)
+ elif diff.kind == 'W':
+ w('\nCopied and modified: %s (from r%d, %s)\n'
+ % (diff.path, diff.base_rev, diff.base_path))
       else:
         # kind == 'M'
         w('\nModified: %s\n' % diff.path)
--- tools/hook-scripts/mailer/tests/mailer-t1.output.orig 2006-08-22 11:10:54.975132900 +0200
+++ tools/hook-scripts/mailer/tests/mailer-t1.output 2006-08-22 12:55:53.448707700 +0200
@@ -103,6 +103,13 @@
       - copied unchanged from r1, /file1
    dir3/
       - copied from r1, /dir1/
+
+Copied: dir2/file7 (from r1, /file1)
+==============================================================================
+--- /file1 (original)
++++ dir2/file7 Sun Sep 9 07:20:00 2001
+@@ -0,0 +1 @@
++file1
 Group: defaults
 Subject: r4 - dir3
 
@@ -117,7 +124,7 @@
    dir3/file8
       - copied, changed from r1, /file1
 
-Copied: dir3/file8 (from r1, /file1)
+Copied and modified: dir3/file8 (from r1, /file1)
 ==============================================================================
 --- /file1 (original)
 +++ dir3/file8 Sun Sep 9 10:06:40 2001
@@ -215,6 +222,14 @@
 Modified:
    dir6/file4
 
+Copied: dir6/file3 (from r6, /dir3/file3)
+==============================================================================
+--- /dir3/file3 (original)
++++ dir6/file3 Sun Sep 9 18:26:40 2001
+@@ -0,0 +1,2 @@
++file3
++change C5
+
 Modified: dir6/file4
 ==============================================================================
 --- /dir3/file4 (original)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 22 13:15:56 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.