diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -588,8 +588,14 @@ def diffordiffstat(ui, repo, diffopts, n ctx1 = repo[node1] ctx2 = repo[node2] for subpath, sub in subrepo.itersubrepos(ctx1, ctx2): - if node2 is not None: - node2 = ctx2.substate[subpath][1] + try: + if node2 is not None: + node2 = ctx2.substate[subpath][1] + except KeyError: + # A subrepo that existed in node1 was deleted between node1 and + # node2 (inclusive). Thus, ctx2's substate won't contain that + # subpath. The best we can do is to ignore it. + node2 = None submatch = matchmod.narrowmatcher(subpath, match) sub.diff(diffopts, node2, submatch, changes=changes, stat=stat, fp=fp, prefix=prefix) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5157,7 +5157,8 @@ def status(ui, repo, *pats, **opts): Examples: - - show changes in the working directory relative to a changeset: + - show changes in the working directory relative to a + changeset:: hg status --rev 9353 diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -259,7 +259,6 @@ class cmdalias(object): return 1 self.fn = fn self.badalias = True - return if self.definition.startswith('!'): diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -885,6 +885,22 @@ Test that removing .hgsub removes .hgsub rm2 +Test issue3153: diff -S with deleted subrepos + + $ hg diff --nodates -S -c . + diff -r 3941e0aa5236 -r 8b31de9d13d1 .hgsub + --- a/.hgsub + +++ /dev/null + @@ -1,2 +0,0 @@ + -s = s + -t = t + diff -r 3941e0aa5236 -r 8b31de9d13d1 .hgsubstate + --- a/.hgsubstate + +++ /dev/null + @@ -1,2 +0,0 @@ + -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s + -e95bcfa18a358dc4936da981ebf4147b4cad1362 t + Test behavior of add for explicit path in subrepo: $ cd .. $ hg init explicit