##// 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 5787 ui.write(' ' + m, label='log.bookmark')
5788 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 5792 c = repo.dirstate.copies()
5793 5793 copied, renamed = [], []
5794 5794 for d, s in c.iteritems():
5795 if s in st[2]:
5796 st[2].remove(s)
5795 if s in status.removed:
5796 status.removed.remove(s)
5797 5797 renamed.append(d)
5798 5798 else:
5799 5799 copied.append(d)
5800 if d in st[1]:
5801 st[1].remove(d)
5802 st.insert(3, renamed)
5803 st.insert(4, copied)
5800 if d in status.added:
5801 status.added.remove(d)
5804 5802
5805 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 5806 subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
5809 st.append(subs)
5810
5811 labels = [ui.label(_('%d modified'), 'status.modified'),
5812 ui.label(_('%d added'), 'status.added'),
5813 ui.label(_('%d removed'), 'status.removed'),
5814 ui.label(_('%d renamed'), 'status.copied'),
5815 ui.label(_('%d copied'), 'status.copied'),
5816 ui.label(_('%d deleted'), 'status.deleted'),
5817 ui.label(_('%d unknown'), 'status.unknown'),
5818 ui.label(_('%d unresolved'), 'resolve.unresolved'),
5819 ui.label(_('%d subrepos'), 'status.modified')]
5807
5808 labels = [(ui.label(_('%d modified'), 'status.modified'), status.modified),
5809 (ui.label(_('%d added'), 'status.added'), status.added),
5810 (ui.label(_('%d removed'), 'status.removed'), status.removed),
5811 (ui.label(_('%d renamed'), 'status.copied'), renamed),
5812 (ui.label(_('%d copied'), 'status.copied'), copied),
5813 (ui.label(_('%d deleted'), 'status.deleted'), status.deleted),
5814 (ui.label(_('%d unknown'), 'status.unknown'), status.unknown),
5815 (ui.label(_('%d unresolved'), 'resolve.unresolved'), unresolved),
5816 (ui.label(_('%d subrepos'), 'status.modified'), subs)]
5820 5817 t = []
5821 for s, l in zip(st, labels):
5818 for l, s in labels:
5822 5819 if s:
5823 5820 t.append(l % len(s))
5824 5821
@@ -5834,7 +5831,8 b' def summary(ui, repo, **opts):'
5834 5831 elif (parents[0].closesbranch() and
5835 5832 pnode in repo.branchheads(branch, closed=True)):
5836 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 5836 t += _(' (clean)')
5839 5837 cleanworkdir = True
5840 5838 elif pnode not in bheads:
General Comments 0
You need to be logged in to leave comments. Login now