comparison mercurial/commands.py @ 9620:a7ef354da662

summary: add --remote
author Matt Mackall <mpm@selenic.com>
date Tue, 20 Oct 2009 11:59:38 -0500
parents c4a6ce16708a
children 022b15b9ec8c
comparison
equal deleted inserted replaced
9619:c4a6ce16708a 9620:a7ef354da662
2875 for f in files: 2875 for f in files:
2876 ui.write(format % repo.pathto(f, cwd)) 2876 ui.write(format % repo.pathto(f, cwd))
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): 2880 def summary(ui, repo, **opts):
2881 """summarize working directory state 2881 """summarize working directory state
2882 2882
2883 This generates a brief summary of the working directory state, 2883 This generates a brief summary of the working directory state,
2884 including parents, branch, commit status, and available updates. 2884 including parents, branch, commit status, and available updates.
2885
2886 With the --remote option, this will check the default paths for
2887 incoming and outgoing changes. This can be time-consuming.
2885 """ 2888 """
2886 2889
2887 ctx = repo[None] 2890 ctx = repo[None]
2888 parents = ctx.parents() 2891 parents = ctx.parents()
2889 pnode = parents[0].node() 2892 pnode = parents[0].node()
2945 elif pnode not in bheads: 2948 elif pnode not in bheads:
2946 ui.write(_('update: %d new changesets (update)\n') % new) 2949 ui.write(_('update: %d new changesets (update)\n') % new)
2947 else: 2950 else:
2948 ui.write(_('update: %d new changesets, %d branch heads (merge)\n') % 2951 ui.write(_('update: %d new changesets, %d branch heads (merge)\n') %
2949 (new, len(bheads))) 2952 (new, len(bheads)))
2953
2954 if opts.get('remote'):
2955 t = []
2956 source, revs, checkout = hg.parseurl(ui.expandpath('default'),
2957 opts.get('rev'))
2958 other = hg.repository(cmdutil.remoteui(repo, {}), source)
2959 ui.debug('comparing with %s\n' % url.hidepassword(source))
2960 repo.ui.pushbuffer()
2961 common, incoming, rheads = repo.findcommonincoming(other)
2962 repo.ui.popbuffer()
2963 if incoming:
2964 t.append(_('1 or more incoming'))
2965
2966 dest, revs, checkout = hg.parseurl(
2967 ui.expandpath('default-push', 'default'))
2968 other = hg.repository(cmdutil.remoteui(repo, {}), dest)
2969 ui.debug('comparing with %s\n' % url.hidepassword(dest))
2970 repo.ui.pushbuffer()
2971 o = repo.findoutgoing(other)
2972 repo.ui.popbuffer()
2973 o = repo.changelog.nodesbetween(o, revs)[0]
2974 if o:
2975 t.append(_('%d outgoing') % len(o))
2976
2977 if t:
2978 ui.write(_('remote: %s\n') % (', '.join(t)))
2979 else:
2980 ui.status(_('remote: (synced)\n'))
2950 2981
2951 def tag(ui, repo, name1, *names, **opts): 2982 def tag(ui, repo, name1, *names, **opts):
2952 """add one or more tags for the current or given revision 2983 """add one or more tags for the current or given revision
2953 2984
2954 Name a particular revision using <name>. 2985 Name a particular revision using <name>.
3578 "showconfig|debugconfig": 3609 "showconfig|debugconfig":
3579 (showconfig, 3610 (showconfig,
3580 [('u', 'untrusted', None, _('show untrusted configuration options'))], 3611 [('u', 'untrusted', None, _('show untrusted configuration options'))],
3581 _('[-u] [NAME]...')), 3612 _('[-u] [NAME]...')),
3582 "^summary|sum": 3613 "^summary|sum":
3583 (summary, [], ''), 3614 (summary,
3615 [('', 'remote', None, _('check for push and pull'))], '[-p]'),
3584 "^status|st": 3616 "^status|st":
3585 (status, 3617 (status,
3586 [('A', 'all', None, _('show status of all files')), 3618 [('A', 'all', None, _('show status of all files')),
3587 ('m', 'modified', None, _('show only modified files')), 3619 ('m', 'modified', None, _('show only modified files')),
3588 ('a', 'added', None, _('show only added files')), 3620 ('a', 'added', None, _('show only added files')),