diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -from node import hex, bin, nullid, nullrev, short +from node import hex, nullid, nullrev, short from i18n import _ import os, sys, errno, re, glob, tempfile import util, templater, patch, error, encoding, templatekw @@ -685,7 +685,7 @@ def diffordiffstat(ui, repo, diffopts, n ctx2 = repo[node2] for subpath, sub in subrepo.itersubrepos(ctx1, ctx2): if node2 is not None: - node2 = bin(ctx2.substate[subpath][1]) + node2 = ctx2.substate[subpath][1] submatch = matchmod.narrowmatcher(subpath, match) sub.diff(diffopts, node2, submatch, changes=changes, stat=stat, fp=fp, prefix=prefix) diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -305,6 +305,9 @@ class hgsubrepo(abstractsubrepo): def diff(self, diffopts, node2, match, prefix, **opts): try: node1 = node.bin(self._state[1]) + # We currently expect node2 to come from substate and be + # in hex format + node2 = node.bin(node2) cmdutil.diffordiffstat(self._repo.ui, self._repo, diffopts, node1, node2, match, prefix=os.path.join(prefix, self._path), diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t --- a/tests/test-subrepo-svn.t +++ b/tests/test-subrepo-svn.t @@ -153,6 +153,17 @@ this commit fails because of externals c $ hg ci -m 'amend externals from hg' committing subrepository s abort: cannot commit svn externals + $ hg diff --subrepos -r 1:2 | grep -v diff + --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -2 s + +3 s + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,2 @@ + a + +a $ svn revert -q s/externals/other this commit fails because of externals meta changes