Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 5177:92236732d5a1
move parseurl from cmdutil to hg
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 15 Aug 2007 16:10:36 -0500 |
parents | 126f527b3ba3 |
children | c1dbc9ae8f2b |
comparison
equal
deleted
inserted
replaced
5176:664a1c312972 | 5177:92236732d5a1 |
---|---|
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, cmdutil, extensions | 13 import errno, lock, os, shutil, util, extensions |
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 |
19 bundlerepo or localrepo) | 19 bundlerepo or localrepo) |
20 | |
21 def parseurl(url, revs): | |
22 '''parse url#branch, returning url, branch + revs''' | |
23 | |
24 if '#' not in url: | |
25 return url, (revs or None) | |
26 | |
27 url, rev = url.split('#', 1) | |
28 return url, revs + [rev] | |
20 | 29 |
21 schemes = { | 30 schemes = { |
22 'bundle': bundlerepo, | 31 'bundle': bundlerepo, |
23 'file': _local, | 32 'file': _local, |
24 'http': httprepo, | 33 'http': httprepo, |
93 update: update working directory after clone completes, if | 102 update: update working directory after clone completes, if |
94 destination is local repository | 103 destination is local repository |
95 """ | 104 """ |
96 | 105 |
97 origsource = source | 106 origsource = source |
98 source, rev = cmdutil.parseurl(ui.expandpath(source), rev) | 107 source, rev = parseurl(ui.expandpath(source), rev) |
99 | 108 |
100 if isinstance(source, str): | 109 if isinstance(source, str): |
101 src_repo = repository(ui, source) | 110 src_repo = repository(ui, source) |
102 else: | 111 else: |
103 src_repo = source | 112 src_repo = source |