summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2014-10-21 18:03:53 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-10-21 18:03:55 +0000
commitb4e50e67e84cccd34a9759d2414c7215d657659a (patch)
tree0b6cca46b9bbab16a56e92778d6abc2c4bf5ee16 /project.py
parent0936aeab2ca7553a40d6cc7aa9a13bb083949e10 (diff)
parent14e134da02f3c050c9a6ec31242b45e27bdf4821 (diff)
downloadgit-repo-b4e50e67e84cccd34a9759d2414c7215d657659a.tar.gz
Merge "upload: report names of uncommitted files"
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.