# HG changeset patch # User Eric Eisner # Date 1292381893 18000 # Node ID dca5488f0e4fde240feae077f195522f33049caf # Parent 70d80907e4b873b99c39ad3a0aa90287c0d7c8b3 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. diff -r 70d80907e4b8 -r dca5488f0e4f mercurial/subrepo.py --- 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