changeset 15644:43bb9c5ab963

merge with crew
author Matt Mackall <mpm@selenic.com>
date Thu, 15 Dec 2011 14:24:38 -0600
parents 4fbd0eeeb52c (current diff) 4841035f37b6 (diff)
children 88a82069be4a
files mercurial/commands.py
diffstat 4 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Dec 15 14:24:29 2011 -0600
+++ b/mercurial/cmdutil.py	Thu Dec 15 14:24:38 2011 -0600
@@ -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	Thu Dec 15 14:24:29 2011 -0600
+++ b/mercurial/commands.py	Thu Dec 15 14:24:38 2011 -0600
@@ -5157,7 +5157,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/mercurial/dispatch.py	Thu Dec 15 14:24:29 2011 -0600
+++ b/mercurial/dispatch.py	Thu Dec 15 14:24:38 2011 -0600
@@ -259,7 +259,6 @@
                 return 1
             self.fn = fn
             self.badalias = True
-
             return
 
         if self.definition.startswith('!'):
--- a/tests/test-subrepo.t	Thu Dec 15 14:24:29 2011 -0600
+++ b/tests/test-subrepo.t	Thu Dec 15 14:24:38 2011 -0600
@@ -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