Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 1465:be6b5ce60b7f
Implementing pull -r and changing clone -r. Both now support
multiple 'target' revisions.
author | Eric Hopper <hopper@omnifarious.org> |
---|---|
date | Tue, 11 Oct 2005 08:39:21 -0700 |
parents | 02099220ad49 |
children | 06d5d8794e5f |
comparison
equal
deleted
inserted
replaced
1464:00117edce2dd | 1465:be6b5ce60b7f |
---|---|
652 util.copyfiles(src, dst) | 652 util.copyfiles(src, dst) |
653 | 653 |
654 repo = hg.repository(ui, dest) | 654 repo = hg.repository(ui, dest) |
655 | 655 |
656 else: | 656 else: |
657 repo = hg.repository(ui, dest, create=1) | |
658 rev = None | 657 rev = None |
659 if opts['rev']: | 658 if opts['rev']: |
660 rev = [other.lookup(opts['rev'])] | 659 if not other.local(): |
661 repo.pull(other, heads = rev) | 660 raise util.Abort("clone -r not supported yet for remote repositories.") |
661 else: | |
662 revs = [other.lookup(rev) for rev in opts['rev']] | |
663 repo = hg.repository(ui, dest, create=1) | |
664 repo.pull(other, heads = revs) | |
662 | 665 |
663 f = repo.opener("hgrc", "w", text=True) | 666 f = repo.opener("hgrc", "w", text=True) |
664 f.write("[paths]\n") | 667 f.write("[paths]\n") |
665 f.write("default = %s\n" % abspath) | 668 f.write("default = %s\n" % abspath) |
666 | 669 |
1354 ui.setconfig("ui", "ssh", opts['ssh']) | 1357 ui.setconfig("ui", "ssh", opts['ssh']) |
1355 if opts['remotecmd']: | 1358 if opts['remotecmd']: |
1356 ui.setconfig("ui", "remotecmd", opts['remotecmd']) | 1359 ui.setconfig("ui", "remotecmd", opts['remotecmd']) |
1357 | 1360 |
1358 other = hg.repository(ui, source) | 1361 other = hg.repository(ui, source) |
1359 r = repo.pull(other) | 1362 revs = None |
1363 if opts['rev'] and not other.local(): | |
1364 raise util.Abort("pull -r doesn't work for remote repositories yet") | |
1365 elif opts['rev']: | |
1366 revs = [other.lookup(rev) for rev in opts['rev']] | |
1367 r = repo.pull(other, heads=revs) | |
1360 if not r: | 1368 if not r: |
1361 if opts['update']: | 1369 if opts['update']: |
1362 return update(ui, repo) | 1370 return update(ui, repo) |
1363 else: | 1371 else: |
1364 ui.status("(run 'hg update' to get a working copy)\n") | 1372 ui.status("(run 'hg update' to get a working copy)\n") |
1783 'hg cat [OPTION]... FILE...'), | 1791 'hg cat [OPTION]... FILE...'), |
1784 "^clone": | 1792 "^clone": |
1785 (clone, | 1793 (clone, |
1786 [('U', 'noupdate', None, 'skip update after cloning'), | 1794 [('U', 'noupdate', None, 'skip update after cloning'), |
1787 ('e', 'ssh', "", 'ssh command'), | 1795 ('e', 'ssh', "", 'ssh command'), |
1788 ('r', 'rev', "", 'only clone changesets needed to create revision'), | 1796 ('r', 'rev', [], 'a changeset you would like to have after cloning'), |
1789 ('', 'pull', None, 'use pull protocol to copy metadata'), | 1797 ('', 'pull', None, 'use pull protocol to copy metadata'), |
1790 ('', 'remotecmd', "", 'remote hg command')], | 1798 ('', 'remotecmd', "", 'remote hg command')], |
1791 'hg clone [OPTION]... SOURCE [DEST]'), | 1799 'hg clone [OPTION]... SOURCE [DEST]'), |
1792 "^commit|ci": | 1800 "^commit|ci": |
1793 (commit, | 1801 (commit, |
1890 "paths": (paths, [], 'hg paths [NAME]'), | 1898 "paths": (paths, [], 'hg paths [NAME]'), |
1891 "^pull": | 1899 "^pull": |
1892 (pull, | 1900 (pull, |
1893 [('u', 'update', None, 'update working directory'), | 1901 [('u', 'update', None, 'update working directory'), |
1894 ('e', 'ssh', "", 'ssh command'), | 1902 ('e', 'ssh', "", 'ssh command'), |
1895 ('', 'remotecmd', "", 'remote hg command')], | 1903 ('', 'remotecmd', "", 'remote hg command'), |
1896 'hg pull [-u] [-e FILE] [--remotecmd FILE] [SOURCE]'), | 1904 ('r', 'rev', [], 'a specific revision you would like to pull')], |
1905 'hg pull [-u] [-e FILE] [--remotecmd FILE] [-r rev]... [SOURCE]'), | |
1897 "^push": | 1906 "^push": |
1898 (push, | 1907 (push, |
1899 [('f', 'force', None, 'force push'), | 1908 [('f', 'force', None, 'force push'), |
1900 ('e', 'ssh', "", 'ssh command'), | 1909 ('e', 'ssh', "", 'ssh command'), |
1901 ('', 'remotecmd', "", 'remote hg command')], | 1910 ('', 'remotecmd', "", 'remote hg command')], |