summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'project.py')
-rw-r--r--project.py42
1 files changed, 32 insertions, 10 deletions
diff --git a/project.py b/project.py
index 95403ccb..316ce7ba 100644
--- a/project.py
+++ b/project.py
@@ -736,27 +736,49 @@ class Project(object):
736 return matched 736 return matched
737 737
738## Status Display ## 738## Status Display ##
739 def UncommitedFiles(self, get_all=True):
740 """Returns a list of strings, uncommitted files in the git tree.
739 741
740 def HasChanges(self): 742 Args:
741 """Returns true if there are uncommitted changes. 743 get_all: a boolean, if True - get information about all different
744 uncommitted files. If False - return as soon as any kind of
745 uncommitted files is detected.
742 """ 746 """
747 details = []
743 self.work_git.update_index('-q', 748 self.work_git.update_index('-q',
744 '--unmerged', 749 '--unmerged',
745 '--ignore-missing', 750 '--ignore-missing',
746 '--refresh') 751 '--refresh')
747 if self.IsRebaseInProgress(): 752 if self.IsRebaseInProgress():
748 return True 753 details.append("rebase in progress")
754 if not get_all:
755 return details
749 756
750 if self.work_git.DiffZ('diff-index', '--cached', HEAD): 757 changes = self.work_git.DiffZ('diff-index', '--cached', HEAD).keys()
751 return True 758 if changes:
759 details.extend(changes)
760 if not get_all:
761 return details
752 762
753 if self.work_git.DiffZ('diff-files'): 763 changes = self.work_git.DiffZ('diff-files').keys()
754 return True 764 if changes:
765 details.extend(changes)
766 if not get_all:
767 return details
755 768
756 if self.work_git.LsOthers(): 769 changes = self.work_git.LsOthers()
757 return True 770 if changes:
771 details.extend(changes)
758 772
759 return False 773 return details
774
775 def HasChanges(self):
776 """Returns true if there are uncommitted changes.
777 """
778 if self.UncommitedFiles(get_all=False):
779 return True
780 else:
781 return False
760 782
761 def PrintWorkTreeStatus(self, output_redir=None): 783 def PrintWorkTreeStatus(self, output_redir=None):
762 """Prints the status of the repository to stdout. 784 """Prints the status of the repository to stdout.