# HG changeset patch
# User Martin Geisler <mg@lazybytes.net>
# Date 2010-09-10 21:53:49
# Node ID 21eb85e9ea94533f5032d30b606b0da661aff651
# Parent  affec9fb56ef5bfc39d448e54305f9f275ac3d2d

subrepo: handle diff with working copy

We cannot unconditionally call bin(node2) since node2 is None when
comparing with the working copy.

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -307,7 +307,8 @@ class hgsubrepo(abstractsubrepo):
             node1 = node.bin(self._state[1])
             # We currently expect node2 to come from substate and be
             # in hex format
-            node2 = node.bin(node2)
+            if node2 is not None:
+                node2 = node.bin(node2)
             cmdutil.diffordiffstat(self._repo.ui, self._repo, diffopts,
                                    node1, node2, match,
                                    prefix=os.path.join(prefix, self._path),