##// END OF EJS Templates
Introduce summary command
Matt Mackall -
r9603:220d39af default
parent child Browse files
Show More
@@ -2877,6 +2877,66 b' def status(ui, repo, *pats, **opts):'
2877 if f in copy:
2877 if f in copy:
2878 ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end))
2878 ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end))
2879
2879
2880 def summary(ui, repo):
2881 """summarize working directory state
2882
2883 This generates a brief summary of the working directory state,
2884 including parents, branch, commit status, and available updates.
2885 """
2886
2887 ctx = repo[None]
2888 parents = ctx.parents()
2889 pnode = parents[0].node()
2890 tags = repo.tags()
2891
2892 for p in parents:
2893 t = ' '.join([t for t in tags if tags[t] == p.node()])
2894 ui.write(_('parent: %d:%s %s\n') % (p.rev(), str(p), t))
2895 ui.status(' ' + p.description().splitlines()[0].strip() + '\n')
2896
2897 branch = ctx.branch()
2898 bheads = repo.branchheads(branch)
2899 ui.status(_('branch: %s\n') % branch)
2900
2901 st = list(repo.status(unknown=True))[:7]
2902 ms = merge_.mergestate(repo)
2903 st.append([f for f in ms if f == 'u'])
2904 labels = _('modified added removed deleted unknown ignored unresolved')
2905 t = []
2906 for i,l in enumerate(labels.split()):
2907 if st[i]:
2908 t.append('%d %s' % (len(st[i]), l))
2909
2910 t = ', '.join(t)
2911
2912 if len(parents) > 1:
2913 t += _(' (merge)')
2914 elif branch != parents[0].branch():
2915 t += _(' (new branch)')
2916 elif (not st[0] and not st[1] and not st[2]):
2917 t += _(' (clean)')
2918 elif pnode not in bheads:
2919 t += _(' (new branch head)')
2920
2921 ui.write(_('commit: %s\n') % t.strip())
2922
2923 # all ancestors of branch heads - all ancestors of parent = new csets
2924 new = [0] * len(repo)
2925 cl = repo.changelog
2926 for a in cl.ancestors(*[cl.rev(n) for n in bheads]):
2927 new[a] = 1
2928 for a in cl.ancestors(*[p.rev() for p in parents]):
2929 new[a] = 0
2930 new = sum(new)
2931
2932 if new == 0:
2933 ui.write(_('update: (current)\n'))
2934 elif pnode not in bheads:
2935 ui.write(_('update: %d new changesets (update)\n') % new)
2936 else:
2937 ui.write(_('update: %d new changesets, %d branch heads (merge)\n') %
2938 (new, len(bheads)))
2939
2880 def tag(ui, repo, name1, *names, **opts):
2940 def tag(ui, repo, name1, *names, **opts):
2881 """add one or more tags for the current or given revision
2941 """add one or more tags for the current or given revision
2882
2942
@@ -3508,6 +3568,8 b' table = {'
3508 (showconfig,
3568 (showconfig,
3509 [('u', 'untrusted', None, _('show untrusted configuration options'))],
3569 [('u', 'untrusted', None, _('show untrusted configuration options'))],
3510 _('[-u] [NAME]...')),
3570 _('[-u] [NAME]...')),
3571 "^summary|sum":
3572 (summary, []),
3511 "^status|st":
3573 "^status|st":
3512 (status,
3574 (status,
3513 [('A', 'all', None, _('show status of all files')),
3575 [('A', 'all', None, _('show status of all files')),
@@ -41,6 +41,7 b' root'
41 serve
41 serve
42 showconfig
42 showconfig
43 status
43 status
44 summary
44 tag
45 tag
45 tags
46 tags
46 tip
47 tip
@@ -159,7 +160,7 b' root'
159
160
160 % Show an error if we use --options with an ambiguous abbreviation
161 % Show an error if we use --options with an ambiguous abbreviation
161 hg: command 's' is ambiguous:
162 hg: command 's' is ambiguous:
162 serve showconfig status
163 serve showconfig status summary
163
164
164 % Show all commands + options
165 % Show all commands + options
165 add: include, exclude, dry-run
166 add: include, exclude, dry-run
@@ -178,6 +179,7 b' push: force, rev, ssh, remotecmd'
178 remove: after, force, include, exclude
179 remove: after, force, include, exclude
179 serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, webdir-conf, pid-file, stdio, templates, style, ipv6, certificate
180 serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, webdir-conf, pid-file, stdio, templates, style, ipv6, certificate
180 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, include, exclude
181 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, include, exclude
182 summary:
181 update: clean, check, date, rev
183 update: clean, check, date, rev
182 addremove: similarity, include, exclude, dry-run
184 addremove: similarity, include, exclude, dry-run
183 archive: no-decode, prefix, rev, type, include, exclude
185 archive: no-decode, prefix, rev, type, include, exclude
@@ -191,6 +191,7 b' list of commands:'
191 serve export the repository via HTTP
191 serve export the repository via HTTP
192 showconfig show combined config settings from all hgrc files
192 showconfig show combined config settings from all hgrc files
193 status show changed files in the working directory
193 status show changed files in the working directory
194 summary summarize working directory state
194 tag add one or more tags for the current or given revision
195 tag add one or more tags for the current or given revision
195 tags list repository tags
196 tags list repository tags
196 tip show the tip revision
197 tip show the tip revision
@@ -258,6 +259,7 b' list of commands:'
258 serve export the repository via HTTP
259 serve export the repository via HTTP
259 showconfig show combined config settings from all hgrc files
260 showconfig show combined config settings from all hgrc files
260 status show changed files in the working directory
261 status show changed files in the working directory
262 summary summarize working directory state
261 tag add one or more tags for the current or given revision
263 tag add one or more tags for the current or given revision
262 tags list repository tags
264 tags list repository tags
263 tip show the tip revision
265 tip show the tip revision
@@ -18,6 +18,7 b' basic commands:'
18 remove remove the specified files on the next commit
18 remove remove the specified files on the next commit
19 serve export the repository via HTTP
19 serve export the repository via HTTP
20 status show changed files in the working directory
20 status show changed files in the working directory
21 summary summarize working directory state
21 update update working directory
22 update update working directory
22
23
23 use "hg help" for the full list of commands or "hg -v" for details
24 use "hg help" for the full list of commands or "hg -v" for details
@@ -37,6 +38,7 b' use "hg help" for the full list of comma'
37 remove remove the specified files on the next commit
38 remove remove the specified files on the next commit
38 serve export the repository via HTTP
39 serve export the repository via HTTP
39 status show changed files in the working directory
40 status show changed files in the working directory
41 summary summarize working directory state
40 update update working directory
42 update update working directory
41 Mercurial Distributed SCM
43 Mercurial Distributed SCM
42
44
@@ -84,6 +86,7 b' list of commands:'
84 serve export the repository via HTTP
86 serve export the repository via HTTP
85 showconfig show combined config settings from all hgrc files
87 showconfig show combined config settings from all hgrc files
86 status show changed files in the working directory
88 status show changed files in the working directory
89 summary summarize working directory state
87 tag add one or more tags for the current or given revision
90 tag add one or more tags for the current or given revision
88 tags list repository tags
91 tags list repository tags
89 tip show the tip revision
92 tip show the tip revision
@@ -147,6 +150,7 b' use "hg -v help" to show aliases and glo'
147 serve export the repository via HTTP
150 serve export the repository via HTTP
148 showconfig show combined config settings from all hgrc files
151 showconfig show combined config settings from all hgrc files
149 status show changed files in the working directory
152 status show changed files in the working directory
153 summary summarize working directory state
150 tag add one or more tags for the current or given revision
154 tag add one or more tags for the current or given revision
151 tags list repository tags
155 tags list repository tags
152 tip show the tip revision
156 tip show the tip revision
@@ -319,6 +323,7 b' basic commands:'
319 remove remove the specified files on the next commit
323 remove remove the specified files on the next commit
320 serve export the repository via HTTP
324 serve export the repository via HTTP
321 status show changed files in the working directory
325 status show changed files in the working directory
326 summary summarize working directory state
322 update update working directory
327 update update working directory
323
328
324 use "hg help" for the full list of commands or "hg -v" for details
329 use "hg help" for the full list of commands or "hg -v" for details
@@ -343,6 +348,7 b' basic commands:'
343 remove remove the specified files on the next commit
348 remove remove the specified files on the next commit
344 serve export the repository via HTTP
349 serve export the repository via HTTP
345 status show changed files in the working directory
350 status show changed files in the working directory
351 summary summarize working directory state
346 update update working directory
352 update update working directory
347
353
348 use "hg help" for the full list of commands or "hg -v" for details
354 use "hg help" for the full list of commands or "hg -v" for details
@@ -20,6 +20,7 b' basic commands:'
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve export the repository via HTTP
21 serve export the repository via HTTP
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 update update working directory
24 update update working directory
24
25
25 use "hg help" for the full list of commands or "hg -v" for details
26 use "hg help" for the full list of commands or "hg -v" for details
@@ -21,6 +21,7 b' basic commands:'
21 remove remove the specified files on the next commit
21 remove remove the specified files on the next commit
22 serve export the repository via HTTP
22 serve export the repository via HTTP
23 status show changed files in the working directory
23 status show changed files in the working directory
24 summary summarize working directory state
24 update update working directory
25 update update working directory
25
26
26 use "hg help" for the full list of commands or "hg -v" for details
27 use "hg help" for the full list of commands or "hg -v" for details
General Comments 0
You need to be logged in to leave comments. Login now