comparison mercurial/commands.py @ 1781:284fc722c342

add an optional argument to push only the specified revisions (push -r)
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 14 Feb 2006 21:11:57 +0100
parents 21dcf38e5d7d
children b9671b41e360
comparison
equal deleted inserted replaced
1715:40346aa66b0f 1781:284fc722c342
1762 else: 1762 else:
1763 ui.status(_("(run 'hg update' to get a working copy)\n")) 1763 ui.status(_("(run 'hg update' to get a working copy)\n"))
1764 1764
1765 return r 1765 return r
1766 1766
1767 def push(ui, repo, dest="default-push", force=False, ssh=None, remotecmd=None): 1767 def push(ui, repo, dest="default-push", **opts):
1768 """push changes to the specified destination 1768 """push changes to the specified destination
1769 1769
1770 Push changes from the local repository to the given destination. 1770 Push changes from the local repository to the given destination.
1771 1771
1772 This is the symmetrical operation for pull. It helps to move 1772 This is the symmetrical operation for pull. It helps to move
1787 machine and a copy of hg in the remote path. 1787 machine and a copy of hg in the remote path.
1788 """ 1788 """
1789 dest = ui.expandpath(dest, repo.root) 1789 dest = ui.expandpath(dest, repo.root)
1790 ui.status('pushing to %s\n' % (dest)) 1790 ui.status('pushing to %s\n' % (dest))
1791 1791
1792 if ssh: 1792 if opts['ssh']:
1793 ui.setconfig("ui", "ssh", ssh) 1793 ui.setconfig("ui", "ssh", opts['ssh'])
1794 if remotecmd: 1794 if opts['remotecmd']:
1795 ui.setconfig("ui", "remotecmd", remotecmd) 1795 ui.setconfig("ui", "remotecmd", opts['remotecmd'])
1796 1796
1797 other = hg.repository(ui, dest) 1797 other = hg.repository(ui, dest)
1798 r = repo.push(other, force) 1798 revs = None
1799 if opts['rev']:
1800 revs = [repo.lookup(rev) for rev in opts['rev']]
1801 r = repo.push(other, opts['force'], revs=revs)
1799 return r 1802 return r
1800 1803
1801 def rawcommit(ui, repo, *flist, **rc): 1804 def rawcommit(ui, repo, *flist, **rc):
1802 """raw commit interface (DEPRECATED) 1805 """raw commit interface (DEPRECATED)
1803 1806
2415 _('update the working directory to tip after pull')), 2418 _('update the working directory to tip after pull')),
2416 ('e', 'ssh', '', _('specify ssh command to use')), 2419 ('e', 'ssh', '', _('specify ssh command to use')),
2417 ('r', 'rev', [], _('a specific revision you would like to pull')), 2420 ('r', 'rev', [], _('a specific revision you would like to pull')),
2418 ('', 'remotecmd', '', 2421 ('', 'remotecmd', '',
2419 _('specify hg command to run on the remote side'))], 2422 _('specify hg command to run on the remote side'))],
2420 _('hg pull [-u] [-e FILE] [-r rev] [--remotecmd FILE] [SOURCE]')), 2423 _('hg pull [-u] [-e FILE] [-r rev]... [--remotecmd FILE] [SOURCE]')),
2421 "^push": 2424 "^push":
2422 (push, 2425 (push,
2423 [('f', 'force', None, _('force push')), 2426 [('f', 'force', None, _('force push')),
2424 ('e', 'ssh', '', _('specify ssh command to use')), 2427 ('e', 'ssh', '', _('specify ssh command to use')),
2428 ('r', 'rev', [], _('a specific revision you would like to push')),
2425 ('', 'remotecmd', '', 2429 ('', 'remotecmd', '',
2426 _('specify hg command to run on the remote side'))], 2430 _('specify hg command to run on the remote side'))],
2427 _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')), 2431 _('hg push [-f] [-e FILE] [-r rev]... [--remotecmd FILE] [DEST]')),
2428 "rawcommit": 2432 "rawcommit":
2429 (rawcommit, 2433 (rawcommit,
2430 [('p', 'parent', [], _('parent')), 2434 [('p', 'parent', [], _('parent')),
2431 ('d', 'date', '', _('date code')), 2435 ('d', 'date', '', _('date code')),
2432 ('u', 'user', '', _('user')), 2436 ('u', 'user', '', _('user')),