comparison fetch_command.py @ 98:c7ac013cf7fd

fetch_command: simplify replay_convert_rev() with svn.list_files()
author Patrick Mezard <pmezard@gmail.com>
date Thu, 20 Nov 2008 22:41:14 -0600
parents 0d3a2a7cefa3
children a3b717e4abf5
comparison
equal deleted inserted replaced
97:0d3a2a7cefa3 98:c7ac013cf7fd
116 i = 1 116 i = 1
117 if hg_editor.missing_plaintexts: 117 if hg_editor.missing_plaintexts:
118 hg_editor.ui.status('Fetching %s files that could not use replay.\n' % 118 hg_editor.ui.status('Fetching %s files that could not use replay.\n' %
119 len(hg_editor.missing_plaintexts)) 119 len(hg_editor.missing_plaintexts))
120 files_to_grab = set() 120 files_to_grab = set()
121 dirs_to_list = [] 121 rootpath = svn.subdir and svn.subdir[1:] or ''
122 for p in hg_editor.missing_plaintexts: 122 for p in hg_editor.missing_plaintexts:
123 hg_editor.ui.status('.') 123 hg_editor.ui.status('.')
124 hg_editor.ui.flush() 124 hg_editor.ui.flush()
125 if p[-1] == '/': 125 if p[-1] == '/':
126 dirs_to_list.append(p) 126 dirpath = p[len(rootpath):]
127 files_to_grab.update((dirpath + f for f,k in
128 svn.list_files(p, r.revnum) if k == 'f'))
127 else: 129 else:
128 files_to_grab.add(p) 130 files_to_grab.add(p[len(rootpath):])
129 if dirs_to_list:
130 hg_editor.ui.status('\nChecking for additional files in'
131 ' directories...\n')
132 while dirs_to_list:
133 hg_editor.ui.status('.')
134 hg_editor.ui.flush()
135 p = dirs_to_list.pop(0)
136 cleanup_file_handles(svn, i)
137 i += 1
138 p2 = p[:-1]
139 if svn.subdir:
140 p2 = p2[len(svn.subdir)-1:]
141 l = svn.list_dir(p2, r.revnum)
142 for f in l:
143 if l[f].kind == core.svn_node_dir:
144 dirs_to_list.append(p+f+'/')
145 elif l[f].kind == core.svn_node_file:
146 files_to_grab.add(p+f)
147 hg_editor.ui.status('\nFetching files...\n') 131 hg_editor.ui.status('\nFetching files...\n')
148 for p in files_to_grab: 132 for p in files_to_grab:
149 hg_editor.ui.status('.') 133 hg_editor.ui.status('.')
150 hg_editor.ui.flush() 134 hg_editor.ui.flush()
151 p2 = p
152 if svn.subdir:
153 p2 = p2[len(svn.subdir)-1:]
154 cleanup_file_handles(svn, i) 135 cleanup_file_handles(svn, i)
155 i += 1 136 i += 1
156 data, mode = svn.get_file(p2, r.revnum) 137 data, mode = svn.get_file(p, r.revnum)
157 hg_editor.set_file(p, data, 'x' in mode, 'l' in mode) 138 hg_editor.set_file(p, data, 'x' in mode, 'l' in mode)
158 hg_editor.missing_plaintexts = set() 139 hg_editor.missing_plaintexts = set()
159 hg_editor.ui.status('\n') 140 hg_editor.ui.status('\n')
160 hg_editor.commit_current_delta() 141 hg_editor.commit_current_delta()
161 142