comparison mercurial/subrepo.py @ 13094:a1dd7bd26a2b

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.
author Eric Eisner <ede@mit.edu>
date Mon, 06 Dec 2010 21:17:27 -0500
parents d0cbddfe3f4c
children 49c7e875482d
comparison
equal deleted inserted replaced
13093:d0cbddfe3f4c 13094:a1dd7bd26a2b
717 717
718 def dirty(self): 718 def dirty(self):
719 if self._state[1] != self._gitstate(): # version checked out changed? 719 if self._state[1] != self._gitstate(): # version checked out changed?
720 return True 720 return True
721 # check for staged changes or modified files; ignore untracked files 721 # check for staged changes or modified files; ignore untracked files
722 # docs say --porcelain flag is future-proof format 722 status = self._gitcommand(['status'])
723 changed = self._gitcommand(['status', '--porcelain', 723 return ('\n# Changed but not updated:' in status or
724 '--untracked-files=no']) 724 '\n# Changes to be committed:' in status)
725 return bool(changed)
726 725
727 def get(self, state): 726 def get(self, state):
728 source, revision, kind = state 727 source, revision, kind = state
729 self._fetch(source, revision) 728 self._fetch(source, revision)
730 # if the repo was set to be bare, unbare it 729 # if the repo was set to be bare, unbare it