Mercurial > hg
comparison mercurial/hg.py @ 4478:b2b55acbacdd
Add support for url#id syntax
This allows you to do:
hg clone http://server/repo#stable
which is equivalent to:
hg clone -r stable http://server/repo
Future incoming, outgoing, and push commands will default to using
this id because it's recorded in the default path.
Other commands that accept URLs (push, pull, bundle, incoming, and
outgoing) also accept this syntax.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 01 Jun 2007 18:40:14 -0500 |
parents | 6cbfa740c129 |
children | 63b9d2deed48 |
comparison
equal
deleted
inserted
replaced
4477:6cbfa740c129 | 4478:b2b55acbacdd |
---|---|
8 | 8 |
9 from node import * | 9 from node import * |
10 from repo import * | 10 from repo import * |
11 from i18n import _ | 11 from i18n import _ |
12 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo | 12 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo |
13 import errno, lock, os, shutil, util | 13 import errno, lock, os, shutil, util, cmdutil |
14 import merge as _merge | 14 import merge as _merge |
15 import verify as _verify | 15 import verify as _verify |
16 | 16 |
17 def _local(path): | 17 def _local(path): |
18 return (os.path.isfile(util.drop_scheme('file', path)) and | 18 return (os.path.isfile(util.drop_scheme('file', path)) and |
95 rev: revision to clone up to (implies pull=True) | 95 rev: revision to clone up to (implies pull=True) |
96 | 96 |
97 update: update working directory after clone completes, if | 97 update: update working directory after clone completes, if |
98 destination is local repository | 98 destination is local repository |
99 """ | 99 """ |
100 | |
101 origsource = source | |
102 source, rev = cmdutil.parseurl(ui.expandpath(source), rev) | |
103 | |
100 if isinstance(source, str): | 104 if isinstance(source, str): |
101 src_repo = repository(ui, source) | 105 src_repo = repository(ui, source) |
102 else: | 106 else: |
103 src_repo = source | 107 src_repo = source |
104 source = src_repo.url() | 108 source = src_repo.url() |
132 | 136 |
133 dir_cleanup = None | 137 dir_cleanup = None |
134 if islocal(dest): | 138 if islocal(dest): |
135 dir_cleanup = DirCleanup(dest) | 139 dir_cleanup = DirCleanup(dest) |
136 | 140 |
137 abspath = source | 141 abspath = origsource |
138 copy = False | 142 copy = False |
139 if src_repo.local() and islocal(dest): | 143 if src_repo.local() and islocal(dest): |
140 abspath = os.path.abspath(source) | 144 abspath = os.path.abspath(origsource) |
141 copy = not pull and not rev | 145 copy = not pull and not rev |
142 | 146 |
143 src_lock, dest_lock = None, None | 147 src_lock, dest_lock = None, None |
144 if copy: | 148 if copy: |
145 try: | 149 try: |