subrepo: correctly handle git subdirectory status change
authorMathias De Maré <mathias.demare@gmail.com>
Wed, 06 May 2015 17:15:38 +0200
changeset 24943 3e39f67ef663
parent 24942 8174d27576a3
child 24944 08ec11e3ae4c
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.
mercurial/subrepo.py
tests/test-subrepo-git.t
--- 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 ..