[PATCH 1 of 2 V2] dicthelpers: add docstrings for diff and join
Siddharth Agarwal
sid0 at fb.com
Fri Mar 29 23:10:35 UTC 2013
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1364595799 25200
# Fri Mar 29 15:23:19 2013 -0700
# Node ID c1167c0f2bf3d31e2492af0b45803bc4d874502e
# Parent 15df5f169d64975148d7f0521f40cb6a70e2f590
dicthelpers: add docstrings for diff and join
diff --git a/mercurial/dicthelpers.py b/mercurial/dicthelpers.py
--- a/mercurial/dicthelpers.py
+++ b/mercurial/dicthelpers.py
@@ -29,7 +29,18 @@ def _diffjoin(d1, d2, default, compare):
return res
def diff(d1, d2, default=None):
+ '''Return all key-value pairs that are different between d1 and d2.
+
+ This includes keys that are present in one dict but not the other, and
+ keys whose values are different. The return value is a dict with values
+ being pairs of values from d1 and d2 respectively, and missing values
+ represented as default.'''
return _diffjoin(d1, d2, default, True)
def join(d1, d2, default=None):
+ '''Return all key-value pairs from both d1 and d2.
+
+ This is akin to an outer join in relational algebra. The return value is a
+ dict with values being pairs of values from d1 and d2 respectively, and
+ missing values represented as default.'''
return _diffjoin(d1, d2, default, False)
More information about the Mercurial-devel
mailing list