diff options
author | Chris Johns <chrisj@rtems.org> | 2014-08-09 23:51:02 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-08-09 23:51:02 +1000 |
commit | c21f09e060608de3e6ea1cff71af00b8a2436958 (patch) | |
tree | 794b0c770f2504ce1872f451f8723e5fec98f51e /source-builder/sb/git.py | |
parent | sb: Add support to get sources and hashses. (diff) | |
download | rtems-source-builder-c21f09e060608de3e6ea1cff71af00b8a2436958.tar.bz2 |
sb: Update git support.
Diffstat (limited to 'source-builder/sb/git.py')
-rw-r--r-- | source-builder/sb/git.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/source-builder/sb/git.py b/source-builder/sb/git.py index 890889d..093c443 100644 --- a/source-builder/sb/git.py +++ b/source-builder/sb/git.py @@ -97,7 +97,7 @@ class repo: def submodule(self, module): ec, output = self._run(['submodule', 'update', '--init', module], check = True) - def clean(self, args): + def clean(self, args = []): if type(args) == str: args = [args] ec, output = self._run(['clean'] + args, check = True) @@ -109,29 +109,33 @@ class repo: if ec == 0: state = 'none' for l in output.split('\n'): - if l.startswith('# On branch '): - _status['branch'] = l[len('# On branch '):] - elif l.startswith('# Changes to be committed:'): + if l.startswith('# '): + l = l[2:] + if l.startswith('On branch '): + _status['branch'] = l[len('On branch '):] + elif l.startswith('Changes to be committed:'): state = 'staged' - elif l.startswith('# Changes not staged for commit:'): + elif l.startswith('Changes not staged for commit:'): state = 'unstaged' - elif l.startswith('# Untracked files:'): + elif l.startswith('Untracked files:'): state = 'untracked' - elif l.startswith('# HEAD detached'): + elif l.startswith('HEAD detached'): state = 'detached' - elif state != 'none' and l[0] == '#': - if l.strip() != '#' and not l.startswith('# ('): - if state not in _status: - _status[state] = [] - l = l[1:] - if ':' in l: - l = l.split(':')[1] - _status[state] += [l.strip()] + elif state != 'none' and len(l.strip()) != 0: + if l[0].isspace(): + l = l.strip() + if l[0] != '(': + if state not in _status: + _status[state] = [] + l = l[1:] + if ':' in l: + l = l.split(':')[1] + _status[state] += [l.strip()] return _status def dirty(self): _status = self.status() - return len(_status) == 1 and 'branch' in _status + return not (len(_status) == 1 and 'branch' in _status) def valid(self): if path.exists(self.path): |