summaryrefslogtreecommitdiff
path: root/coverage/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/data.py')
-rw-r--r--coverage/data.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/coverage/data.py b/coverage/data.py
index f2e528d4..e5c37cb7 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -267,9 +267,19 @@ class CoverageData(object):
return list(self._arcs or self._lines)
def add_to_hash(self, filename, hasher):
- """Contribute `filename`'s data to the Md5Hash `hasher`."""
- hasher.update(self.lines(filename))
- hasher.update(self.arcs(filename))
+ """Contribute `filename`'s data to the `hasher`.
+
+ Arguments:
+ filename (str): the filename we're interested in.
+ hasher (:class:`coverage.misc.Hasher`): the Hasher to update with
+ the file's data.
+
+ """
+ if self._arcs:
+ hasher.update(sorted(self.arcs(filename)))
+ else:
+ hasher.update(sorted(self.lines(filename)))
+ hasher.update(self.plugin_name(filename))
def line_counts(self, fullpath=False):
"""Return a dict summarizing the line coverage data.