##// END OF EJS Templates
summary: make status code more readable...
Martin von Zweigbergk -
r22926:2d0b60b5 default
parent child Browse files
Show More
@@ -5787,38 +5787,35 b' def summary(ui, repo, **opts):'
5787 ui.write(' ' + m, label='log.bookmark')
5787 ui.write(' ' + m, label='log.bookmark')
5788 ui.write('\n', label='log.bookmark')
5788 ui.write('\n', label='log.bookmark')
5789
5789
5790 st = list(repo.status(unknown=True))[:5]
5790 status = repo.status(unknown=True)
5791
5791
5792 c = repo.dirstate.copies()
5792 c = repo.dirstate.copies()
5793 copied, renamed = [], []
5793 copied, renamed = [], []
5794 for d, s in c.iteritems():
5794 for d, s in c.iteritems():
5795 if s in st[2]:
5795 if s in status.removed:
5796 st[2].remove(s)
5796 status.removed.remove(s)
5797 renamed.append(d)
5797 renamed.append(d)
5798 else:
5798 else:
5799 copied.append(d)
5799 copied.append(d)
5800 if d in st[1]:
5800 if d in status.added:
5801 st[1].remove(d)
5801 status.added.remove(d)
5802 st.insert(3, renamed)
5803 st.insert(4, copied)
5804
5802
5805 ms = mergemod.mergestate(repo)
5803 ms = mergemod.mergestate(repo)
5806 st.append([f for f in ms if ms[f] == 'u'])
5804 unresolved = [f for f in ms if ms[f] == 'u']
5807
5805
5808 subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
5806 subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
5809 st.append(subs)
5807
5810
5808 labels = [(ui.label(_('%d modified'), 'status.modified'), status.modified),
5811 labels = [ui.label(_('%d modified'), 'status.modified'),
5809 (ui.label(_('%d added'), 'status.added'), status.added),
5812 ui.label(_('%d added'), 'status.added'),
5810 (ui.label(_('%d removed'), 'status.removed'), status.removed),
5813 ui.label(_('%d removed'), 'status.removed'),
5811 (ui.label(_('%d renamed'), 'status.copied'), renamed),
5814 ui.label(_('%d renamed'), 'status.copied'),
5812 (ui.label(_('%d copied'), 'status.copied'), copied),
5815 ui.label(_('%d copied'), 'status.copied'),
5813 (ui.label(_('%d deleted'), 'status.deleted'), status.deleted),
5816 ui.label(_('%d deleted'), 'status.deleted'),
5814 (ui.label(_('%d unknown'), 'status.unknown'), status.unknown),
5817 ui.label(_('%d unknown'), 'status.unknown'),
5815 (ui.label(_('%d unresolved'), 'resolve.unresolved'), unresolved),
5818 ui.label(_('%d unresolved'), 'resolve.unresolved'),
5816 (ui.label(_('%d subrepos'), 'status.modified'), subs)]
5819 ui.label(_('%d subrepos'), 'status.modified')]
5820 t = []
5817 t = []
5821 for s, l in zip(st, labels):
5818 for l, s in labels:
5822 if s:
5819 if s:
5823 t.append(l % len(s))
5820 t.append(l % len(s))
5824
5821
@@ -5834,7 +5831,8 b' def summary(ui, repo, **opts):'
5834 elif (parents[0].closesbranch() and
5831 elif (parents[0].closesbranch() and
5835 pnode in repo.branchheads(branch, closed=True)):
5832 pnode in repo.branchheads(branch, closed=True)):
5836 t += _(' (head closed)')
5833 t += _(' (head closed)')
5837 elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[8]):
5834 elif not (status.modified or status.added or status.removed or renamed or
5835 copied or subs):
5838 t += _(' (clean)')
5836 t += _(' (clean)')
5839 cleanworkdir = True
5837 cleanworkdir = True
5840 elif pnode not in bheads:
5838 elif pnode not in bheads:
General Comments 0
You need to be logged in to leave comments. Login now