Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 4917:126f527b3ba3
Make repo locks recursive, eliminate all passing of lock/wlock
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 21 Jul 2007 16:02:10 -0500 |
parents | e56c7e05c7e6 |
children | 4106dde15aed |
comparison
equal
deleted
inserted
replaced
4916:5c5d23d93447 | 4917:126f527b3ba3 |
---|---|
1011 showfunc=get('show_function', 'showfunc'), | 1011 showfunc=get('show_function', 'showfunc'), |
1012 ignorews=get('ignore_all_space', 'ignorews'), | 1012 ignorews=get('ignore_all_space', 'ignorews'), |
1013 ignorewsamount=get('ignore_space_change', 'ignorewsamount'), | 1013 ignorewsamount=get('ignore_space_change', 'ignorewsamount'), |
1014 ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines')) | 1014 ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines')) |
1015 | 1015 |
1016 def updatedir(ui, repo, patches, wlock=None): | 1016 def updatedir(ui, repo, patches): |
1017 '''Update dirstate after patch application according to metadata''' | 1017 '''Update dirstate after patch application according to metadata''' |
1018 if not patches: | 1018 if not patches: |
1019 return | 1019 return |
1020 copies = [] | 1020 copies = [] |
1021 removes = {} | 1021 removes = {} |
1033 elif ctype == 'DELETE': | 1033 elif ctype == 'DELETE': |
1034 removes[gp.path] = 1 | 1034 removes[gp.path] = 1 |
1035 for src, dst, after in copies: | 1035 for src, dst, after in copies: |
1036 if not after: | 1036 if not after: |
1037 copyfile(src, dst, repo.root) | 1037 copyfile(src, dst, repo.root) |
1038 repo.copy(src, dst, wlock=wlock) | 1038 repo.copy(src, dst) |
1039 removes = removes.keys() | 1039 removes = removes.keys() |
1040 if removes: | 1040 if removes: |
1041 removes.sort() | 1041 removes.sort() |
1042 repo.remove(removes, True, wlock=wlock) | 1042 repo.remove(removes, True) |
1043 for f in patches: | 1043 for f in patches: |
1044 ctype, gp = patches[f] | 1044 ctype, gp = patches[f] |
1045 if gp and gp.mode: | 1045 if gp and gp.mode: |
1046 x = gp.mode & 0100 != 0 | 1046 x = gp.mode & 0100 != 0 |
1047 dst = os.path.join(repo.root, gp.path) | 1047 dst = os.path.join(repo.root, gp.path) |
1048 # patch won't create empty files | 1048 # patch won't create empty files |
1049 if ctype == 'ADD' and not os.path.exists(dst): | 1049 if ctype == 'ADD' and not os.path.exists(dst): |
1050 repo.wwrite(gp.path, '', x and 'x' or '') | 1050 repo.wwrite(gp.path, '', x and 'x' or '') |
1051 else: | 1051 else: |
1052 util.set_exec(dst, x) | 1052 util.set_exec(dst, x) |
1053 cmdutil.addremove(repo, cfiles, wlock=wlock) | 1053 cmdutil.addremove(repo, cfiles) |
1054 files = patches.keys() | 1054 files = patches.keys() |
1055 files.extend([r for r in removes if r not in files]) | 1055 files.extend([r for r in removes if r not in files]) |
1056 files.sort() | 1056 files.sort() |
1057 | 1057 |
1058 return files | 1058 return files |