Mercurial > hg
comparison mercurial/hg.py @ 7050:6788608627c4
merge with crew-stable
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Wed, 24 Sep 2008 13:50:29 +0200 |
parents | 25961e53a07f f82938c87b92 |
children | 810ca383da9c |
comparison
equal
deleted
inserted
replaced
7049:6489ee64b522 | 7050:6788608627c4 |
---|---|
18 | 18 |
19 def parseurl(url, revs=[]): | 19 def parseurl(url, revs=[]): |
20 '''parse url#branch, returning url, branch + revs''' | 20 '''parse url#branch, returning url, branch + revs''' |
21 | 21 |
22 if '#' not in url: | 22 if '#' not in url: |
23 return url, (revs or None), None | 23 return url, (revs or None), revs and revs[-1] or None |
24 | 24 |
25 url, rev = url.split('#', 1) | 25 url, branch = url.split('#', 1) |
26 return url, revs + [rev], rev | 26 checkout = revs and revs[-1] or branch |
27 return url, revs + [branch], checkout | |
27 | 28 |
28 schemes = { | 29 schemes = { |
29 'bundle': bundlerepo, | 30 'bundle': bundlerepo, |
30 'file': _local, | 31 'file': _local, |
31 'http': httprepo, | 32 'http': httprepo, |
118 source, rev, checkout = parseurl(origsource, rev) | 119 source, rev, checkout = parseurl(origsource, rev) |
119 src_repo = repository(ui, source) | 120 src_repo = repository(ui, source) |
120 else: | 121 else: |
121 src_repo = source | 122 src_repo = source |
122 origsource = source = src_repo.url() | 123 origsource = source = src_repo.url() |
123 checkout = None | 124 checkout = rev and rev[-1] or None |
124 | 125 |
125 if dest is None: | 126 if dest is None: |
126 dest = defaultdest(source) | 127 dest = defaultdest(source) |
127 ui.status(_("destination directory: %s\n") % dest) | 128 ui.status(_("destination directory: %s\n") % dest) |
128 | 129 |
229 | 230 |
230 if update: | 231 if update: |
231 dest_repo.ui.status(_("updating working directory\n")) | 232 dest_repo.ui.status(_("updating working directory\n")) |
232 if update is not True: | 233 if update is not True: |
233 checkout = update | 234 checkout = update |
234 elif not checkout: | 235 for test in (checkout, 'default', 'tip'): |
235 try: | 236 try: |
236 checkout = dest_repo.lookup("default") | 237 uprev = dest_repo.lookup(test) |
238 break | |
237 except: | 239 except: |
238 checkout = dest_repo.changelog.tip() | 240 continue |
239 _update(dest_repo, checkout) | 241 _update(dest_repo, uprev) |
240 | 242 |
241 return src_repo, dest_repo | 243 return src_repo, dest_repo |
242 finally: | 244 finally: |
243 del src_lock, dest_lock, dir_cleanup | 245 del src_lock, dest_lock, dir_cleanup |
244 | 246 |