Patchwork [1,of,2,V2] dicthelpers: add docstrings for diff and join

login
register
mail settings
Submitter Siddharth Agarwal
Date March 29, 2013, 11:10 p.m.
Message ID <c1167c0f2bf3d31e2492.1364598635@sid0x220>
Download mbox | patch
Permalink /patch/1225/
State Accepted
Commit 860d36b763ae23890c5b3e801f35b10cd12768f4
Headers show

Comments

Siddharth Agarwal - March 29, 2013, 11:10 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@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

Patch

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)