Mercurial > hgsubversion
comparison fetch_command.py @ 38:9ee7ce0505eb
Fixes so that I can clone the melange repository successfully. Fixes a bug that
caused running out of file handles if there were a lot of ra calls.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Sun, 26 Oct 2008 13:55:57 -0500 |
parents | a9c15cae50e5 |
children | b3c7b844b782 |
comparison
equal
deleted
inserted
replaced
37:2d319e162598 | 38:9ee7ce0505eb |
---|---|
101 ui.status('Got a 502, retrying (%s)\n' % tries) | 101 ui.status('Got a 502, retrying (%s)\n' % tries) |
102 else: | 102 else: |
103 raise | 103 raise |
104 | 104 |
105 | 105 |
106 def cleanup_file_handles(svn, count): | |
107 if count % 50 == 0: | |
108 svn.init_ra_and_client() | |
109 | |
106 def replay_convert_rev(hg_editor, svn, r): | 110 def replay_convert_rev(hg_editor, svn, r): |
107 hg_editor.set_current_rev(r) | 111 hg_editor.set_current_rev(r) |
108 svn.get_replay(r.revnum, hg_editor) | 112 svn.get_replay(r.revnum, hg_editor) |
113 i = 1 | |
109 if hg_editor.missing_plaintexts: | 114 if hg_editor.missing_plaintexts: |
115 hg_editor.ui.status('Fetching %s files that could not use replay.\n' % | |
116 len(hg_editor.missing_plaintexts)) | |
110 files_to_grab = set() | 117 files_to_grab = set() |
111 dirs_to_list = [] | 118 dirs_to_list = [] |
112 props = {} | 119 props = {} |
120 hg_editor.ui.status('Getting properties...\n') | |
113 for p in hg_editor.missing_plaintexts: | 121 for p in hg_editor.missing_plaintexts: |
122 hg_editor.ui.status('.') | |
123 hg_editor.ui.flush() | |
114 p2 = p | 124 p2 = p |
115 if svn.subdir: | 125 if svn.subdir: |
116 p2 = p2[len(svn.subdir)-1:] | 126 p2 = p2[len(svn.subdir)-1:] |
117 # this *sometimes* raises on me, and I have | 127 # this *sometimes* raises on me, and I have |
118 # no idea why. TODO(augie) figure out the why. | 128 # no idea why. TODO(augie) figure out the why. |
119 try: | 129 try: |
120 pl = svn.proplist(p2, r.revnum, recurse=True) | 130 pl = svn.proplist(p2, r.revnum, recurse=True) |
131 cleanup_file_handles(svn, i) | |
132 i += 1 | |
121 except core.SubversionException, e: | 133 except core.SubversionException, e: |
122 pass | 134 pass |
123 props.update(pl) | 135 props.update(pl) |
124 if p[-1] == '/': | 136 if p[-1] == '/': |
125 dirs_to_list.append(p) | 137 dirs_to_list.append(p) |
126 else: | 138 else: |
127 files_to_grab.add(p) | 139 files_to_grab.add(p) |
140 hg_editor.ui.status('\nChecking for additional files in directories...\n') | |
128 while dirs_to_list: | 141 while dirs_to_list: |
142 hg_editor.ui.status('.') | |
143 hg_editor.ui.flush() | |
129 p = dirs_to_list.pop(0) | 144 p = dirs_to_list.pop(0) |
145 cleanup_file_handles(svn, i) | |
146 i += 1 | |
130 l = svn.list_dir(p[:-1], r.revnum) | 147 l = svn.list_dir(p[:-1], r.revnum) |
131 for f in l: | 148 for f in l: |
132 | 149 |
133 if l[f].kind == core.svn_node_dir: | 150 if l[f].kind == core.svn_node_dir: |
134 dirs_to_list.append(p+f+'/') | 151 dirs_to_list.append(p+f+'/') |
135 elif l[f].kind == core.svn_node_file: | 152 elif l[f].kind == core.svn_node_file: |
136 files_to_grab.add(p+f) | 153 files_to_grab.add(p+f) |
154 hg_editor.ui.status('\nFetching files...\n') | |
137 for p in files_to_grab: | 155 for p in files_to_grab: |
156 hg_editor.ui.status('.') | |
157 hg_editor.ui.flush() | |
138 p2 = p | 158 p2 = p |
139 if svn.subdir: | 159 if svn.subdir: |
140 p2 = p2[len(svn.subdir)-1:] | 160 p2 = p2[len(svn.subdir)-1:] |
161 cleanup_file_handles(svn, i) | |
162 i += 1 | |
141 hg_editor.current_files[p] = svn.get_file(p2, r.revnum) | 163 hg_editor.current_files[p] = svn.get_file(p2, r.revnum) |
142 hg_editor.current_files_exec[p] = False | 164 hg_editor.current_files_exec[p] = False |
143 if p in props: | 165 if p in props: |
144 if 'svn:executable' in props[p]: | 166 if 'svn:executable' in props[p]: |
145 hg_editor.current_files_exec[p] = True | 167 hg_editor.current_files_exec[p] = True |
146 if 'svn:special' in props[p]: | 168 if 'svn:special' in props[p]: |
147 hg_editor.current_files_symlink[p] = True | 169 hg_editor.current_files_symlink[p] = True |
148 hg_editor.missing_plaintexts = set() | 170 hg_editor.missing_plaintexts = set() |
171 hg_editor.ui.status('\n') | |
149 hg_editor.commit_current_delta() | 172 hg_editor.commit_current_delta() |
150 | 173 |
151 | 174 |
152 binary_file_re = re.compile(r'''Index: ([^\n]*) | 175 binary_file_re = re.compile(r'''Index: ([^\n]*) |
153 =* | 176 =* |