Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 2775:b550cd82f92a
Move merge code to its own module
Pull update and merge3 out of localrepo into merge.py
s/self/repo/
Add temporary API function in hg.py
Convert all users
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 03 Aug 2006 15:24:41 -0500 |
parents | 8cd3e19bf4a5 |
children | fdc232d8a193 |
comparison
equal
deleted
inserted
replaced
2774:8cd3e19bf4a5 | 2775:b550cd82f92a |
---|---|
8 from node import * | 8 from node import * |
9 from repo import * | 9 from repo import * |
10 from demandload import * | 10 from demandload import * |
11 from i18n import gettext as _ | 11 from i18n import gettext as _ |
12 demandload(globals(), "localrepo bundlerepo httprepo sshrepo statichttprepo") | 12 demandload(globals(), "localrepo bundlerepo httprepo sshrepo statichttprepo") |
13 demandload(globals(), "errno lock os shutil util") | 13 demandload(globals(), "errno lock os shutil util merge") |
14 | 14 |
15 def _local(path): | 15 def _local(path): |
16 return (os.path.isfile(path and util.drop_scheme('file', path)) and | 16 return (os.path.isfile(path and util.drop_scheme('file', path)) and |
17 bundlerepo or localrepo) | 17 bundlerepo or localrepo) |
18 | 18 |
36 thing = schemes.get(scheme) or schemes['file'] | 36 thing = schemes.get(scheme) or schemes['file'] |
37 try: | 37 try: |
38 return thing(path) | 38 return thing(path) |
39 except TypeError: | 39 except TypeError: |
40 return thing | 40 return thing |
41 | 41 |
42 def islocal(repo): | 42 def islocal(repo): |
43 '''return true if repo or path is local''' | 43 '''return true if repo or path is local''' |
44 if isinstance(repo, str): | 44 if isinstance(repo, str): |
45 try: | 45 try: |
46 return _lookup(repo).islocal(repo) | 46 return _lookup(repo).islocal(repo) |
198 | 198 |
199 if dest_lock: | 199 if dest_lock: |
200 dest_lock.release() | 200 dest_lock.release() |
201 | 201 |
202 if update: | 202 if update: |
203 dest_repo.update(dest_repo.changelog.tip()) | 203 merge.update(dest_repo, dest_repo.changelog.tip()) |
204 if dir_cleanup: | 204 if dir_cleanup: |
205 dir_cleanup.close() | 205 dir_cleanup.close() |
206 | 206 |
207 return src_repo, dest_repo | 207 return src_repo, dest_repo |
208 | |
209 | |
210 # This should instead be several functions with short arglists, like | |
211 # update/merge/revert | |
212 | |
213 def update(repo, node, allow=False, force=False, choose=None, | |
214 moddirstate=True, forcemerge=False, wlock=None, show_stats=True): | |
215 return merge.update(repo, node, allow, force, choose, moddirstate, | |
216 forcemerge, wlock, show_stats) |