comparison mercurial/hg.py @ 5241:5517aa5aafb0

Merge with crew-stable
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 27 Aug 2007 02:21:58 -0300
parents 60acf1432ee0 76c4cadb49fc
children a32a8e50d233
comparison
equal deleted inserted replaced
5234:20770c5d41e0 5241:5517aa5aafb0
20 20
21 def parseurl(url, revs): 21 def parseurl(url, revs):
22 '''parse url#branch, returning url, branch + revs''' 22 '''parse url#branch, returning url, branch + revs'''
23 23
24 if '#' not in url: 24 if '#' not in url:
25 return url, (revs or None) 25 return url, (revs or None), None
26 26
27 url, rev = url.split('#', 1) 27 url, rev = url.split('#', 1)
28 return url, revs + [rev] 28 return url, revs + [rev], rev
29 29
30 schemes = { 30 schemes = {
31 'bundle': bundlerepo, 31 'bundle': bundlerepo,
32 'file': _local, 32 'file': _local,
33 'http': httprepo, 33 'http': httprepo,
104 update: update working directory after clone completes, if 104 update: update working directory after clone completes, if
105 destination is local repository 105 destination is local repository
106 """ 106 """
107 107
108 origsource = source 108 origsource = source
109 source, rev = parseurl(ui.expandpath(source), rev) 109 source, rev, checkout = parseurl(ui.expandpath(source), rev)
110 110
111 if isinstance(source, str): 111 if isinstance(source, str):
112 src_repo = repository(ui, source) 112 src_repo = repository(ui, source)
113 else: 113 else:
114 src_repo = source 114 src_repo = source
147 dir_cleanup = DirCleanup(dest) 147 dir_cleanup = DirCleanup(dest)
148 148
149 abspath = origsource 149 abspath = origsource
150 copy = False 150 copy = False
151 if src_repo.local() and islocal(dest): 151 if src_repo.local() and islocal(dest):
152 abspath = os.path.abspath(origsource) 152 abspath = os.path.abspath(util.drop_scheme('file', origsource))
153 copy = not pull and not rev 153 copy = not pull and not rev
154 154
155 if copy: 155 if copy:
156 try: 156 try:
157 # we use a lock here because if we race with commit, we 157 # we use a lock here because if we race with commit, we
224 fp.write("[paths]\n") 224 fp.write("[paths]\n")
225 fp.write("default = %s\n" % abspath) 225 fp.write("default = %s\n" % abspath)
226 fp.close() 226 fp.close()
227 227
228 if update: 228 if update:
229 try: 229 if not checkout:
230 checkout = dest_repo.lookup("default") 230 try:
231 except: 231 checkout = dest_repo.lookup("default")
232 checkout = dest_repo.changelog.tip() 232 except:
233 checkout = dest_repo.changelog.tip()
233 _update(dest_repo, checkout) 234 _update(dest_repo, checkout)
234 235
235 return src_repo, dest_repo 236 return src_repo, dest_repo
236 finally: 237 finally:
237 del src_lock, dest_lock, dir_cleanup 238 del src_lock, dest_lock, dir_cleanup