comparison mercurial/commands.py @ 6191:01594b0c86e2

Add option -l/--limit to hg incoming and hg outgoing.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 29 Feb 2008 02:15:31 +0100
parents a79d9408806f
children cd65a67aff31
comparison
equal deleted inserted replaced
6190:a79d9408806f 6191:01594b0c86e2
1559 For remote repository, using --bundle avoids downloading the changesets 1559 For remote repository, using --bundle avoids downloading the changesets
1560 twice if the incoming is followed by a pull. 1560 twice if the incoming is followed by a pull.
1561 1561
1562 See pull for valid source format details. 1562 See pull for valid source format details.
1563 """ 1563 """
1564 limit = cmdutil.loglimit(opts)
1564 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev']) 1565 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev'])
1565 cmdutil.setremoteconfig(ui, opts) 1566 cmdutil.setremoteconfig(ui, opts)
1566 1567
1567 other = hg.repository(ui, source) 1568 other = hg.repository(ui, source)
1568 ui.status(_('comparing with %s\n') % util.hidepassword(source)) 1569 ui.status(_('comparing with %s\n') % util.hidepassword(source))
1597 1598
1598 o = other.changelog.nodesbetween(incoming, revs)[0] 1599 o = other.changelog.nodesbetween(incoming, revs)[0]
1599 if opts['newest_first']: 1600 if opts['newest_first']:
1600 o.reverse() 1601 o.reverse()
1601 displayer = cmdutil.show_changeset(ui, other, opts) 1602 displayer = cmdutil.show_changeset(ui, other, opts)
1603 count = 0
1602 for n in o: 1604 for n in o:
1605 if count >= limit:
1606 break
1603 parents = [p for p in other.changelog.parents(n) if p != nullid] 1607 parents = [p for p in other.changelog.parents(n) if p != nullid]
1604 if opts['no_merges'] and len(parents) == 2: 1608 if opts['no_merges'] and len(parents) == 2:
1605 continue 1609 continue
1610 count += 1
1606 displayer.show(changenode=n) 1611 displayer.show(changenode=n)
1607 finally: 1612 finally:
1608 if hasattr(other, 'close'): 1613 if hasattr(other, 'close'):
1609 other.close() 1614 other.close()
1610 if cleanup: 1615 if cleanup:
1867 the default push location. These are the changesets that would be pushed 1872 the default push location. These are the changesets that would be pushed
1868 if a push was requested. 1873 if a push was requested.
1869 1874
1870 See pull for valid destination format details. 1875 See pull for valid destination format details.
1871 """ 1876 """
1877 limit = cmdutil.loglimit(opts)
1872 dest, revs, checkout = hg.parseurl( 1878 dest, revs, checkout = hg.parseurl(
1873 ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev']) 1879 ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev'])
1874 cmdutil.setremoteconfig(ui, opts) 1880 cmdutil.setremoteconfig(ui, opts)
1875 if revs: 1881 if revs:
1876 revs = [repo.lookup(rev) for rev in revs] 1882 revs = [repo.lookup(rev) for rev in revs]
1883 return 1 1889 return 1
1884 o = repo.changelog.nodesbetween(o, revs)[0] 1890 o = repo.changelog.nodesbetween(o, revs)[0]
1885 if opts['newest_first']: 1891 if opts['newest_first']:
1886 o.reverse() 1892 o.reverse()
1887 displayer = cmdutil.show_changeset(ui, repo, opts) 1893 displayer = cmdutil.show_changeset(ui, repo, opts)
1894 count = 0
1888 for n in o: 1895 for n in o:
1896 if count >= limit:
1897 break
1889 parents = [p for p in repo.changelog.parents(n) if p != nullid] 1898 parents = [p for p in repo.changelog.parents(n) if p != nullid]
1890 if opts['no_merges'] and len(parents) == 2: 1899 if opts['no_merges'] and len(parents) == 2:
1891 continue 1900 continue
1901 count += 1
1892 displayer.show(changenode=n) 1902 displayer.show(changenode=n)
1893 1903
1894 def parents(ui, repo, file_=None, **opts): 1904 def parents(ui, repo, file_=None, **opts):
1895 """show the parents of the working dir or revision 1905 """show the parents of the working dir or revision
1896 1906
2973 _('run even when remote repository is unrelated')), 2983 _('run even when remote repository is unrelated')),
2974 ('', 'style', '', _('display using template map file')), 2984 ('', 'style', '', _('display using template map file')),
2975 ('n', 'newest-first', None, _('show newest record first')), 2985 ('n', 'newest-first', None, _('show newest record first')),
2976 ('', 'bundle', '', _('file to store the bundles into')), 2986 ('', 'bundle', '', _('file to store the bundles into')),
2977 ('p', 'patch', None, _('show patch')), 2987 ('p', 'patch', None, _('show patch')),
2988 ('l', 'limit', '', _('limit number of changes displayed')),
2978 ('r', 'rev', [], _('a specific revision up to which you would like to pull')), 2989 ('r', 'rev', [], _('a specific revision up to which you would like to pull')),
2979 ('', 'template', '', _('display with template')), 2990 ('', 'template', '', _('display with template')),
2980 ] + remoteopts, 2991 ] + remoteopts,
2981 _('hg incoming [-p] [-n] [-M] [-f] [-r REV]...' 2992 _('hg incoming [-p] [-n] [-M] [-f] [-r REV]...'
2982 ' [--bundle FILENAME] [SOURCE]')), 2993 ' [--bundle FILENAME] [SOURCE]')),
3030 [('M', 'no-merges', None, _('do not show merges')), 3041 [('M', 'no-merges', None, _('do not show merges')),
3031 ('f', 'force', None, 3042 ('f', 'force', None,
3032 _('run even when remote repository is unrelated')), 3043 _('run even when remote repository is unrelated')),
3033 ('p', 'patch', None, _('show patch')), 3044 ('p', 'patch', None, _('show patch')),
3034 ('', 'style', '', _('display using template map file')), 3045 ('', 'style', '', _('display using template map file')),
3046 ('l', 'limit', '', _('limit number of changes displayed')),
3035 ('r', 'rev', [], _('a specific revision you would like to push')), 3047 ('r', 'rev', [], _('a specific revision you would like to push')),
3036 ('n', 'newest-first', None, _('show newest record first')), 3048 ('n', 'newest-first', None, _('show newest record first')),
3037 ('', 'template', '', _('display with template')), 3049 ('', 'template', '', _('display with template')),
3038 ] + remoteopts, 3050 ] + remoteopts,
3039 _('hg outgoing [-M] [-p] [-n] [-f] [-r REV]... [DEST]')), 3051 _('hg outgoing [-M] [-p] [-n] [-f] [-r REV]... [DEST]')),