mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb: Fix git to clean before updating.
This commit is contained in:
@@ -211,6 +211,7 @@ def _git_downloader(url, local, config, opts):
|
|||||||
if not opts.dry_run():
|
if not opts.dry_run():
|
||||||
repo.clone(us[0], local)
|
repo.clone(us[0], local)
|
||||||
else:
|
else:
|
||||||
|
repo.clean(['-f', '-d'])
|
||||||
repo.reset('--hard')
|
repo.reset('--hard')
|
||||||
repo.checkout('master')
|
repo.checkout('master')
|
||||||
for a in us[1:]:
|
for a in us[1:]:
|
||||||
|
@@ -97,6 +97,11 @@ class repo:
|
|||||||
def submodule(self, module):
|
def submodule(self, module):
|
||||||
ec, output = self._run(['submodule', 'update', '--init', module], check = True)
|
ec, output = self._run(['submodule', 'update', '--init', module], check = True)
|
||||||
|
|
||||||
|
def clean(self, args):
|
||||||
|
if type(args) == str:
|
||||||
|
args = [args]
|
||||||
|
ec, output = self._run(['clean'] + args, check = True)
|
||||||
|
|
||||||
def status(self):
|
def status(self):
|
||||||
_status = {}
|
_status = {}
|
||||||
if path.exists(self.path):
|
if path.exists(self.path):
|
||||||
@@ -124,7 +129,7 @@ class repo:
|
|||||||
_status[state] += [l.strip()]
|
_status[state] += [l.strip()]
|
||||||
return _status
|
return _status
|
||||||
|
|
||||||
def clean(self):
|
def dirty(self):
|
||||||
_status = self.status()
|
_status = self.status()
|
||||||
return len(_status) == 1 and 'branch' in _status
|
return len(_status) == 1 and 'branch' in _status
|
||||||
|
|
||||||
|
@@ -302,7 +302,7 @@ class command_line:
|
|||||||
if repo.valid():
|
if repo.valid():
|
||||||
repo_valid = '1'
|
repo_valid = '1'
|
||||||
repo_head = repo.head()
|
repo_head = repo.head()
|
||||||
repo_clean = repo.clean()
|
repo_clean = not repo.dirty()
|
||||||
repo_id = repo_head
|
repo_id = repo_head
|
||||||
if not repo_clean:
|
if not repo_clean:
|
||||||
repo_id += '-modified'
|
repo_id += '-modified'
|
||||||
|
Reference in New Issue
Block a user