changeset 13153:dca5488f0e4f

subrepo: use low-level git-diff-index for dirty() Despite its name, git-diff-index compares a revision to the files in the working directory. This seems way less sketchy and more future proof than parsing human-readable git-status.
author Eric Eisner <ede@mit.edu>
date Tue, 14 Dec 2010 21:58:13 -0500
parents 70d80907e4b8
children e11c14f14491
files mercurial/subrepo.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Tue Dec 14 21:56:43 2010 -0500
+++ b/mercurial/subrepo.py	Tue Dec 14 21:58:13 2010 -0500
@@ -718,9 +718,8 @@
         if self._state[1] != self._gitstate(): # version checked out changed?
             return True
         # check for staged changes or modified files; ignore untracked files
-        status = self._gitcommand(['status'])
-        return ('\n# Changed but not updated:' in status or
-                '\n# Changes to be committed:' in status)
+        out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
+        return code == 1
 
     def get(self, state):
         source, revision, kind = state