mercurial/patch.py
changeset 24346 31edcea517c1
parent 24341 616c01b69898
child 24371 8a997bd73448
--- a/mercurial/patch.py	Thu Mar 12 17:50:23 2015 -0700
+++ b/mercurial/patch.py	Fri Mar 13 14:08:30 2015 -0700
@@ -893,6 +893,21 @@
         self.hunk = hunk
         self.added, self.removed = self.countchanges(self.hunk)
 
+    def __eq__(self, v):
+        if not isinstance(v, recordhunk):
+            return False
+
+        return ((v.hunk == self.hunk) and
+                (v.proc == self.proc) and
+                (self.fromline == v.fromline) and
+                (self.header.files() == v.header.files()))
+
+    def __hash__(self):
+        return hash((tuple(self.hunk),
+            tuple(self.header.files()),
+            self.fromline,
+            self.proc))
+
     def countchanges(self, hunk):
         """hunk -> (n+,n-)"""
         add = len([h for h in hunk if h[0] == '+'])