merge with stable
authorMartin Geisler <mg@lazybytes.net>
Thu, 15 Dec 2011 16:26:33 +0100
changeset 15636 4841035f37b6
parent 15632 c9913ef748f7 (current diff)
parent 15635 82f5e471792d (diff)
child 15644 43bb9c5ab963
merge with stable
mercurial/cmdutil.py
mercurial/commands.py
tests/test-subrepo.t
--- a/mercurial/cmdutil.py	Sat Dec 10 18:40:05 2011 +0100
+++ b/mercurial/cmdutil.py	Thu Dec 15 16:26:33 2011 +0100
@@ -588,8 +588,14 @@
         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)
--- a/mercurial/commands.py	Sat Dec 10 18:40:05 2011 +0100
+++ b/mercurial/commands.py	Thu Dec 15 16:26:33 2011 +0100
@@ -5155,7 +5155,8 @@
 
       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
 
--- a/tests/test-subrepo.t	Sat Dec 10 18:40:05 2011 +0100
+++ b/tests/test-subrepo.t	Thu Dec 15 16:26:33 2011 +0100
@@ -885,6 +885,22 @@
   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