summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-04-18 15:26:10 -0700
committerShawn O. Pearce <sop@google.com>2009-04-18 15:26:10 -0700
commit3d2cdd0ea533e885183ba2952b2bfa05eb1d05ab (patch)
treea55b6335c7073432914d5c22b2423f4e08b6f630 /project.py
parent4e3d6739a17dcc9efc5adb1d915be0a886db700e (diff)
downloadgit-repo-3d2cdd0ea533e885183ba2952b2bfa05eb1d05ab.tar.gz
Highlight projects which still have sync failures during 'repo status'
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/project.py b/project.py
index 3b9535eb..fd3f0b8d 100644
--- a/project.py
+++ b/project.py
@@ -162,6 +162,7 @@ class StatusColoring(Coloring):
162 self.project = self.printer('header', attr = 'bold') 162 self.project = self.printer('header', attr = 'bold')
163 self.branch = self.printer('header', attr = 'bold') 163 self.branch = self.printer('header', attr = 'bold')
164 self.nobranch = self.printer('nobranch', fg = 'red') 164 self.nobranch = self.printer('nobranch', fg = 'red')
165 self.important = self.printer('important', fg = 'red')
165 166
166 self.added = self.printer('added', fg = 'green') 167 self.added = self.printer('added', fg = 'green')
167 self.changed = self.printer('changed', fg = 'red') 168 self.changed = self.printer('changed', fg = 'red')
@@ -244,6 +245,13 @@ class Project(object):
244 return b[len(R_HEADS):] 245 return b[len(R_HEADS):]
245 return None 246 return None
246 247
248 def IsRebaseInProgress(self):
249 w = self.worktree
250 g = os.path.join(w, '.git')
251 return os.path.exists(os.path.join(g, 'rebase-apply')) \
252 or os.path.exists(os.path.join(g, 'rebase-merge')) \
253 or os.path.exists(os.path.join(w, '.dotest'))
254
247 def IsDirty(self, consider_untracked=True): 255 def IsDirty(self, consider_untracked=True):
248 """Is the working directory modified in some way? 256 """Is the working directory modified in some way?
249 """ 257 """
@@ -341,10 +349,11 @@ class Project(object):
341 '--unmerged', 349 '--unmerged',
342 '--ignore-missing', 350 '--ignore-missing',
343 '--refresh') 351 '--refresh')
352 rb = self.IsRebaseInProgress()
344 di = self.work_git.DiffZ('diff-index', '-M', '--cached', HEAD) 353 di = self.work_git.DiffZ('diff-index', '-M', '--cached', HEAD)
345 df = self.work_git.DiffZ('diff-files') 354 df = self.work_git.DiffZ('diff-files')
346 do = self.work_git.LsOthers() 355 do = self.work_git.LsOthers()
347 if not di and not df and not do: 356 if not rb and not di and not df and not do:
348 return 'CLEAN' 357 return 'CLEAN'
349 358
350 out = StatusColoring(self.config) 359 out = StatusColoring(self.config)
@@ -357,6 +366,10 @@ class Project(object):
357 out.branch('branch %s', branch) 366 out.branch('branch %s', branch)
358 out.nl() 367 out.nl()
359 368
369 if rb:
370 out.important('prior sync failed; rebase still in progress')
371 out.nl()
372
360 paths = list() 373 paths = list()
361 paths.extend(di.keys()) 374 paths.extend(di.keys())
362 paths.extend(df.keys()) 375 paths.extend(df.keys())
@@ -611,8 +624,7 @@ class Project(object):
611 # Currently on a detached HEAD. The user is assumed to 624 # Currently on a detached HEAD. The user is assumed to
612 # not have any local modifications worth worrying about. 625 # not have any local modifications worth worrying about.
613 # 626 #
614 if os.path.exists(os.path.join(self.worktree, '.dotest')) \ 627 if self.IsRebaseInProgress():
615 or os.path.exists(os.path.join(self.worktree, '.git', 'rebase-apply')):
616 syncbuf.fail(self, _PriorSyncFailedError()) 628 syncbuf.fail(self, _PriorSyncFailedError())
617 return 629 return
618 630