# HG changeset patch # User Martin Geisler # Date 2011-12-15 15:26:33 # Node ID 4841035f37b6df368682460d8a7cbf10276b8d1b # Parent c9913ef748f74419aaa25b0058e93e7c75dde3f8 # Parent 82f5e471792d04a61ebb8d6e30faefe143954710 merge with stable 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 @@ -5155,7 +5155,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/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