changeset 24943:3e39f67ef663

subrepo: correctly handle git subdirectory status change 'git diff-index' by default does not recurse into subdirectories when changes are found. As a result, the directory is shown as changed, rather than the files in this directory. Adding '-r' results in recursing until the blobs themselves are checked.
author Mathias De Maré <mathias.demare@gmail.com>
date Wed, 06 May 2015 17:15:38 +0200
parents 8174d27576a3
children 08ec11e3ae4c
files mercurial/subrepo.py tests/test-subrepo-git.t
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Wed May 06 16:56:28 2015 -0500
+++ b/mercurial/subrepo.py	Wed May 06 17:15:38 2015 +0200
@@ -1711,7 +1711,7 @@
         modified, added, removed = [], [], []
         self._gitupdatestat()
         if rev2:
-            command = ['diff-tree', rev1, rev2]
+            command = ['diff-tree', '-r', rev1, rev2]
         else:
             command = ['diff-index', rev1]
         out = self._gitcommand(command)
--- a/tests/test-subrepo-git.t	Wed May 06 16:56:28 2015 -0500
+++ b/tests/test-subrepo-git.t	Wed May 06 17:15:38 2015 +0200
@@ -1105,5 +1105,21 @@
   ? s/c.c
   ? s/cpp.cpp
   ? s/foobar.orig
+  $ hg revert --all -q
+
+make sure we show changed files, rather than changed subtrees
+  $ mkdir s/foo
+  $ touch s/foo/bwuh
+  $ hg add s/foo/bwuh
+  $ hg commit -S -m "add bwuh"
+  committing subrepository s
+  $ hg status -S --change .
+  M .hgsubstate
+  A s/foo/bwuh
+  ? s/barfoo
+  ? s/c.c
+  ? s/cpp.cpp
+  ? s/foobar.orig
+  ? s/snake.python.orig
 
   $ cd ..