subrepo: add status support for ignored files in git subrepos
authorMathias De Maré <mathias.demare@gmail.com>
Fri, 28 Nov 2014 20:16:15 +0100
changeset 23411 2d86f4e38c08
parent 23410 cd9e5e57064d
child 23426 19ebd2f88fc7
subrepo: add status support for ignored files in git subrepos Retrieving the status of a git subrepo did not show ignored files. Using 'git ls-files', we can retrieve these files and display the correct status.
mercurial/subrepo.py
tests/test-subrepo-git.t
--- a/mercurial/subrepo.py	Wed Nov 26 15:37:01 2014 -0800
+++ b/mercurial/subrepo.py	Fri Nov 28 20:16:15 2014 +0100
@@ -1570,6 +1570,15 @@
                 removed.append(f)
 
         deleted, unknown, ignored, clean = [], [], [], []
+
+        if not rev2:
+            command = ['ls-files', '--others', '--exclude-standard']
+            out = self._gitcommand(command)
+            for line in out.split('\n'):
+                if len(line) == 0:
+                    continue
+                unknown.append(line)
+
         return scmutil.status(modified, added, removed, deleted,
                               unknown, ignored, clean)
 
--- a/tests/test-subrepo-git.t	Wed Nov 26 15:37:01 2014 -0800
+++ b/tests/test-subrepo-git.t	Fri Nov 28 20:16:15 2014 +0100
@@ -119,7 +119,10 @@
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ cd ../tb/s
+  $ hg status --subrepos
   $ echo f > f
+  $ hg status --subrepos
+  ? s/f
   $ git add f
   $ cd ..
 
@@ -422,6 +425,7 @@
   $ hg status -S
   M s/g
   A s/f1
+  ? s/f2
   $ ls s
   f
   f1
@@ -430,6 +434,8 @@
   $ hg update --clean
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status -S
+  ? s/f1
+  ? s/f2
   $ ls s
   f
   f1