mirror of
https://git.codelinaro.org/clo/tools/repo.git
synced 2025-06-20 02:21:08 +08:00
Warn users before uploading if there are local changes
Change-Id: I231d7b6a3211e9f5ec71a542a0109b0c195d5e40 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:

committed by
Shawn O. Pearce

parent
0cb1b3f687
commit
cc50bac8c7
21
project.py
21
project.py
@ -368,6 +368,27 @@ class Project(object):
|
||||
|
||||
## Status Display ##
|
||||
|
||||
def HasChanges(self):
|
||||
"""Returns true if there are uncommitted changes.
|
||||
"""
|
||||
self.work_git.update_index('-q',
|
||||
'--unmerged',
|
||||
'--ignore-missing',
|
||||
'--refresh')
|
||||
if self.IsRebaseInProgress():
|
||||
return True
|
||||
|
||||
if self.work_git.DiffZ('diff-index', '--cached', HEAD):
|
||||
return True
|
||||
|
||||
if self.work_git.DiffZ('diff-files'):
|
||||
return True
|
||||
|
||||
if self.work_git.LsOthers():
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def PrintWorkTreeStatus(self):
|
||||
"""Prints the status of the repository to stdout.
|
||||
"""
|
||||
|
Reference in New Issue
Block a user