mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Highlight projects which still have sync failures during 'repo status'
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
4e3d6739a1
commit
3d2cdd0ea5
18
project.py
18
project.py
@ -162,6 +162,7 @@ class StatusColoring(Coloring):
|
|||||||
self.project = self.printer('header', attr = 'bold')
|
self.project = self.printer('header', attr = 'bold')
|
||||||
self.branch = self.printer('header', attr = 'bold')
|
self.branch = self.printer('header', attr = 'bold')
|
||||||
self.nobranch = self.printer('nobranch', fg = 'red')
|
self.nobranch = self.printer('nobranch', fg = 'red')
|
||||||
|
self.important = self.printer('important', fg = 'red')
|
||||||
|
|
||||||
self.added = self.printer('added', fg = 'green')
|
self.added = self.printer('added', fg = 'green')
|
||||||
self.changed = self.printer('changed', fg = 'red')
|
self.changed = self.printer('changed', fg = 'red')
|
||||||
@ -244,6 +245,13 @@ class Project(object):
|
|||||||
return b[len(R_HEADS):]
|
return b[len(R_HEADS):]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def IsRebaseInProgress(self):
|
||||||
|
w = self.worktree
|
||||||
|
g = os.path.join(w, '.git')
|
||||||
|
return os.path.exists(os.path.join(g, 'rebase-apply')) \
|
||||||
|
or os.path.exists(os.path.join(g, 'rebase-merge')) \
|
||||||
|
or os.path.exists(os.path.join(w, '.dotest'))
|
||||||
|
|
||||||
def IsDirty(self, consider_untracked=True):
|
def IsDirty(self, consider_untracked=True):
|
||||||
"""Is the working directory modified in some way?
|
"""Is the working directory modified in some way?
|
||||||
"""
|
"""
|
||||||
@ -341,10 +349,11 @@ class Project(object):
|
|||||||
'--unmerged',
|
'--unmerged',
|
||||||
'--ignore-missing',
|
'--ignore-missing',
|
||||||
'--refresh')
|
'--refresh')
|
||||||
|
rb = self.IsRebaseInProgress()
|
||||||
di = self.work_git.DiffZ('diff-index', '-M', '--cached', HEAD)
|
di = self.work_git.DiffZ('diff-index', '-M', '--cached', HEAD)
|
||||||
df = self.work_git.DiffZ('diff-files')
|
df = self.work_git.DiffZ('diff-files')
|
||||||
do = self.work_git.LsOthers()
|
do = self.work_git.LsOthers()
|
||||||
if not di and not df and not do:
|
if not rb and not di and not df and not do:
|
||||||
return 'CLEAN'
|
return 'CLEAN'
|
||||||
|
|
||||||
out = StatusColoring(self.config)
|
out = StatusColoring(self.config)
|
||||||
@ -357,6 +366,10 @@ class Project(object):
|
|||||||
out.branch('branch %s', branch)
|
out.branch('branch %s', branch)
|
||||||
out.nl()
|
out.nl()
|
||||||
|
|
||||||
|
if rb:
|
||||||
|
out.important('prior sync failed; rebase still in progress')
|
||||||
|
out.nl()
|
||||||
|
|
||||||
paths = list()
|
paths = list()
|
||||||
paths.extend(di.keys())
|
paths.extend(di.keys())
|
||||||
paths.extend(df.keys())
|
paths.extend(df.keys())
|
||||||
@ -611,8 +624,7 @@ class Project(object):
|
|||||||
# Currently on a detached HEAD. The user is assumed to
|
# Currently on a detached HEAD. The user is assumed to
|
||||||
# not have any local modifications worth worrying about.
|
# not have any local modifications worth worrying about.
|
||||||
#
|
#
|
||||||
if os.path.exists(os.path.join(self.worktree, '.dotest')) \
|
if self.IsRebaseInProgress():
|
||||||
or os.path.exists(os.path.join(self.worktree, '.git', 'rebase-apply')):
|
|
||||||
syncbuf.fail(self, _PriorSyncFailedError())
|
syncbuf.fail(self, _PriorSyncFailedError())
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user