[PATCH 4 of 7] subrepo: parse git status's human-readable output

Eric Eisner ede at MIT.EDU
Mon Dec 6 20:37:08 CST 2010


# HG changeset patch
# User Eric Eisner <ede at mit.edu>
# Date 1291688247 18000
# Node ID a1dd7bd26a2b4fce269f8ea4efdf9365e6e18e2f
# Parent  d0cbddfe3f4cd7c00da3d314f3dd36bb808b9bc0
subrepo: parse git status's human-readable output

Older git versions do not have a machine-readable output, but the default
format has not changed over time.

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -719,10 +719,9 @@ class gitsubrepo(object):
         if self._state[1] != self._gitstate(): # version checked out changed?
             return True
         # check for staged changes or modified files; ignore untracked files
-        # docs say --porcelain flag is future-proof format
-        changed = self._gitcommand(['status', '--porcelain',
-                                    '--untracked-files=no'])
-        return bool(changed)
+        status = self._gitcommand(['status'])
+        return ('\n# Changed but not updated:' in status or
+                '\n# Changes to be committed:' in status)
 
     def get(self, state):
         source, revision, kind = state


More information about the Mercurial-devel mailing list