[PATCH] diff: when diffing a revision with a deleted subrepo, maintain the node context (issue3153)

Alistair Bell alistair.bell at netronome.com
Thu Dec 15 15:41:28 CST 2011


# HG changeset patch
# User Alistair Bell <alistair.bell at netronome.com>
# Date 1323985263 18000
# Node ID ab38b93a60dd6607ba30d987d0fc5ec942eec2fc
# Parent  4841035f37b6df368682460d8a7cbf10276b8d1b
diff: when diffing a revision with a deleted subrepo, maintain the node context (issue3153)

diff -r 4841035f37b6 -r ab38b93a60dd mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Thu Dec 15 16:26:33 2011 +0100
+++ b/mercurial/cmdutil.py	Thu Dec 15 16:41:03 2011 -0500
@@ -588,16 +588,17 @@
         ctx1 = repo[node1]
         ctx2 = repo[node2]
         for subpath, sub in subrepo.itersubrepos(ctx1, ctx2):
+            tempnode2 = node2
             try:
                 if node2 is not None:
-                    node2 = ctx2.substate[subpath][1]
+                    tempnode2 = 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
+                tempnode2 = None
             submatch = matchmod.narrowmatcher(subpath, match)
-            sub.diff(diffopts, node2, submatch, changes=changes,
+            sub.diff(diffopts, tempnode2, submatch, changes=changes,
                      stat=stat, fp=fp, prefix=prefix)
 
 class changeset_printer(object):


More information about the Mercurial-devel mailing list