File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -114,8 +114,8 @@ class DiffIndex(list):
114114 # A = Added
115115 # D = Deleted
116116 # R = Renamed
117- # NOTE: 'Modified' mode is impllied as it wouldn't be listed as a diff otherwise
118- change_type = ("A" , "D" , "R" )
117+ # M = modified
118+ change_type = ("A" , "D" , "R" , "M" )
119119
120120
121121 def iter_change_type (self , change_type ):
@@ -124,7 +124,15 @@ def iter_change_type(self, change_type):
124124 iterator yieling Diff instances that match the given change_type
125125
126126 ``change_type``
127- Member of DiffIndex.change_type
127+ Member of DiffIndex.change_type, namely
128+
129+ 'A' for added paths
130+
131+ 'D' for deleted paths
132+
133+ 'R' for renamed paths
134+
135+ 'M' for paths with modified data
128136 """
129137 if change_type not in self .change_type :
130138 raise ValueError ( "Invalid change type: %s" % change_type )
@@ -136,6 +144,8 @@ def iter_change_type(self, change_type):
136144 yield diff
137145 elif change_type == "R" and diff .renamed :
138146 yield diff
147+ elif change_type == "M" and diff .a_blob and diff .b_blob and diff .a_blob != diff .b_blob :
148+ yield diff
139149 # END for each diff
140150
141151
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def test_diff_patch_format(self):
4141 def test_diff_interface (self ):
4242 # test a few variations of the main diff routine
4343 assertion_map = dict ()
44- for i , commit in enumerate (self .rorepo .iter_commits ('0.1.6' , max_count = 10 )):
44+ for i , commit in enumerate (self .rorepo .iter_commits ('0.1.6' , max_count = 2 )):
4545 diff_item = commit
4646 if i % 2 == 0 :
4747 diff_item = commit .tree
You can’t perform that action at this time.
0 commit comments